Search in sources :

Example 16 with NoSuchElementException

use of org.openqa.selenium.NoSuchElementException in project selenium-tests by Wikia.

the class MobileAdsBaseObject method verifyImgAdLoadedInSlot.

public void verifyImgAdLoadedInSlot(String slotName, String expectedImg) {
    scrollToSlotOnMobile(slotName);
    WebElement slot = driver.findElement(By.id(slotName));
    if (checkIfSlotExpanded(slot)) {
        String foundImg = getSlotImageAd(slot);
        Assertion.assertStringContains(foundImg, expectedImg);
    } else {
        throw new NoSuchElementException("Slot is collapsed - should be expanded");
    }
    PageObjectLogging.log("AdInSlot", "Ad found in slot", true, driver);
}
Also used : WebElement(org.openqa.selenium.WebElement) NoSuchElementException(org.openqa.selenium.NoSuchElementException)

Example 17 with NoSuchElementException

use of org.openqa.selenium.NoSuchElementException in project selenium-tests by Wikia.

the class MobileAdsBaseObject method verifySlotExpanded.

public void verifySlotExpanded(String slotName) {
    scrollToSlotOnMobile(slotName);
    WebElement slot = driver.findElement(By.id(slotName));
    if (checkIfSlotExpanded(slot)) {
        PageObjectLogging.log("AdInSlot", "Slot expanded as expecting", true);
    } else {
        throw new NoSuchElementException("Slot is collapsed - should be expanded");
    }
}
Also used : WebElement(org.openqa.selenium.WebElement) NoSuchElementException(org.openqa.selenium.NoSuchElementException)

Example 18 with NoSuchElementException

use of org.openqa.selenium.NoSuchElementException in project selenium-tests by Wikia.

the class ChatPage method isMessageOnChat.

public boolean isMessageOnChat(String message) {
    try {
        WebElement userPostedMessage = userPostedMessage(message);
        wait.forElementVisible(userPostedMessage);
        return true;
    } catch (TimeoutException | NoSuchElementException ex) {
        PageObjectLogging.log("Message on chat not displayed", ex, true);
        return false;
    }
}
Also used : WebElement(org.openqa.selenium.WebElement) NoSuchElementException(org.openqa.selenium.NoSuchElementException) TimeoutException(org.openqa.selenium.TimeoutException)

Example 19 with NoSuchElementException

use of org.openqa.selenium.NoSuchElementException in project oxAuth by GluuFederation.

the class DisplaysLogoInLoginPage method displaysLogoInLoginPage.

@Parameters({ "redirectUris", "redirectUri", "sectorIdentifierUri" })
@Test
public void displaysLogoInLoginPage(final String redirectUris, final String redirectUri, final String sectorIdentifierUri) throws Exception {
    showTitle("OC5:FeatureTest-Displays Logo in Login Page");
    List<ResponseType> responseTypes = Arrays.asList(ResponseType.CODE);
    String logoUri = "http://www.gluu.org/wp-content/themes/gluursn/images/logo.png";
    // 1. Register client
    RegisterRequest registerRequest = new RegisterRequest(ApplicationType.WEB, "oxAuth test app", StringUtils.spaceSeparatedToList(redirectUris));
    registerRequest.setResponseTypes(responseTypes);
    registerRequest.setLogoUri(logoUri);
    registerRequest.setSectorIdentifierUri(sectorIdentifierUri);
    RegisterClient registerClient = new RegisterClient(registrationEndpoint);
    registerClient.setRequest(registerRequest);
    RegisterResponse registerResponse = registerClient.exec();
    showClient(registerClient);
    assertEquals(registerResponse.getStatus(), 200, "Unexpected response code: " + registerResponse.getEntity());
    assertNotNull(registerResponse.getClientId());
    assertNotNull(registerResponse.getClientSecret());
    assertNotNull(registerResponse.getRegistrationAccessToken());
    assertNotNull(registerResponse.getClientIdIssuedAt());
    assertNotNull(registerResponse.getClientSecretExpiresAt());
    String clientId = registerResponse.getClientId();
    // 2. Request authorization and receive the authorization code.
    List<String> scopes = Arrays.asList("openid", "profile", "address", "email");
    String state = UUID.randomUUID().toString();
    AuthorizationRequest authorizationRequest = new AuthorizationRequest(responseTypes, clientId, scopes, redirectUri, null);
    authorizationRequest.setState(state);
    String authorizationRequestUrl = getAuthorizationEndpoint() + "?" + authorizationRequest.getQueryString();
    AuthorizeClient authorizeClient = new AuthorizeClient(getAuthorizationEndpoint());
    authorizeClient.setRequest(authorizationRequest);
    try {
        startSelenium();
        driver.navigate().to(authorizationRequestUrl);
        WebElement logo = driver.findElement(By.xpath("//img[@src='" + logoUri + "']"));
        assertNotNull(logo);
    } catch (NoSuchElementException ex) {
        fail("Logo not found");
    } finally {
        stopSelenium();
    }
}
Also used : WebElement(org.openqa.selenium.WebElement) NoSuchElementException(org.openqa.selenium.NoSuchElementException) ResponseType(org.xdi.oxauth.model.common.ResponseType) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test) BaseTest(org.xdi.oxauth.BaseTest)

Example 20 with NoSuchElementException

use of org.openqa.selenium.NoSuchElementException in project oxAuth by GluuFederation.

the class DisplaysPolicyUriInLoginPage method displaysPolicyUrlInLoginPage.

@Parameters({ "redirectUris", "redirectUri", "sectorIdentifierUri" })
@Test
public void displaysPolicyUrlInLoginPage(final String redirectUris, final String redirectUri, final String sectorIdentifierUri) throws Exception {
    showTitle("OC5:FeatureTest-Displays Policy in Login Page");
    List<ResponseType> responseTypes = Arrays.asList(ResponseType.CODE);
    String policyUri = "http://www.gluu.org/policy";
    // 1. Register client
    RegisterRequest registerRequest = new RegisterRequest(ApplicationType.WEB, "oxAuth test app", StringUtils.spaceSeparatedToList(redirectUris));
    registerRequest.setResponseTypes(responseTypes);
    registerRequest.setPolicyUri(policyUri);
    registerRequest.setSectorIdentifierUri(sectorIdentifierUri);
    RegisterClient registerClient = new RegisterClient(registrationEndpoint);
    registerClient.setRequest(registerRequest);
    RegisterResponse registerResponse = registerClient.exec();
    showClient(registerClient);
    assertEquals(registerResponse.getStatus(), 200, "Unexpected response code: " + registerResponse.getEntity());
    assertNotNull(registerResponse.getClientId());
    assertNotNull(registerResponse.getClientSecret());
    assertNotNull(registerResponse.getRegistrationAccessToken());
    assertNotNull(registerResponse.getClientIdIssuedAt());
    assertNotNull(registerResponse.getClientSecretExpiresAt());
    String clientId = registerResponse.getClientId();
    // 2. Request authorization and receive the authorization code.
    List<String> scopes = Arrays.asList("openid", "profile", "address", "email");
    String state = UUID.randomUUID().toString();
    AuthorizationRequest authorizationRequest = new AuthorizationRequest(responseTypes, clientId, scopes, redirectUri, null);
    authorizationRequest.setState(state);
    String authorizationRequestUrl = getAuthorizationEndpoint() + "?" + authorizationRequest.getQueryString();
    AuthorizeClient authorizeClient = new AuthorizeClient(getAuthorizationEndpoint());
    authorizeClient.setRequest(authorizationRequest);
    try {
        startSelenium();
        driver.navigate().to(authorizationRequestUrl);
        WebElement policy = driver.findElement(By.xpath("//a[@href='" + policyUri + "']"));
        assertNotNull(policy);
    } catch (NoSuchElementException ex) {
        fail("Policy not found");
    } finally {
        stopSelenium();
    }
}
Also used : WebElement(org.openqa.selenium.WebElement) NoSuchElementException(org.openqa.selenium.NoSuchElementException) ResponseType(org.xdi.oxauth.model.common.ResponseType) Parameters(org.testng.annotations.Parameters) Test(org.testng.annotations.Test) BaseTest(org.xdi.oxauth.BaseTest)

Aggregations

NoSuchElementException (org.openqa.selenium.NoSuchElementException)32 WebElement (org.openqa.selenium.WebElement)18 AndroidElement (io.appium.java_client.android.AndroidElement)5 Select (org.openqa.selenium.support.ui.Select)5 ElementMenuOptions (com.owncloud.android.test.ui.models.ElementMenuOptions)4 WaitAMomentPopUp (com.owncloud.android.test.ui.models.WaitAMomentPopUp)3 Test (org.junit.Test)3 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)3 PublicAtsApi (com.axway.ats.common.PublicAtsApi)2 SeleniumOperationException (com.axway.ats.uiengine.exceptions.SeleniumOperationException)2 RealHtmlElementState (com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState)2 FailingTestCategory (com.owncloud.android.test.ui.groups.FailingTestCategory)2 InProgressCategory (com.owncloud.android.test.ui.groups.InProgressCategory)2 NoIgnoreTestCategory (com.owncloud.android.test.ui.groups.NoIgnoreTestCategory)2 SmokeTestCategory (com.owncloud.android.test.ui.groups.SmokeTestCategory)2 UnfinishedTestCategory (com.owncloud.android.test.ui.groups.UnfinishedTestCategory)2 FileListView (com.owncloud.android.test.ui.models.FileListView)2 ShareView (com.owncloud.android.test.ui.models.ShareView)2 VisualEditorPageObject (com.wikia.webdriver.pageobjectsfactory.pageobject.visualeditor.VisualEditorPageObject)2 Category (org.junit.experimental.categories.Category)2