Ejemplo n.º 1
0
  // TOCT01
  @Test(groups = {"MercuryTOCTest_001", "MercuryTOCTests", "Mercury"})
  public void MercuryTOCTest_001_TOCPresence_ListRedirection() {
    TableOfContentPageObject toc = new TableOfContentPageObject(driver);
    toc.openMercuryArticleByName(wikiURL, MercurySubpages.TOC);

    Assertion.assertTrue(toc.isTOCDisplayed(), "TOC isn't displayed");

    PageObjectLogging.log("TOC", "is displayed", true);

    boolean result = toc.isTOCUnderArticleName();
    PageObjectLogging.log(
        "TOC position", "is under article name", "is not under article name", result);

    Assertion.assertFalse(toc.isTOCMenuVisible(), "TOC menu is expanded");

    PageObjectLogging.log("TOC menu", "is collapsed", true);

    toc.clickOnTOC();

    Assertion.assertTrue(toc.isTOCMenuVisible(), "TOC menu is collapsed");

    PageObjectLogging.log("TOC menu", "is expanded", true);

    toc.clickOnTOCListElement(1);

    result = toc.isUserMovedToRightSection(1);
    PageObjectLogging.log("TOC redirection", "works", "does not work", result);

    result = toc.isH2PaddingTopMoreThan(1, H2_PADDING_TOP);
    PageObjectLogging.log("Header padding", "is correct", "is wrong", result);
  }
Ejemplo n.º 2
0
  @Test(groups = "MercuryCuratedNavigationTest_001")
  public void MercuryCuratedNavigationTest_001_navigateThroughCategory() {
    init();

    navigate.toPage(MercurySubpages.CC_MAIN_PAGE);

    curatedContent.clickOnCuratedContentElementByIndex(1);
    loading.handleAsyncPageReload();

    curatedContent
        .isTitleVisible()
        .isLinkToMainPageVisible()
        .isSectionVisible()
        .isCuratedContentItemVisibleByIndex(1);

    String sectionTitle = curatedContent.getTitle();
    String expectedUrlPath = MercuryPaths.ROOT_PATH_CATEGORY + sectionTitle;
    UrlChecker.isPathContainedInCurrentUrl(driver, expectedUrlPath);

    String previousUrl = driver.getCurrentUrl();
    curatedContent.navigateToMainPage();
    String nextUrl = driver.getCurrentUrl();
    UrlChecker.isPathContainedInCurrentUrl(driver, MercuryPaths.ROOT_PATH);

    driver.navigate().back();
    Assertion.assertEquals(driver.getCurrentUrl(), previousUrl);

    driver.navigate().forward();
    Assertion.assertEquals(driver.getCurrentUrl(), nextUrl);
  }
Ejemplo n.º 3
0
  @InBrowser(emulator = Emulator.GOOGLE_NEXUS_5)
  @Test(groups = "mercury_search_loadMoreResultsOnSearchResultsPageNotVisible")
  public void mercury_search_emptySearchPhrase() {
    SearchResultsPage resultsPage = new SearchResultsPage().openForQuery(EMPTY_SEARCH_PHRASE);

    Assertion.assertEquals(resultsPage.getResultCardsNumber(), 0);
    Assertion.assertFalse(resultsPage.isLoadMoreButtonVisible());
  }
Ejemplo n.º 4
0
  @InBrowser(emulator = Emulator.GOOGLE_NEXUS_5)
  @Test(groups = "mercury_search_loadMoreResultsOnSearchResultsPageNotVisible")
  public void mercury_search_loadMoreResultsOnSearchResultsPageNotVisible() {
    SearchResultsPage resultsPage =
        new SearchResultsPage().openForQuery(SINGLE_RESULT_SEARCH_PHRASE);

    Assertion.assertTrue(resultsPage.getResultCardsNumber() < SEARCH_RESULTS_DEFAULT_NUMBER);
    Assertion.assertFalse(resultsPage.isLoadMoreButtonVisible());
  }
Ejemplo n.º 5
0
  @InBrowser(emulator = Emulator.GOOGLE_NEXUS_5)
  @Test(groups = "mercury_search_focusOnTryAnotherSearchWhenNoResults")
  public void mercury_search_focusOnTryAnotherSearchWhenNoResults() {
    SearchResultsPage searchResults =
        new SearchResultsPage().openForQuery(SEARCH_PHRASE_NO_RESULTS).clickTryAnotherSearch();

    Assertion.assertTrue(searchResults.getSearch().isInputFieldFocused());
    Assertion.assertTrue(searchResults.getSearch().getSearchPhrase().isEmpty());
  }
Ejemplo n.º 6
0
  @InBrowser(emulator = Emulator.GOOGLE_NEXUS_5)
  @Test(groups = "mercury_search_searchNoResultsPageDisplayed")
  public void mercury_search_searchNoResultsPageDisplayed() {
    SearchResultsPage searchResults =
        new SearchResultsPage().openForQuery(SEARCH_PHRASE_NO_RESULTS);

    Assertion.assertTrue(searchResults.isNoResultsPagePresent());
    Assertion.assertFalse(searchResults.isLoadMoreButtonVisible());
  }
Ejemplo n.º 7
0
  @InBrowser(emulator = Emulator.GOOGLE_NEXUS_5)
  @Test(groups = "mercury_search_verifySearchLayout")
  public void mercury_search_verifySearchLayout() {
    Search search = new ArticlePage().open(MercurySubpages.MAIN_PAGE).getTopBar().openSearch();

    Assertion.assertTrue(search.isSearchInputFieldVisible());
    Assertion.assertTrue(search.isClearSearchButtonVisible());
    Assertion.assertTrue(search.isInputFieldSearchIconVisible());
  }
Ejemplo n.º 8
0
  @InBrowser(emulator = Emulator.GOOGLE_NEXUS_5)
  @Test(groups = "mercury_search_navigateUsingSearchSuggestionsOnMobile")
  public void mercury_search_navigateUsingSearchSuggestionsOnMobile() {
    ArticlePage article = new ArticlePage().open(MercurySubpages.MAIN_PAGE);
    String clickedSuggestion =
        article.getTopBar().openSearch().typeInSearch(SEARCH_PHRASE).clickSearchSuggestion(0);

    Assertion.assertTrue(new SkinHelper(driver).isSkin(Skin.MERCURY));
    Assertion.assertEquals(
        clickedSuggestion.toLowerCase(), article.getHeader().getPageTitle().toLowerCase());
  }
Ejemplo n.º 9
0
  @Test(groups = {"MercuryLoginTest_012"})
  @Execute(onWikia = "mercuryautomationtesting")
  public void MercuryLoginTest_012_passwordTogglerWorks() {
    LoginPageObject loginPageObject = new LoginPageObject(driver).get();
    loginPageObject.typePassword(Configuration.getCredentials().password10);

    Assertion.assertTrue(
        loginPageObject.isPasswordTogglerDisabled(), "password should be disabled");

    loginPageObject.clickOnPasswordToggler();

    Assertion.assertTrue(loginPageObject.isPasswordTogglerEnabled(), "password should be enabled");
  }
Ejemplo n.º 10
0
  @InBrowser(emulator = Emulator.GOOGLE_NEXUS_5)
  @Test(groups = "mercury_search_redirectToNewResultsPageFromNoResults")
  public void mercury_search_redirectToNewResultsPageFromNoResults() {
    SearchResultsPage searchResults =
        new SearchResultsPage()
            .openForQuery(SEARCH_PHRASE_NO_RESULTS)
            .clickTryAnotherSearch()
            .getSearch()
            .typeInSearch(SEARCH_PHRASE)
            .clickEnterAndNavigateToSearchResults();

    Assertion.assertTrue(searchResults.isSearchResultsPageOpen());
    Assertion.assertFalse(searchResults.isNoResultsPagePresent());
    Assertion.assertTrue(searchResults.areResultsPresent());
  }
Ejemplo n.º 11
0
  @Execute(onWikia = MercuryWikis.MEDIAWIKI_119)
  @Test(groups = "mercury_search_navigateUsingSearchSuggestionsOnDesktop")
  @InBrowser(browser = Browser.FIREFOX, browserSize = "1920x1080")
  public void mercury_search_navigateUsingSearchSuggestionsOnDesktop() {
    String clickedSuggestion =
        new DiscussionsPage()
            .getTopBar()
            .openSearch()
            .typeInSearch(SEARCH_PHRASE)
            .clickSearchSuggestion(0);

    Assertion.assertTrue(new SkinHelper(driver).isSkin(Skin.OASIS));
    Assertion.assertEquals(
        clickedSuggestion.toLowerCase(), new ArticlePageObject().getArticleName().toLowerCase());
  }
Ejemplo n.º 12
0
  @InBrowser(emulator = Emulator.GOOGLE_NEXUS_5)
  @Test(groups = "mercury_search_searchResultsPageHasNoSearchIconInTopBar")
  public void mercury_search_searchResultsPageHasNoSearchIconInTopBar() {
    SearchResultsPage resultsPage = new SearchResultsPage().openForQuery(SEARCH_PHRASE);

    Assertion.assertFalse(resultsPage.getTopBar().isSearchIconClickable());
  }
  public PortableInfoboxObject areOrderedListAndDataValuesMarginEqual() {
    Assertion.assertEquals(
        orderedLists.get(0).getCssValue("margin"), dataValues.get(0).getCssValue("margin"));
    PageObjectLogging.log("Ordered list labes and value", "have the same margin", true);

    return this;
  }
  public PortableInfoboxObject isMainImageVisible() {
    wait.forElementVisible(mainImage);
    Assertion.assertEquals(isElementOnPage(mainImage), true);
    PageObjectLogging.log("Main image", MercuryMessages.VISIBLE_MSG, true);

    return this;
  }
Ejemplo n.º 15
0
 public AdsAmazonObject verifyAdsFromAmazonPresent() {
   driver.switchTo().frame(getAmazonIframe(slotWithAmazon));
   Assertion.assertTrue(checkIfElementOnPage(AMAZON_IFRAME));
   PageObjectLogging.log("AmazonAd", "Script returned by Amazon present", true);
   driver.switchTo().defaultContent();
   return this;
 }
Ejemplo n.º 16
0
  @InBrowser(emulator = Emulator.GOOGLE_NEXUS_5)
  @Test(groups = "mercury_search_navigateToPageUsingSearchResults")
  public void mercury_search_navigateToPageUsingSearchResults() {
    String resultLink = new SearchResultsPage().openForQuery(SEARCH_PHRASE).clickSearchResult(0);

    Assertion.assertEquals(driver.getCurrentUrl(), resultLink);
  }
  public PortableInfoboxObject isTitleAboveImageVisible() {
    wait.forElementVisible(titleSmallImage);
    Assertion.assertEquals(isElementOnPage(titleSmallImage), true);
    PageObjectLogging.log("Title above image", MercuryMessages.VISIBLE_MSG, true);

    return this;
  }
  public PortableInfoboxObject clickExternalLink(int index) {
    Assertion.assertFalse(externalLinks.isEmpty());
    wait.forElementVisible(externalLinks.get(index));

    externalLinks.get(index).click();
    return this;
  }
 public void verifyAssociatedArticlePlaceholder() {
   waitForElementByElement(associatedArticleField);
   Assertion.assertEquals(
       InteractiveMapsContent.ASSOCIATED_ARTICLE_PLACEHOLDER,
       associatedArticleField.getAttribute("placeholder"),
       "Associated article place holder is not correct");
 }
Ejemplo n.º 20
0
  // MT03
  @Test(groups = {"MercuryLightboxTest_003", "MercuryLightboxTests", "Mercury"})
  public void MercuryLightboxTest_003_ZoomByGesture_ZoomByDoubleTap() {
    LightboxComponentObject lightbox = new LightboxComponentObject(driver);
    lightbox.openMercuryArticleByName(wikiURL, MercurySubpages.GALLERY);
    PerformTouchAction touchAction = new PerformTouchAction(driver);

    lightbox.clickGalleryImage(0);

    Assertion.assertTrue(lightbox.isCurrentImageVisible(), "Image is not visible");

    PageObjectLogging.log("Current image", "is visible", true);

    File beforeZooming = new Shooter().capturePage(driver);
    touchAction.zoomInOutPointXY(50, 50, 50, 100, PerformTouchAction.ZOOM_WAY_IN, 3000);
    File afterZooming = new Shooter().capturePage(driver);

    boolean result = !new ImageComparison().areFilesTheSame(beforeZooming, afterZooming, ACCURACY);
    PageObjectLogging.log("Zooming in by gesture", "works", "does not work", result);

    touchAction.zoomInOutPointXY(50, 50, 50, 140, PerformTouchAction.ZOOM_WAY_OUT, 3000);
    afterZooming = new Shooter().capturePage(driver);

    result = new ImageComparison().areFilesTheSame(beforeZooming, afterZooming, ACCURACY);
    PageObjectLogging.log("Zooming out by gesture", "works", "does not work", result);

    lightbox.clickCloseButton();
    lightbox.clickGalleryImage(0);

    Assertion.assertTrue(lightbox.isCurrentImageVisible(), "Image is not visible");

    PageObjectLogging.log("Current image", "is visible", true);

    beforeZooming = new Shooter().capturePage(driver);
    touchAction.tapOnPointXY(50, 50, 140, 0);
    touchAction.tapOnPointXY(50, 50, 140, 3000);
    afterZooming = new Shooter().capturePage(driver);

    result = !new ImageComparison().areFilesTheSame(beforeZooming, afterZooming, ACCURACY);
    PageObjectLogging.log("Zooming in by double tap", "works", "does not work", result);

    touchAction.tapOnPointXY(50, 50, 140, 0);
    touchAction.tapOnPointXY(50, 50, 140, 3000);
    afterZooming = new Shooter().capturePage(driver);

    result = new ImageComparison().areFilesTheSame(beforeZooming, afterZooming, ACCURACY);
    PageObjectLogging.log("Zooming out by double tap", "works", "does not work", result);
  }
Ejemplo n.º 21
0
  @Test(groups = {"MercuryLoginTest_005"})
  @Execute(onWikia = "mercuryautomationtesting")
  public void MercuryLoginTest_005_notPossibleToLogInWhenPasswordFieldBlank() {
    LoginPageObject loginPageObject = new LoginPageObject(driver).get();
    loginPageObject.logUserIn(Configuration.getCredentials().userName10, "");

    Assertion.assertTrue(loginPageObject.isSubmitButtonDisabled(2));
  }
Ejemplo n.º 22
0
  @Test(groups = {"MercuryLoginTest_003"})
  @Execute(onWikia = "mercuryautomationtesting")
  public void MercuryLoginTest_003_invalidUserCanNotLogIn() {
    LoginPageObject loginPageObject = new LoginPageObject(driver).get();
    loginPageObject.logUserIn("notExistingUserName", Configuration.getCredentials().password10);

    Assertion.assertEquals(loginPageObject.getErrorMessage(), ERROR_MESSAGE);
  }
Ejemplo n.º 23
0
  @Test(groups = {"MercuryLoginTest_002"})
  @Execute(onWikia = "mercuryautomationtesting")
  public void MercuryLoginTest_002_userCanNotLogInWithWrongPassword() {
    LoginPageObject loginPageObject = new LoginPageObject(driver).get();
    loginPageObject.logUserIn(Configuration.getCredentials().userName10, "thisIsWrongPassword");

    Assertion.assertEquals(loginPageObject.getErrorMessage(), ERROR_MESSAGE);
  }
Ejemplo n.º 24
0
  @InBrowser(emulator = Emulator.GOOGLE_NEXUS_5)
  @Test(groups = "mercury_search_noSuggestionsOnSearchResultsPage")
  public void mercury_search_noSuggestionsOnSearchResultsPage() {
    SearchResultsPage searchResults =
        new SearchResultsPage().openForQuery(SEARCH_PHRASE_NO_RESULTS);

    Assertion.assertFalse(searchResults.getSearch().areSearchSuggestionsDisplayed());
  }
Ejemplo n.º 25
0
  @InBrowser(emulator = Emulator.GOOGLE_NEXUS_5)
  @Test(groups = "mercury_search_defaultResultsNumberOnSearchResultsPage")
  public void mercury_search_defaultResultsNumberOnSearchResultsPage() {
    SearchResultsPage resultsPage =
        new SearchResultsPage().openForQuery(MULTIPLE_RESULTS_SEARCH_PHRASE);

    Assertion.assertEquals(resultsPage.getResultCardsNumber(), SEARCH_RESULTS_DEFAULT_NUMBER);
  }
Ejemplo n.º 26
0
  @InBrowser(emulator = Emulator.GOOGLE_NEXUS_5)
  @Test(groups = "mercury_search_loadingMoreResultsOnSearchResultsPage")
  public void mercury_search_loadingMoreResultsOnSearchResultsPage() {
    SearchResultsPage resultsPage =
        new SearchResultsPage().openForQuery(MULTIPLE_RESULTS_SEARCH_PHRASE);

    int defaultCardNumber = resultsPage.getResultCardsNumber();

    Assertion.assertTrue(resultsPage.isLoadMoreButtonVisible());
    Assertion.assertEquals(defaultCardNumber, SEARCH_RESULTS_DEFAULT_NUMBER);

    resultsPage.clickLoadMoreButton();
    int moreResultsLoaded = resultsPage.getResultCardsNumber() - defaultCardNumber;

    Assertion.assertEquals(moreResultsLoaded, SEARCH_RESULTS_DEFAULT_NUMBER);
    Assertion.assertTrue(resultsPage.isLoadMoreButtonVisible());
  }
Ejemplo n.º 27
0
  @InBrowser(emulator = Emulator.GOOGLE_NEXUS_5)
  @Test(groups = "mercury_search_searchInputDoesNotCoverNavigation")
  public void mercury_search_searchInputDoesNotCoverNavigation() {
    SearchResultsPage resultsPage = new SearchResultsPage().openForQuery(SEARCH_PHRASE);

    resultsPage.getTopBar().openNavigation();

    Assertion.assertFalse(resultsPage.getSearch().isSearchInputFieldEditable());
  }
  @Test(groups = "TestUrlBuilder")
  public void appendQueryString() {
    String cb = "cb=1111";
    Configuration.setTestValue("qs", cb);

    Assertion.assertEquals(
        new UrlBuilder("prod").getUrlForPath("wowwiki", "Portal:Main"),
        "http://wowwiki.wikia.com/Portal:Main?" + cb);
  }
  private void redirectFromFullSiteToOasis() {
    ArticleNavigationComponentObject navigation = new ArticleNavigationComponentObject(driver);
    SkinHelper helper = new SkinHelper(driver);

    new ArticlePageObject(driver).openWikiPage(url);
    new MercuryFooterComponentObject(driver).clickFullSiteLink();
    navigation.clickRandomArticle();

    Assertion.assertTrue(helper.isSkin(Skin.OASIS));
  }
Ejemplo n.º 30
0
  @Test(groups = {"MercuryLoginTest_010"})
  @Execute(onWikia = "mercuryautomationtesting")
  public void MercuryLoginTest_010_signInLinkWorksOnJoinPage() {
    LoginPageObject loginPageObject = new LoginPageObject(driver).get();
    String expectedHeader = loginPageObject.getLoginHeaderText();

    JoinPageObject joinPageObject = new JoinPageObject(driver).get();
    joinPageObject.clickSignInLink();

    Assertion.assertEquals(loginPageObject.getLoginHeaderText(), expectedHeader);
  }