public boolean allFieldsHaveValue(String name, String value) { for (PageElement element : getElementsByName("variableValues." + name)) { Poller.waitUntilTrue(element.timed().hasValue(value)); } return true; } }
public void typeReplaceQuery(String replacement) { replaceInput.click(); replaceInput.clear(); replaceInput.type(replacement); Poller.waitUntilTrue(replaceInput.timed().hasValue(replacement)); }
public void typeSearchQuery(String searchTerm) { findInput.click(); findInput.clear(); findInput.type(searchTerm); Poller.waitUntilTrue(findInput.timed().hasValue(searchTerm)); }
private void clickAddAndWaitForLabel(String label) { waitUntilTrue("Labels input field should have new label", labelsInput.timed().hasValue(label)); addButton.click(); waitUntilTrue("New label should be visible", getLabelSection().hasLabelCondition(label)); }
public void login(String username, String password, boolean rememberMe) { assertThat("Cannot log in: user is already logged in", loginSection.getText(), not(containsString("You are currently logged in"))); waitUntilTrue("Login form is not present on login page: " + loginSection.getText(), pageElementFinder.find(By.name("loginform")).timed().isPresent()); //clear the username and password fields first before typing it in - this works around the chrome browser //saving the username/password on autocomplete waitUntilTrue("Login page username field is not visible", usernameField.timed().isVisible()); driver.executeScript("AJS.$('#os_username').attr('value', '" + username + "')"); waitUntilTrue("Login page username field does not contain the expected value [" + username + "]", usernameField.timed().hasValue(username)); waitUntilTrue("Login page password field is not visible", passwordField.timed().isVisible()); driver.executeScript("AJS.$('#os_password').attr('value', '" + password + "')"); waitUntilTrue("Login page password field does not contain the expected value", passwordField.timed().hasValue(password)); if (rememberMe) { rememberMeTickBox.click(); } loginForm.submit(); }
private void typeInLabelsInput(String label) { waitUntilTrue("Labels input field should be visible", labelsInput.timed().isVisible()); labelsInput.click().clear().type(label); if (!label.equals(labelsInput.getValue())) { labelsInput.click().clear().type(label); } waitUntilTrue("Labels input field should have new label", labelsInput.timed().hasValue(label)); }