use of org.openqa.selenium.WebElement in project ORCID-Source by ORCID.
the class BlackBoxBase method deleteAllExternalIdentifiersInModal.
public static void deleteAllExternalIdentifiersInModal() {
waitForAngular();
By rowBy = By.xpath("//div[@ng-repeat='externalIdentifier in externalIdentifiersForm.externalIdentifiers']");
waitForElementVisibility(rowBy);
List<WebElement> webElements = findElement(rowBy).findElements(By.xpath("//span[@ng-click='deleteExternalIdentifier(externalIdentifier)']"));
for (WebElement webElement : webElements) {
ngAwareClick(webElement);
waitForAngular();
}
}
use of org.openqa.selenium.WebElement in project ORCID-Source by ORCID.
the class BlackBoxBase method removeAllWorks.
public void removeAllWorks() {
waitForAngular();
List<WebElement> trashCans = findWorksTrashCans();
while (!trashCans.isEmpty()) {
for (WebElement trashCan : trashCans) {
ngAwareClick(trashCan);
waitForCboxComplete();
By deleteButton = By.xpath("//div[@id='colorbox']//div[@class='btn btn-danger']");
waitForElementVisibility(deleteButton);
ngAwareClick(findElement(deleteButton));
waitForNoCboxOverlay();
}
trashCans = findWorksTrashCans();
}
}
use of org.openqa.selenium.WebElement in project ORCID-Source by ORCID.
the class GroupIdRecordTest method testGetGroupIdRecordsWithSeveralFormats_v2.
/**
* --------- -- -- -- Release -- -- -- ---------
*
*/
@Test
public void testGetGroupIdRecordsWithSeveralFormats_v2() throws JSONException, InterruptedException, URISyntaxException, UnsupportedEncodingException {
String token = oauthHelper.getClientCredentialsAccessToken(this.getClient1ClientId(), this.getClient1ClientSecret(), ScopePathType.GROUP_ID_RECORD_UPDATE);
for (String groupId : VALID_GROUP_IDS) {
org.orcid.jaxb.model.groupid_v2.GroupIdRecord g1 = new org.orcid.jaxb.model.groupid_v2.GroupIdRecord();
g1.setDescription("Description");
g1.setGroupId(groupId);
g1.setName("Group # " + System.currentTimeMillis());
g1.setType("publisher");
ClientResponse r1 = memberV2ApiClient_release.createGroupIdRecord(g1, token);
String r1LocationPutCode = r1.getLocation().getPath().replace("/orcid-api-web/v2.0/group-id-record/", "");
g1.setPutCode(Long.valueOf(r1LocationPutCode));
webDriver.get(getWebBaseUrl() + "/public/group/" + g1.getPutCode());
WebElement preElement = webDriver.findElement(By.tagName("pre"));
String groupElementString = preElement.getText();
assertFalse(PojoUtil.isEmpty(groupElementString));
org.orcid.jaxb.model.groupid_v2.GroupIdRecord groupFromWebPage = JsonUtils.readObjectFromJsonString(groupElementString, org.orcid.jaxb.model.groupid_v2.GroupIdRecord.class);
assertNotNull(groupFromWebPage);
assertEquals("Missing " + groupId, groupId, groupFromWebPage.getGroupId());
putsToDelete.add(g1.getPutCode());
}
for (String invdalidGroupId : INVALID_GROUP_IDS) {
org.orcid.jaxb.model.groupid_v2.GroupIdRecord g1 = new org.orcid.jaxb.model.groupid_v2.GroupIdRecord();
g1.setDescription("Description");
g1.setGroupId(invdalidGroupId);
g1.setName("Group # " + System.currentTimeMillis());
g1.setType("publisher");
ClientResponse r1 = memberV2ApiClient_release.createGroupIdRecord(g1, token);
assertNotNull(r1);
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), r1.getStatus());
}
}
use of org.openqa.selenium.WebElement in project ORCID-Source by ORCID.
the class SigninTest method dismissVerifyEmailModal.
public static void dismissVerifyEmailModal(WebDriver webDriver) {
WebDriverWait wait = new WebDriverWait(webDriver, 10);
List<WebElement> weList = webDriver.findElements(By.xpath("//div[@ng-controller='VerifyEmailCtrl']"));
if (weList.size() > 0) {
// we need to wait for the color box to appear
wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath("//div[@ng-controller='VerifyEmailCtrl' and @orcid-loading='false']")));
((JavascriptExecutor) webDriver).executeScript("$.colorbox.close();");
colorBoxIsClosed(wait);
}
}
use of org.openqa.selenium.WebElement in project ORCID-Source by ORCID.
the class SigninTest method signIn.
// Make this available to other classes
public static void signIn(WebDriver webDriver, String username, String password) {
BBBUtil.extremeWaitFor(BBBUtil.documentReady(), webDriver);
BBBUtil.extremeWaitFor(BBBUtil.angularHasFinishedProcessing(), webDriver);
BBBUtil.extremeWaitFor(ExpectedConditions.presenceOfElementLocated(By.xpath("//input[@name='userId']")), webDriver);
BBBUtil.extremeWaitFor(BBBUtil.angularHasFinishedProcessing(), webDriver);
WebElement emailEl = webDriver.findElement(By.xpath("//input[@name='userId']"));
emailEl.sendKeys(username);
BBBUtil.extremeWaitFor(BBBUtil.angularHasFinishedProcessing(), webDriver);
WebElement passwordEl = webDriver.findElement(By.xpath("//input[@name='password']"));
passwordEl.sendKeys(password);
BBBUtil.extremeWaitFor(BBBUtil.angularHasFinishedProcessing(), webDriver);
WebElement buttonEl = webDriver.findElement(By.xpath("//button[@id='form-sign-in-button']"));
BBBUtil.ngAwareClick(buttonEl, webDriver);
BBBUtil.extremeWaitFor(ExpectedConditions.presenceOfElementLocated(By.xpath("//a[text()='Sign out']")), webDriver);
BBBUtil.extremeWaitFor(BBBUtil.documentReady(), webDriver);
BBBUtil.extremeWaitFor(BBBUtil.angularHasFinishedProcessing(), webDriver);
}
Aggregations