// 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); }
@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); }
@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()); }
@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()); }
@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()); }
@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()); }
@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()); }
@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()); }
@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"); }
@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()); }
@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()); }
@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; }
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; }
@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"); }
// 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); }
@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)); }
@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); }
@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); }
@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()); }
@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); }
@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()); }
@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)); }
@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); }