Search in sources :

Example 51 with WebElement

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();
    }
}
Also used : By(org.openqa.selenium.By) WebElement(org.openqa.selenium.WebElement)

Example 52 with WebElement

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();
    }
}
Also used : By(org.openqa.selenium.By) WebElement(org.openqa.selenium.WebElement)

Example 53 with WebElement

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());
    }
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) WebElement(org.openqa.selenium.WebElement) Test(org.junit.Test)

Example 54 with WebElement

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);
    }
}
Also used : JavascriptExecutor(org.openqa.selenium.JavascriptExecutor) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) WebElement(org.openqa.selenium.WebElement)

Example 55 with WebElement

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);
}
Also used : WebElement(org.openqa.selenium.WebElement)

Aggregations

WebElement (org.openqa.selenium.WebElement)520 Test (org.junit.Test)96 WebDriver (org.openqa.selenium.WebDriver)85 PublicAtsApi (com.axway.ats.common.PublicAtsApi)57 Actions (org.openqa.selenium.interactions.Actions)55 FirefoxDriver (org.openqa.selenium.firefox.FirefoxDriver)46 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)40 By (org.openqa.selenium.By)36 URL (java.net.URL)35 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)34 RealHtmlElementState (com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState)30 JavascriptExecutor (org.openqa.selenium.JavascriptExecutor)21 NoSuchElementException (org.openqa.selenium.NoSuchElementException)21 HiddenHtmlElementState (com.axway.ats.uiengine.utilities.hiddenbrowser.HiddenHtmlElementState)19 ArrayList (java.util.ArrayList)18 SeleniumOperationException (com.axway.ats.uiengine.exceptions.SeleniumOperationException)13 Select (org.openqa.selenium.support.ui.Select)13 TimeoutException (org.openqa.selenium.TimeoutException)12 VisualEditorPageObject (com.wikia.webdriver.pageobjectsfactory.pageobject.visualeditor.VisualEditorPageObject)11 List (java.util.List)10