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