Search in sources :

Example 1 with SkinHelper

use of com.wikia.webdriver.common.skin.SkinHelper in project selenium-tests by Wikia.

the class MainPageTests method MercuryCuratedMainPageTest_001_CheckElementsVisibilityElementsOrderAndRootPath.

@Test(groups = "MercuryCuratedMainPageTest_001")
@Execute(onWikia = MercuryWikis.MERCURY_CC)
@RelatedIssue(issueID = "XW-1739", comment = "if this tests fails just edit any article on mercurycc.wikia.com and wait 24h")
public void MercuryCuratedMainPageTest_001_CheckElementsVisibilityElementsOrderAndRootPath() {
    init();
    navigate.toPage(MercurySubpages.CC_MAIN_PAGE);
    Assertion.assertTrue(new SkinHelper(driver).isSkin(Skin.MOBILE_WIKI));
    new ArticlePageObject(driver).isFooterVisible();
    boolean result = driver.getCurrentUrl().contains(ROOT_PATH);
    PageObjectLogging.log("Current URL", "is set on " + ROOT_PATH, "is not set on " + ROOT_PATH, result);
    result = curatedMainPage.isMobileTopLeaderboardVisible();
    PageObjectLogging.log(PageElements.TOP_LEADERBOARD.name, MercuryMessages.VISIBLE_MSG, MercuryMessages.INVISIBLE_MSG, result);
    result = curatedMainPage.isArticleTitleVisible();
    PageObjectLogging.log(PageElements.ARTICLE_TITLE.name, MercuryMessages.VISIBLE_MSG, MercuryMessages.INVISIBLE_MSG, result);
    result = curatedMainPage.isWikiaStatsContainerVisible();
    PageObjectLogging.log(PageElements.WIKIA_STATS.name, MercuryMessages.VISIBLE_MSG, MercuryMessages.INVISIBLE_MSG, result);
    Assertion.assertTrue(curatedMainPage.isMainPagePadSlotInDOM());
    result = curatedMainPage.isFeaturedContentVisible();
    PageObjectLogging.log(PageElements.FEATURED_CONTENT.name, MercuryMessages.VISIBLE_MSG, MercuryMessages.INVISIBLE_MSG, result);
    result = curatedMainPage.isCuratedContentVisible();
    PageObjectLogging.log(PageElements.CURATED_CONTENT.name, MercuryMessages.VISIBLE_MSG, MercuryMessages.INVISIBLE_MSG, result);
    result = curatedMainPage.isMobileInContentVisible();
    PageObjectLogging.log(PageElements.IN_CONTENT.name, MercuryMessages.VISIBLE_MSG, MercuryMessages.INVISIBLE_MSG, result);
    result = curatedMainPage.isTrendingArticlesVisible();
    PageObjectLogging.log(PageElements.TRENDING_ARTICLES.name, MercuryMessages.VISIBLE_MSG, MercuryMessages.INVISIBLE_MSG, result);
    result = curatedMainPage.isMobilePrefooterVisible();
    PageObjectLogging.log(PageElements.PREFOOTER.name, MercuryMessages.VISIBLE_MSG, MercuryMessages.INVISIBLE_MSG, result);
    result = curatedMainPage.isTrendingVideosVisible();
    PageObjectLogging.log(PageElements.TRENDING_VIDEOS.name, MercuryMessages.VISIBLE_MSG, MercuryMessages.INVISIBLE_MSG, result);
    int lastPosition = 0;
    String lastElement = "top";
    for (PageElements element : PageElements.values()) {
        int newPosition = curatedMainPage.getElementOffsetTop(element.className);
        result = lastPosition <= newPosition;
        PageObjectLogging.log(element.name, "is after " + lastElement, "is not after " + lastElement, result);
        lastPosition = newPosition;
        lastElement = element.name;
    }
}
Also used : ArticlePageObject(com.wikia.webdriver.elements.mercury.old.ArticlePageObject) SkinHelper(com.wikia.webdriver.common.skin.SkinHelper) Execute(com.wikia.webdriver.common.core.annotations.Execute) Test(org.testng.annotations.Test) RelatedIssue(com.wikia.webdriver.common.core.annotations.RelatedIssue)

Example 2 with SkinHelper

use of com.wikia.webdriver.common.skin.SkinHelper in project selenium-tests by Wikia.

the class Search method clickSearchSuggestion.

public String clickSearchSuggestion(int index, Skin fromSkin) {
    String clickedSuggestion;
    PageObjectLogging.logInfo("Select search suggestion no.: " + index);
    WebElement searchResult = driver.findElements(By.cssSelector(searchSuggestionClass)).get(index);
    wait.forElementClickable(searchResult);
    clickedSuggestion = searchResult.getText();
    searchResult.click();
    // Mobile wiki opens the suggested page using AJAX, Mercury reloads the page and opens Mobile Wiki
    if (fromSkin == Skin.MOBILE_WIKI) {
        Loading loading = new Loading(driver);
        loading.handleAsyncPageReload();
    } else {
        Assertion.assertTrue(new SkinHelper(driver).isSkin(Skin.MOBILE_WIKI));
    }
    return clickedSuggestion;
}
Also used : SkinHelper(com.wikia.webdriver.common.skin.SkinHelper) WebElement(org.openqa.selenium.WebElement)

Example 3 with SkinHelper

use of com.wikia.webdriver.common.skin.SkinHelper in project selenium-tests by Wikia.

the class SearchMercuryTests method mercury_search_navigateUsingSearchSuggestionsOnMobile.

@Execute(onWikia = MercuryWikis.MERCURY_AUTOMATION_TESTING)
@InBrowser(emulator = Emulator.GOOGLE_NEXUS_5)
@Test(groups = { "mercury_search_navigateUsingSearchSuggestionsOnMobile", "Mercury_Search_001" })
public void mercury_search_navigateUsingSearchSuggestionsOnMobile() {
    String clickedSuggestion = new GuidelinesPage().open().getTopBar().openSearch().typeInSearch(SEARCH_PHRASE).clickSearchSuggestion(0, Skin.MERCURY);
    Assertion.assertTrue(new SkinHelper(driver).isSkin(Skin.MOBILE_WIKI));
    Assertion.assertEquals(clickedSuggestion.toLowerCase(), new ArticlePage().getHeader().getPageTitle().toLowerCase());
}
Also used : ArticlePage(com.wikia.webdriver.elements.mercury.pages.ArticlePage) SkinHelper(com.wikia.webdriver.common.skin.SkinHelper) GuidelinesPage(com.wikia.webdriver.elements.mercury.pages.discussions.GuidelinesPage) Execute(com.wikia.webdriver.common.core.annotations.Execute) Test(org.testng.annotations.Test) InBrowser(com.wikia.webdriver.common.core.annotations.InBrowser)

Example 4 with SkinHelper

use of com.wikia.webdriver.common.skin.SkinHelper in project selenium-tests by Wikia.

the class SearchMercuryTests method mercury_search_navigateUsingSearchSuggestionsOnDesktop.

@Execute(onWikia = "dauto")
@Test(groups = { "mercury_search_navigateUsingSearchSuggestionsOnDesktop", "Mercury_Search_001" })
@InBrowser(browser = Browser.FIREFOX, browserSize = "1920x1080")
public void mercury_search_navigateUsingSearchSuggestionsOnDesktop() {
    String clickedSuggestion = new GuidelinesPage().open().getTopBar().typeInDesktopSearchAndSelectSuggestion(SEARCH_PHRASE, 0);
    Assertion.assertTrue(new SkinHelper(driver).isSkin(Skin.OASIS));
    Assertion.assertEquals(clickedSuggestion.toLowerCase(), new ArticlePageObject().getArticleName().toLowerCase());
}
Also used : ArticlePageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.article.ArticlePageObject) SkinHelper(com.wikia.webdriver.common.skin.SkinHelper) GuidelinesPage(com.wikia.webdriver.elements.mercury.pages.discussions.GuidelinesPage) Execute(com.wikia.webdriver.common.core.annotations.Execute) Test(org.testng.annotations.Test) InBrowser(com.wikia.webdriver.common.core.annotations.InBrowser)

Example 5 with SkinHelper

use of com.wikia.webdriver.common.skin.SkinHelper in project selenium-tests by Wikia.

the class ArticlePage method open.

public ArticlePage open(String pageName) {
    getNavigate().toPage(pageName);
    new SkinHelper(driver).isSkin(Skin.MOBILE_WIKI);
    return this;
}
Also used : SkinHelper(com.wikia.webdriver.common.skin.SkinHelper)

Aggregations

SkinHelper (com.wikia.webdriver.common.skin.SkinHelper)10 Execute (com.wikia.webdriver.common.core.annotations.Execute)3 Test (org.testng.annotations.Test)3 InBrowser (com.wikia.webdriver.common.core.annotations.InBrowser)2 GuidelinesPage (com.wikia.webdriver.elements.mercury.pages.discussions.GuidelinesPage)2 WebElement (org.openqa.selenium.WebElement)2 RelatedIssue (com.wikia.webdriver.common.core.annotations.RelatedIssue)1 Loading (com.wikia.webdriver.elements.mercury.components.Loading)1 ArticlePageObject (com.wikia.webdriver.elements.mercury.old.ArticlePageObject)1 ArticlePage (com.wikia.webdriver.elements.mercury.pages.ArticlePage)1 ArticlePageObject (com.wikia.webdriver.pageobjectsfactory.pageobject.article.ArticlePageObject)1