Search in sources :

Example 1 with WikiBasePageObject

use of com.wikia.webdriver.pageobjectsfactory.pageobject.WikiBasePageObject in project selenium-tests by Wikia.

the class PageObjectLogging method afterNavigateTo.

@Override
public void afterNavigateTo(String url, WebDriver driver) {
    StringBuilder builder = new StringBuilder();
    if (!AlertHandler.isAlertPresent(driver)) {
        if (url.equals(driver.getCurrentUrl())) {
            builder.append("<tr class=\"success\"><td>Url after navigation</td><td>" + "<a href='" + driver.getCurrentUrl() + "'>" + driver.getCurrentUrl() + "</a></td><td> <br/> &nbsp;</td></tr>");
            CommonUtils.appendTextToFile(logPath, builder.toString());
        } else {
            if (driver.getCurrentUrl().contains("data:text/html,chromewebdata ")) {
                driver.get(url);
            }
            logWarning("Url after navigation", driver.getCurrentUrl());
        }
    } else {
        logWarning("Url after navigation", "Unable to check URL after navigation - alert present");
    }
    if (driver.getCurrentUrl().contains(Configuration.getWikiaDomain())) {
        // HACK FOR DISABLING NOTIFICATIONS
        try {
            new JavascriptActions(driver).execute("$(\".sprite.close-notification\")[0].click()");
        } catch (WebDriverException e) {
        }
        /**
       * We want to disable sales pitch dialog for new potential contributors to avoid hiding other
       * UI elements. see https://wikia-inc.atlassian.net/browse/CE-3768
       */
        if ("true".equals(Configuration.getDisableCommunityPageSalesPitchDialog())) {
            driver.manage().addCookie(new Cookie("cpBenefitsModalShown", "1", Configuration.getWikiaDomain(), null, null));
        }
        if (TestContext.isFirstLoad() && "true".equals(Configuration.getMockAds())) {
            driver.manage().addCookie(new Cookie("mock-ads", XMLReader.getValue("mock.ads_token"), String.format(".%s", Configuration.getEnvType().getWikiaDomain()), null, null));
        }
    }
    Method method = TestContext.getCurrentTestMethod();
    Class<?> declaringClass = method.getDeclaringClass();
    if (TestContext.isFirstLoad()) {
        User user = null;
        TestContext.setFirstLoad(false);
        if (declaringClass.isAnnotationPresent(Execute.class)) {
            user = declaringClass.getAnnotation(Execute.class).asUser();
        }
        if (method.isAnnotationPresent(Execute.class)) {
            user = method.getAnnotation(Execute.class).asUser();
        }
        if (user != null && user != User.ANONYMOUS) {
            // log in, make sure user is logged in and flow is on the requested url
            new WikiBasePageObject().loginAs(user);
        }
    }
    logJSError(driver);
}
Also used : Cookie(org.openqa.selenium.Cookie) JavascriptActions(com.wikia.webdriver.common.core.elemnt.JavascriptActions) User(com.wikia.webdriver.common.core.helpers.User) WikiBasePageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.WikiBasePageObject) Method(java.lang.reflect.Method) WebDriverException(org.openqa.selenium.WebDriverException)

Example 2 with WikiBasePageObject

use of com.wikia.webdriver.pageobjectsfactory.pageobject.WikiBasePageObject in project selenium-tests by Wikia.

the class WikiActivityTests method WikiActivityTests_003_newBlogCreationIsRecordedOnActivityModule.

/**
   * https://wikia-inc.atlassian.net/browse/DAR-1617
   */
@Test(groups = "WikiActivity_003")
@Execute(asUser = User.USER)
public void WikiActivityTests_003_newBlogCreationIsRecordedOnActivityModule() {
    String blogTitle = PageContent.BLOG_POST_NAME_PREFIX + DateTime.now().getMillis();
    String blogContent = PageContent.BLOG_CONTENT + DateTime.now().getMillis();
    UserProfilePageObject userProfile = new WikiBasePageObject().openProfilePage(credentials.userName, wikiURL);
    userProfile.clickOnBlogTab();
    SpecialCreatePage createBlogPage = userProfile.clickOnCreateBlogPost();
    VisualEditModePageObject visualEditMode = createBlogPage.populateTitleField(blogTitle);
    visualEditMode.addContent(blogContent);
    BlogPageObject blogPage = visualEditMode.submitBlog();
    blogPage.verifyBlogTitle(blogTitle);
    blogPage.verifyContent(blogContent);
    new SpecialWikiActivityPageObject(driver).open().verifyRecentNewBlogPage(blogContent, blogTitle, credentials.userName);
}
Also used : BlogPageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.wikipage.blog.BlogPageObject) SpecialWikiActivityPageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.special.SpecialWikiActivityPageObject) VisualEditModePageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.article.editmode.VisualEditModePageObject) WikiBasePageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.WikiBasePageObject) UserProfilePageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.UserProfilePageObject) SpecialCreatePage(com.wikia.webdriver.pageobjectsfactory.pageobject.special.SpecialCreatePage) Execute(com.wikia.webdriver.common.core.annotations.Execute) Test(org.testng.annotations.Test)

Example 3 with WikiBasePageObject

use of com.wikia.webdriver.pageobjectsfactory.pageobject.WikiBasePageObject in project selenium-tests by Wikia.

the class ArticleCRUDAnonTests method articleCRUDAnon_addBySpecialPage.

@Test(groups = { "ArticleCRUDAnon_001" })
public void articleCRUDAnon_addBySpecialPage() {
    WikiBasePageObject base = new WikiBasePageObject();
    String articleContent = PageContent.ARTICLE_TEXT;
    String articleTitle = PageContent.ARTICLE_NAME_PREFIX + DateTime.now().getMillis();
    SpecialCreatePage specialCreatePage = new SpecialCreatePage().open();
    VisualEditModePageObject visualEditMode = specialCreatePage.populateTitleField(articleTitle);
    visualEditMode.addContent(articleContent);
    ArticlePageObject article = visualEditMode.submitArticle();
    article.verifyContent(articleContent);
    article.verifyArticleTitle(articleTitle);
}
Also used : ArticlePageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.article.ArticlePageObject) VisualEditModePageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.article.editmode.VisualEditModePageObject) WikiBasePageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.WikiBasePageObject) SpecialCreatePage(com.wikia.webdriver.pageobjectsfactory.pageobject.special.SpecialCreatePage) Test(org.testng.annotations.Test)

Example 4 with WikiBasePageObject

use of com.wikia.webdriver.pageobjectsfactory.pageobject.WikiBasePageObject in project selenium-tests by Wikia.

the class ArticleFeaturesCRUDTestsUser method addingImagePlaceholder.

@Test(groups = { "ArticleFeaturesCRUDUser_014" })
@Execute(asUser = User.USER)
public void addingImagePlaceholder() {
    new ArticleContent().clear();
    new ArticlePageObject().open();
    VisualEditModePageObject visualEditMode = new WikiBasePageObject().goToArticleDefaultContentEditPage(wikiURL, TestContext.getCurrentMethodName());
    ArticlePageObject article = visualEditMode.submitArticle();
    PhotoAddComponentObject photoAddPhoto = article.clickAddImagePlaceholder();
    PhotoOptionsComponentObject photoOptions = photoAddPhoto.addPhotoFromWiki("image", 2);
    photoOptions.setCaption(PageContent.CAPTION);
    photoOptions.clickAddPhoto();
    article.verifyPhoto();
}
Also used : ArticleContent(com.wikia.webdriver.common.core.api.ArticleContent) ArticlePageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.article.ArticlePageObject) VisualEditModePageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.article.editmode.VisualEditModePageObject) WikiBasePageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.WikiBasePageObject) PhotoAddComponentObject(com.wikia.webdriver.pageobjectsfactory.componentobject.photo.PhotoAddComponentObject) PhotoOptionsComponentObject(com.wikia.webdriver.pageobjectsfactory.componentobject.photo.PhotoOptionsComponentObject) Execute(com.wikia.webdriver.common.core.annotations.Execute) Test(org.testng.annotations.Test)

Example 5 with WikiBasePageObject

use of com.wikia.webdriver.pageobjectsfactory.pageobject.WikiBasePageObject in project selenium-tests by Wikia.

the class TestTopWamWikis method TestTopWamWikisCountInRange.

@Test(groups = "TopWamWikisWhereIsMyExtension")
public void TestTopWamWikisCountInRange() {
    String whereIsExtensionUrl = urlBuilder.getUrlForPath(URLsContent.COMMUNITY_WIKI, URLsContent.SPECIAL_WHERE_IS_EXTENSION);
    whereIsExtensionUrl = urlBuilder.appendQueryStringToURL(whereIsExtensionUrl, extensionURL);
    WikiBasePageObject wikiPage = new WikiBasePageObject();
    wikiPage.getUrl(whereIsExtensionUrl);
    wikiPage.loginAs(credentials.userNameStaff, credentials.passwordStaff, wikiURL);
    wikiPage.verifyNumberOfTop1kWikisInRange(expectedTopWamWikiRange);
}
Also used : WikiBasePageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.WikiBasePageObject) Test(org.testng.annotations.Test)

Aggregations

WikiBasePageObject (com.wikia.webdriver.pageobjectsfactory.pageobject.WikiBasePageObject)174 Test (org.testng.annotations.Test)162 Execute (com.wikia.webdriver.common.core.annotations.Execute)72 ArticlePageObject (com.wikia.webdriver.pageobjectsfactory.pageobject.article.ArticlePageObject)39 InteractiveMapsPageObject (com.wikia.webdriver.pageobjectsfactory.pageobject.special.interactivemaps.InteractiveMapsPageObject)38 InteractiveMapPageObject (com.wikia.webdriver.pageobjectsfactory.pageobject.special.interactivemaps.InteractiveMapPageObject)30 SourceEditModePageObject (com.wikia.webdriver.pageobjectsfactory.pageobject.article.editmode.SourceEditModePageObject)24 DontRun (com.wikia.webdriver.common.core.annotations.DontRun)23 VisualEditModePageObject (com.wikia.webdriver.pageobjectsfactory.pageobject.article.editmode.VisualEditModePageObject)21 BlogPageObject (com.wikia.webdriver.pageobjectsfactory.pageobject.wikipage.blog.BlogPageObject)17 RelatedIssue (com.wikia.webdriver.common.core.annotations.RelatedIssue)14 MiniEditorComponentObject (com.wikia.webdriver.pageobjectsfactory.componentobject.minieditor.MiniEditorComponentObject)13 CreateAMapComponentObject (com.wikia.webdriver.pageobjectsfactory.componentobject.interactivemaps.CreateAMapComponentObject)12 MessageWall (com.wikia.webdriver.pageobjectsfactory.pageobject.messagewall.MessageWall)12 NavigationBar (com.wikia.webdriver.pageobjectsfactory.componentobject.global_navitagtion.NavigationBar)11 AddPinComponentObject (com.wikia.webdriver.pageobjectsfactory.componentobject.interactivemaps.AddPinComponentObject)11 CreatePinTypesComponentObject (com.wikia.webdriver.pageobjectsfactory.componentobject.interactivemaps.CreatePinTypesComponentObject)10 UserProfilePageObject (com.wikia.webdriver.pageobjectsfactory.pageobject.UserProfilePageObject)10 SpecialCreatePage (com.wikia.webdriver.pageobjectsfactory.pageobject.special.SpecialCreatePage)10 DetachedSignInPage (com.wikia.webdriver.pageobjectsfactory.pageobject.auth.signin.DetachedSignInPage)9