Search in sources :

Example 1 with CategoryPage

use of com.wikia.webdriver.elements.mercury.pages.CategoryPage in project selenium-tests by Wikia.

the class Category method openCategoryPage.

public CategoryPage openCategoryPage(String name) {
    WebElement link = categoryList.findElement(By.cssSelector(String.format("a[title=\"%s\"]", name)));
    PageObjectLogging.logInfo(String.format("Open category page named: \"%s\".", name));
    wait.forElementClickable(link);
    link.click();
    loading.handleAsyncPageReload();
    Assertion.assertTrue(driver.getCurrentUrl().contains("/wiki/Category:"), "Url is different than /wiki/Category:");
    PageObjectLogging.logInfo("You were redirected to /wiki/Category:");
    return new CategoryPage();
}
Also used : WebElement(org.openqa.selenium.WebElement) CategoryPage(com.wikia.webdriver.elements.mercury.pages.CategoryPage)

Example 2 with CategoryPage

use of com.wikia.webdriver.elements.mercury.pages.CategoryPage in project selenium-tests by Wikia.

the class CategoryPageTest method mercury_category_navigateToCategoryPageWithArticleAndWithMembersFromUrl.

@Test(groups = "mercury_category_navigateToCategoryPageWithArticleAndWithMembersFromUrl")
public void mercury_category_navigateToCategoryPageWithArticleAndWithMembersFromUrl() {
    final String categoryName = String.format("Category:%s", TestContext.getCurrentMethodName());
    ArticleContent articleContent = new ArticleContent();
    articleContent.push("some irrelevant content of category article", categoryName);
    articleContent.push(String.format("[[%s]]", categoryName), String.format("A-%s", categoryName));
    articleContent.push(String.format("[[%s]]", categoryName), String.format("B-%s", categoryName));
    articleContent.push(String.format("[[%s]]", categoryName), String.format("C-%s", categoryName));
    CategoryPage category = new CategoryPage().open(categoryName);
    Assert.assertFalse("".equals(category.getArticleContent()));
    Assert.assertTrue(category.categoryMembersContainerIsVisible());
    Assert.assertTrue(category.hasCategoryMembers());
}
Also used : ArticleContent(com.wikia.webdriver.common.core.api.ArticleContent) CategoryPage(com.wikia.webdriver.elements.mercury.pages.CategoryPage) Test(org.testng.annotations.Test)

Example 3 with CategoryPage

use of com.wikia.webdriver.elements.mercury.pages.CategoryPage in project selenium-tests by Wikia.

the class CategoryPageTest method mercury_category_testPagination.

@Test(groups = "mercury_category_testPagination")
public void mercury_category_testPagination() throws InterruptedException {
    // This test assumes that there are more than 200 articles created and with category like one below.
    // Staging env should have fixture of this articles to create them everytime it is rebuilded
    final String categoryName = String.format("Category:%s", TestContext.getCurrentMethodName());
    ArticleContent articleContent = new ArticleContent();
    articleContent.push("some irrelevant content of category article", categoryName);
    // execute this loop only once on staging and then create fixture
    //    for (int i = 0; i < 300; ++i) {
    //      articleContent.push(String.format("aa [[%s]]", categoryName), String.format("%d-%s", i, categoryName));
    //    }
    CategoryPage categoryPage = new CategoryPage().open(categoryName);
    Assert.assertTrue(categoryPage.hasCategoryMembers());
    Assert.assertTrue(categoryPage.nextButtonIsVisible());
    categoryPage.clickNextButton();
    Assert.assertTrue(categoryPage.hasCategoryMembers());
    Assert.assertTrue(categoryPage.previousButtonIsVisible());
    // Wait for scroll animation to be finished.
    // categoryPage.previousButtonIsVisible() scrolls to element but jQuery animation scrolls back to somewhere in the middle of a page.
    Thread.sleep(1000);
    categoryPage.clickPreviousButton();
    Assert.assertTrue(categoryPage.hasCategoryMembers());
    Assert.assertTrue(categoryPage.nextButtonIsVisible());
}
Also used : ArticleContent(com.wikia.webdriver.common.core.api.ArticleContent) CategoryPage(com.wikia.webdriver.elements.mercury.pages.CategoryPage) Test(org.testng.annotations.Test)

Example 4 with CategoryPage

use of com.wikia.webdriver.elements.mercury.pages.CategoryPage in project selenium-tests by Wikia.

the class CategoryPageTest method mercury_category_navigateToCategoryPageFromLinkInArticle.

@Test(groups = "mercury_category_navigateToCategoryPageWithArticleAndWithoutMembersFromLink")
public void mercury_category_navigateToCategoryPageFromLinkInArticle() {
    final String categoryName = String.format("Category:%s", TestContext.getCurrentMethodName());
    new ArticleContent().push(String.format("[[%s]]", categoryName));
    CategoryPage categoryPage = new ArticlePage().open().openCategoryPageFromCategoriesDropdown();
    Assert.assertTrue(categoryPage.hasCategoryMembers());
}
Also used : ArticleContent(com.wikia.webdriver.common.core.api.ArticleContent) ArticlePage(com.wikia.webdriver.elements.mercury.pages.ArticlePage) CategoryPage(com.wikia.webdriver.elements.mercury.pages.CategoryPage) Test(org.testng.annotations.Test)

Example 5 with CategoryPage

use of com.wikia.webdriver.elements.mercury.pages.CategoryPage in project selenium-tests by Wikia.

the class CategoryPageTest method mercury_category_navigateToCategoryPageWithoutArticleAndWithMembersFromUrl.

@Test(groups = "mercury_category_navigateToCategoryPageWithoutArticleAndWithMembersFromUrl")
public void mercury_category_navigateToCategoryPageWithoutArticleAndWithMembersFromUrl() {
    final String categoryName = String.format("Category:%s", TestContext.getCurrentMethodName());
    ArticleContent articleContent = new ArticleContent();
    articleContent.push(String.format("[[%s]]", categoryName), String.format("A-%s", categoryName));
    articleContent.push(String.format("[[%s]]", categoryName), String.format("B-%s", categoryName));
    articleContent.push(String.format("[[%s]]", categoryName), String.format("C-%s", categoryName));
    CategoryPage category = new CategoryPage().open(categoryName);
    Assert.assertEquals("", category.getArticleContent());
    Assert.assertTrue(category.categoryMembersContainerIsVisible());
    Assert.assertTrue(category.hasCategoryMembers());
}
Also used : ArticleContent(com.wikia.webdriver.common.core.api.ArticleContent) CategoryPage(com.wikia.webdriver.elements.mercury.pages.CategoryPage) Test(org.testng.annotations.Test)

Aggregations

CategoryPage (com.wikia.webdriver.elements.mercury.pages.CategoryPage)7 ArticleContent (com.wikia.webdriver.common.core.api.ArticleContent)6 Test (org.testng.annotations.Test)6 ArticlePage (com.wikia.webdriver.elements.mercury.pages.ArticlePage)2 WebElement (org.openqa.selenium.WebElement)1