public SpecialUserLoginPageObject clickLoginOnSpecialPage() {
    waitForElementByElement(specialUserLoginLink);
    PageObjectLogging.log("LoginLinkPresent", "Link to login special page present", true, driver);
    scrollAndClick(specialUserLoginLink);
    PageObjectLogging.log("LoginLinkClicked", "Link to login special page clicked", true, driver);

    return new SpecialUserLoginPageObject(driver);
  }
 public void logOut(String wikiURL, String articleName) {
   try {
     getUrl(wikiURL + URLsContent.LOGOUT_RETURNTO + articleName);
   } catch (TimeoutException e) {
     PageObjectLogging.log("logOut", "page loads for more than 30 seconds", true);
   }
   waitForElementPresenceByBy(LOGIN_BUTTON_CSS);
   PageObjectLogging.log("logOut", "user is logged out and returned to article", true, driver);
 }
 public void logOut(WebDriver driver) {
   try {
     driver.manage().deleteAllCookies();
     driver.get(urlBuilder.getUrlForWiki(Configuration.getWikiName()) + URLsContent.LOGOUT);
   } catch (TimeoutException e) {
     PageObjectLogging.log("logOut", "page loads for more than 30 seconds", true);
   }
   waitForElementPresenceByBy(LOGIN_BUTTON_CSS);
   PageObjectLogging.log("logOut", "user is logged out", true, driver);
 }
 public void resizeWindow(int width, int height) {
   try {
     driver.manage().window().setSize(new Dimension(width, height));
     PageObjectLogging.log(
         "ResizeWindow", "Resize window (width=" + width + ", height=" + height + ")", true);
   } catch (WebDriverException ex) {
     PageObjectLogging.log(
         "ResizeWindow",
         "Cannot resize window (width=" + width + ", height=" + height + ")",
         true);
   }
 }
  public void logInViaModal(String userName, String password) {
    waitForElementByElement(modalUserNameInput);
    modalUserNameInput.sendKeys(userName);
    waitForElementByElement(modalPasswordInput);
    modalPasswordInput.sendKeys(password);
    PageObjectLogging.log("FillLoginForm", "Login form in modal is filled", true, driver);

    scrollAndClick(modalLoginSubmit);
    PageObjectLogging.log("LoginFormSubmitted", "Login form is submitted", true);

    waitForElementNotVisibleByElement(logInModal);
    PageObjectLogging.log("LoginModalDissapears", "Login modal is no longer visible", true);
  }
 /**
  * Verify that wanted Tool appears in Toolbar. The method finds all of Tools appearing in Toolbar
  * (by their name), and checks if there is at least one name which fits the given param (ToolName)
  *
  * @param ToolName Tool to be verified (name that should appear on toolbar)
  */
 public void unfollowIfFollowed() {
   List<WebElement> list = driver.findElements(toolsList);
   for (int i = 0; i < list.size(); i++) {
     if ("Following".equals(list.get(i).getText())) {
       clickOnTool(PageContent.FOLLOW);
       verifyFollowMessage();
       wait.forTextInElement(toolsList, "Follow");
       PageObjectLogging.log(
           "unfollowIfFollowed", "page was followed, unfollow button clicked", true);
       break;
     }
   }
   PageObjectLogging.log("unfollowIfFollowed", "page was unfollowed", true);
 }
  public void verifyThereIsNoWikiaBar(String browser) {
    if ("CHROMEMOBILEMERCURY".equalsIgnoreCase(browser)) {
      // Mercury does not have WikiaBar
      // There should be better way to verify skin - remove it after QAART-608 is done
      PageObjectLogging.log(
          "Check visibility of Wikia Bar", "It is Mercury skin with no Wikia Bar", true);
      return;
    }

    waitForElementNotVisibleByElement(driver.findElement(By.cssSelector(WIKIA_BAR_CSS)));
    PageObjectLogging.log(
        "Check visibility of Wikia Bar",
        "There should be no Wikia Bar when Floor Adhesion is visible",
        true);
  }
  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 verifyPhotosVisible(int photos) {
   for (int i = 0; i < photos; i++) {
     waitForElementByElement(galleryPreviewPhotos.get(i));
     PageObjectLogging.log(
         "verifyPhotosVisible", "photo no. " + i + 1 + "/photos is visible", true);
   }
 }
  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;
  }
 public void verifyCallToAmazonIssued() {
   if (networkTrafficInterceptor.searchRequestUrlInHar(AMAZON_SCRIPT_URL)) {
     PageObjectLogging.log("RequestToAmazonIssued", "Request to Amazon issued", true);
   } else {
     throw new NoSuchElementException("Request to Amazon not issued");
   }
 }
 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;
 }
 public void clickOnMoreButton() {
   jsActions.execute("document.getElementsByClassName(\"buttons\")[1].style.display = \"block\"");
   wait.forElementVisible(moreButton);
   wait.forElementClickable(moreButton);
   scrollAndClick(moreButton);
   PageObjectLogging.log("clickOnMoreButton", "click on 'more' button on a message", true);
 }
 public String getWikiaCssContent() {
   waitForElementByElement(cssSource);
   String source = cssSource.getText();
   PageObjectLogging.log(
       "cssSource", "the following text was get from Wikia.css: " + source, true);
   return source;
 }
 public VisualEditorPageObject openVEModeWithMainEditButton() {
   waitForElementByElement(veEditButton);
   veEditButton.click();
   PageObjectLogging.log(
       "openVEModeWithMainEditButton", "VE main edit button clicked", true, driver);
   return new VisualEditorPageObject(driver);
 }
 public void verifyLightboxVideo(Color lightboxVideoColor, int videoDurationSec) {
   verifyColorAd(lightbox, lightboxVideoColor, videoDurationSec);
   PageObjectLogging.log(
       "LightboxVideo",
       "Lightbox had " + lightboxVideoColor + " during " + videoDurationSec + " seconds",
       true);
 }
 public void verifyUserLoggedIn(final String userName) {
   changeImplicitWait(250, TimeUnit.MILLISECONDS);
   try {
     wait.until(
         new ExpectedCondition<Boolean>() {
           @Override
           public Boolean apply(WebDriver driver) {
             if (driver
                 .findElement(By.tagName("body"))
                 .getAttribute("class")
                 .contains("skin-monobook")) {
               return driver
                       .findElements(
                           By.cssSelector(
                               loggedInUserSelectorMonobook.replace(
                                   "%userName%", userName.replace(" ", "_"))))
                       .size()
                   > 0; // only for verification
             } else {
               // Venus
               return driver
                       .findElements(
                           By.cssSelector(
                               LOGGED_IN_USER_SELECTOR_VENUS.replace("%userName%", userName)))
                       .size()
                   > 0; // only for verification
             }
           }
         });
   } finally {
     restoreDeaultImplicitWait();
   }
   PageObjectLogging.log("verifyUserLoggedIn", "user " + userName + " logged in", true);
 }
 public void verifyRevisionMarkedAsMinor() {
   if (checkIfElementOnPage(cssMinorEdit)) {
     PageObjectLogging.log("cssEditSummary", "minor edit is marked in first revision", true);
   } else {
     throw new NoSuchElementException("Minor Edit is not present on the page");
   }
 }
 public String getFirstCssRevision() {
   waitForElementByElement(cssEditSummary);
   String summary = cssEditSummary.getText();
   PageObjectLogging.log(
       "cssEditSummary", "the following edit summaty was get from Wikia.css: " + summary, true);
   return summary;
 }
 public void verifyFloorAdhesionPresent(
     String expectedSlotName, String expectedLineItemId, String expectedCreativeId) {
   verifyGptAdInSlot(expectedSlotName, expectedLineItemId, expectedCreativeId);
   waitForElementByCss(FLOOR_ADHESION_CSS);
   PageObjectLogging.log(
       "Check visibility of Floor Adhesion", "Floor Adhesion should be displayed", true);
 }
 public SourceEditModePageObject openSrcModeWithMainEditButton() {
   waitForElementByElement(editButton);
   editButton.click();
   PageObjectLogging.log(
       "openSrcModeWithMainEditButton", "Src main edit button clicked", true, driver);
   return new SourceEditModePageObject(driver);
 }
 public InteractiveMapPageObject clickSaveButton() {
   waitForElementByElement(saveButton);
   saveButton.click();
   PageObjectLogging.log("clickSaveButton", "Save button clicked", true, driver);
   driver.switchTo().defaultContent();
   return new InteractiveMapPageObject(driver);
 }
 public DeletePageObject deletePage() {
   String url =
       urlBuilder.appendQueryStringToURL(driver.getCurrentUrl(), URLsContent.ACTION_DELETE);
   getUrl(url);
   PageObjectLogging.log("deletePage", "delete page opened", true);
   return new DeletePageObject(driver);
 }
 public void verifyLightboxAd(Color lightboxAdColor, int adDurationSec) {
   verifyColorAd(lightbox, lightboxAdColor, adDurationSec);
   PageObjectLogging.log(
       "LightboxAd",
       "Lightbox had " + lightboxAdColor + " during " + adDurationSec + " seconds",
       true);
 }
 public void verifyGPTParams() {
   if (slotWithAmazon.getAttribute("data-gpt-slot-params").contains(AMAZON_GPT_PATTERN)) {
     PageObjectLogging.log("AmazonGptParams", "Slot with Amazon params found", true);
   } else {
     throw new NoSuchElementException("Amazon params not found on page");
   }
 }
 public void clickReplyButton() {
   wait.forElementVisible(replyButton);
   wait.forElementClickable(replyButton);
   scrollAndClick(replyButton);
   wait.forElementVisible(By.cssSelector(".speech-bubble-buttons"));
   PageObjectLogging.log("clickReplyButton", "reply button clicked", true, driver);
 }
 public void verifyAmazonScriptIncluded() {
   if (checkIfElementOnPage(AMAZON_SCRIPT)) {
     PageObjectLogging.log("AmazonScriptFound", "Script from Amazon found", true);
   } else {
     throw new NoSuchElementException("Amazon script not found on page");
   }
 }
 public void clickOnReopenThreadButton() {
   wait.forElementVisible(reopenThreadButton);
   wait.forElementClickable(reopenThreadButton);
   scrollAndClick(reopenThreadButton);
   PageObjectLogging.log(
       "clickOnReopenThreadButton", "click on 'reopen thread' button on a message", true);
 }
  public CuratedContentPageObject isCurrentNumberOfItemsExpected(int expectedNumber) {
    int currentNumber = getCuratedContentItemsNumber();
    String message = "Expected: " + expectedNumber + ", get: " + currentNumber;

    PageObjectLogging.log(Labels.NUMBER_OF_ITEMS.name, message, expectedNumber == currentNumber);
    return this;
  }