@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);
  }
  public PortableInfoboxObject isMainImageVisible() {
    wait.forElementVisible(mainImage);
    Assertion.assertEquals(isElementOnPage(mainImage), true);
    PageObjectLogging.log("Main image", MercuryMessages.VISIBLE_MSG, true);

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

    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 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 void verifyAssociatedArticlePlaceholder() {
   waitForElementByElement(associatedArticleField);
   Assertion.assertEquals(
       InteractiveMapsContent.ASSOCIATED_ARTICLE_PLACEHOLDER,
       associatedArticleField.getAttribute("placeholder"),
       "Associated article place holder is not correct");
 }
  @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_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_defaultResultsNumberOnSearchResultsPage")
  public void mercury_search_defaultResultsNumberOnSearchResultsPage() {
    SearchResultsPage resultsPage =
        new SearchResultsPage().openForQuery(MULTIPLE_RESULTS_SEARCH_PHRASE);

    Assertion.assertEquals(resultsPage.getResultCardsNumber(), SEARCH_RESULTS_DEFAULT_NUMBER);
  }
  @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);
  }
  @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 = "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);
  }
  @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_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);
  }
  @Test(groups = {"MercuryLoginTest_007"})
  @Execute(onWikia = "mercuryautomationtesting")
  public void MercuryLoginTest_007_registerNowLinkWorks() {
    SignupPageObject registrationPage = new SignupPageObject(driver);
    registrationPage.openRegisterPage();
    String expectedHeader = registrationPage.getRegisterHeaderText();

    LoginPageObject loginPageObject = new LoginPageObject(driver).get();
    loginPageObject.clickOnRegisterLink();
    String currentHeader = registrationPage.getRegisterHeaderText();
    Assertion.assertEquals(expectedHeader, currentHeader);
  }
  @Test(groups = {"MercuryLoginTest_009"})
  @Execute(onWikia = "mercuryautomationtesting")
  public void MercuryLoginTest_009_registerButtonWorksOnJoinPage() {
    SignupPageObject registrationPage = new SignupPageObject(driver);
    registrationPage.openRegisterPage();
    String expectedHeader = registrationPage.getRegisterHeaderText();

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

    Assertion.assertEquals(registrationPage.getRegisterHeaderText(), expectedHeader);
  }
  @Test(groups = {"MercuryLoginTest_006"})
  @Execute(onWikia = "mercuryautomationtesting")
  public void MercuryLoginTest_006_closeButtonWorksAndRedirectsProperly() {
    ArticlePageObject homePage = new ArticlePageObject(driver);
    homePage.openMainPage(wikiURL);
    String expectedHomePageTitle = homePage.getArticleTitle();

    LoginPageObject loginPageObject = new LoginPageObject(driver).get();
    loginPageObject.clickOnCloseButton();

    homePage.isFooterLogoVisible();
    Assertion.assertEquals(expectedHomePageTitle, homePage.getArticleTitle());
  }
  @Test(groups = {"MercuryLoginTest_008"})
  @Execute(onWikia = "mercuryautomationtesting")
  public void MercuryLoginTest_008_userIsTakenToJoinPage() {
    JoinPageObject joinPageObject = new JoinPageObject(driver).get();
    String expectedMessage = joinPageObject.getJoinTodayText();

    ArticlePageObject homePage = new ArticlePageObject(driver);
    homePage.openMainPage(wikiURL);
    TopBarComponentObject loginIcon = new TopBarComponentObject(driver);
    loginIcon.clickLogInIcon();

    Assertion.assertEquals(joinPageObject.getJoinTodayText(), expectedMessage);
  }
  @Test(groups = "TestUrlBuilder")
  public void urlBuilder() {
    Configuration.setTestValue("qs", "");

    for (Object[] data : TEST_DATA) {
      Assertion.assertEquals(
          new UrlBuilder("prod").getUrlForPath((String) data[0], (String) data[1]),
          (String) data[2]);
      Assertion.assertEquals(
          new UrlBuilder("preview").getUrlForPath((String) data[0], (String) data[1]),
          (String) data[3]);
      Assertion.assertEquals(
          new UrlBuilder("sandbox").getUrlForPath((String) data[0], (String) data[1]),
          (String) data[4]);
      Assertion.assertEquals(
          new UrlBuilder("sandbox-mercurydev").getUrlForPath((String) data[0], (String) data[1]),
          (String) data[5]);
      Assertion.assertEquals(
          new UrlBuilder("dev-dmytror").getUrlForPath((String) data[0], (String) data[1]),
          (String) data[6]);
    }
  }
  @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());
  }
 public void verifyToolInMoreTool(String toolName) {
   for (WebElement elem : myToolsList) {
     Assertion.assertEquals(elem.getAttribute("data-name").toLowerCase(), toolName.toLowerCase());
   }
   PageObjectLogging.log("verifyToolInMoreTool", toolName + " appears in ToolbarMoreTool.", true);
 }
  public PortableInfoboxObject isImageCaptionInTabberVisible() {
    Assertion.assertEquals(isElementVisible(captionInTabber), true);
    PageObjectLogging.log("Image caption in tabber", MercuryMessages.VISIBLE_MSG, true);

    return this;
  }
  public PortableInfoboxObject isVideoCaptionVisible() {
    Assertion.assertEquals(isElementVisible(videoCaption), true);
    PageObjectLogging.log("Video caption", MercuryMessages.VISIBLE_MSG, true);

    return this;
  }
  public PortableInfoboxObject isHeroImageCentered() {
    Assertion.assertEquals(images.get(0).getCssValue("text-align"), "center");
    PageObjectLogging.log("Hero image", "is centered", true);

    return this;
  }
 public void verifyBirthdateError() {
   waitForElementByElement(genericError);
   Assertion.assertEquals(
       genericError.getText(), "We can not complete your registration at this time.");
 }
 public void verifyPasswordError() {
   waitForElementByElement(passwordError);
   Assertion.assertEquals(
       passwordError.getText(), "Your password must be different from your username.");
 }
 public void verifyUsernameTakenError() {
   waitForElementByElement(usernameError);
   Assertion.assertEquals(
       usernameError.getText(), "Someone already has this username. Try a different one!");
 }
  public PortableInfoboxObject isInfoboxExpanded() {
    Assertion.assertEquals(infoboxWrapper.getAttribute("style"), "height: auto;");
    PageObjectLogging.log("Infobox", MercuryMessages.EXPANDED_MSG, true);

    return this;
  }
 public void verifyEmailInUseError() {
   waitForElementByElement(emailError);
   Assertion.assertEquals(emailError.getText(), "Email is already registered on Wikia");
 }
  public PortableInfoboxObject isInfoboxCollapsed() {
    Assertion.assertEquals(isElementOnPage(infoboxIsCollapsed), true);
    PageObjectLogging.log("Infobox", MercuryMessages.COLLAPSED_MSG, true);

    return this;
  }