Search in sources :

Example 1 with DeletePageObject

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

the class CreateWikiTests_loggedInUser method CreateNewWiki_001_createDeleteWiki.

@Test(groups = { "CNW", "CreateNewWikiLoggedIn_001" })
@Execute(asUser = User.USER_CNW)
public void CreateNewWiki_001_createDeleteWiki() {
    WikiBasePageObject base = new WikiBasePageObject();
    CreateNewWikiPageObjectStep1 cnw1 = base.openSpecialCreateNewWikiPage(wikiCorporateURL);
    String wikiName = cnw1.getWikiName();
    cnw1.typeInWikiName(wikiName);
    cnw1.verifyNextButtonEnabled();
    CreateNewWikiPageObjectStep2 cnw2 = cnw1.submit();
    cnw2.selectCategory(CreateWikiMessages.WIKI_CATEGORY_ID);
    CreateNewWikiPageObjectStep3 cnw3 = cnw2.submit();
    cnw3.selectThemeByName(CreateWikiMessages.WIKI_THEME);
    ArticlePageObject article = cnw3.submit();
    article.verifyWikiTitleOnCongratualtionsLightBox(wikiName);
    article.closeNewWikiCongratulationsLightBox();
    article.verifyWikiTitleHeader(wikiName);
    DeletePageObject deletePage = article.deleteUsingDropdown();
    deletePage.submitDeletion();
    article.verifyUserLoggedIn(User.USER_CNW.getUserName());
}
Also used : ArticlePageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.article.ArticlePageObject) CreateNewWikiPageObjectStep1(com.wikia.webdriver.pageobjectsfactory.pageobject.createnewwiki.CreateNewWikiPageObjectStep1) DeletePageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.actions.DeletePageObject) WikiBasePageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.WikiBasePageObject) CreateNewWikiPageObjectStep3(com.wikia.webdriver.pageobjectsfactory.pageobject.createnewwiki.CreateNewWikiPageObjectStep3) CreateNewWikiPageObjectStep2(com.wikia.webdriver.pageobjectsfactory.pageobject.createnewwiki.CreateNewWikiPageObjectStep2) Execute(com.wikia.webdriver.common.core.annotations.Execute) Test(org.testng.annotations.Test)

Example 2 with DeletePageObject

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

the class ArticlePageObject method deleteFirstComment.

public DeletePageObject deleteFirstComment() {
    jsActions.scrollToElement(allCommentsArea);
    WebElement mostRecentComment = articleComments.get(0);
    JavascriptExecutor js = (JavascriptExecutor) driver;
    js.executeScript("arguments[0].querySelector(arguments[1]).click()", mostRecentComment, DELETE_BUTTON_SELECTOR);
    return new DeletePageObject(driver);
}
Also used : JavascriptExecutor(org.openqa.selenium.JavascriptExecutor) DeletePageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.actions.DeletePageObject) WebElement(org.openqa.selenium.WebElement)

Example 3 with DeletePageObject

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

the class ImageStorageTests method ImageStorage_001_deleteImage.

@Test(groups = { "ImageStorageTests", "ImageStorage_001" })
@UseUnstablePageLoadStrategy
@Execute(asUser = User.USER_2)
@RelatedIssue(issueID = "QAART-1028")
public void ImageStorage_001_deleteImage() {
    SpecialNewFilesPage filesPage = new SpecialNewFilesPage().openSpecialNewFiles(wikiURL);
    filesPage.addPhoto();
    filesPage.selectFileToUpload(PageContent.FILE);
    String fileName = DateTime.now().getMillis() + PageContent.FILE;
    filesPage.clickOnMoreOptions();
    filesPage.setFileName(fileName);
    filesPage.checkIgnoreAnyWarnings();
    filesPage.clickUploadButton();
    filesPage.verifyFileUploaded(fileName);
    FilePage file = new FilePage().open(fileName, true);
    imageURL = file.getImageUrl();
    imageThumbnailURL = file.getImageThumbnailUrl();
    file.verifyURLStatus(200, imageURL);
    file.verifyURLStatus(200, imageThumbnailURL);
    file.loginAs(User.STAFF);
    DeletePageObject delete = file.deletePage();
    delete.submitDeletion();
    List<Notification> confirmNotifications = filesPage.getNotifications(NotificationType.CONFIRM);
    Assertion.assertEquals(confirmNotifications.size(), 1, DeletePageObject.AssertionMessages.INVALID_NUMBER_OF_CONFIRMING_NOTIFICATIONS);
    Assertion.assertTrue(confirmNotifications.stream().findFirst().get().isVisible(), DeletePageObject.AssertionMessages.BANNER_NOTIFICATION_NOT_VISIBLE);
    filesPage.verifyURLStatus(404, imageURL);
    filesPage.verifyURLStatus(404, imageThumbnailURL);
    confirmNotifications = delete.getNotifications(NotificationType.CONFIRM);
    Assertion.assertEquals(confirmNotifications.size(), 1, DeletePageObject.AssertionMessages.INVALID_NUMBER_OF_CONFIRMING_NOTIFICATIONS);
    SpecialRestorePageObject restore = confirmNotifications.stream().findFirst().get().undelete();
    restore.giveReason(PageContent.CAPTION);
    restore.restorePage();
    confirmNotifications = restore.getNotifications(NotificationType.CONFIRM);
    Assertion.assertEquals(confirmNotifications.size(), 1, SpecialRestorePageObject.AssertionMessages.INVALID_NUMBER_OF_CONFIRMING_NOTIFICATIONS);
    Assertion.assertTrue(confirmNotifications.stream().findFirst().get().isVisible(), SpecialRestorePageObject.AssertionMessages.BANNER_NOTIFICATION_NOT_VISIBLE);
    file.verifyURLStatus(200, imageURL);
    file.verifyURLStatus(200, imageThumbnailURL);
    file.deletePage();
    delete.submitDeletion();
}
Also used : DeletePageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.actions.DeletePageObject) SpecialRestorePageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.special.SpecialRestorePageObject) FilePage(com.wikia.webdriver.pageobjectsfactory.pageobject.special.filepage.FilePage) SpecialNewFilesPage(com.wikia.webdriver.pageobjectsfactory.pageobject.special.SpecialNewFilesPage) Notification(com.wikia.webdriver.elements.oasis.components.notifications.Notification) UseUnstablePageLoadStrategy(com.wikia.webdriver.common.driverprovider.UseUnstablePageLoadStrategy) Execute(com.wikia.webdriver.common.core.annotations.Execute) Test(org.testng.annotations.Test) RelatedIssue(com.wikia.webdriver.common.core.annotations.RelatedIssue)

Example 4 with DeletePageObject

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

the class FilePageTests method filePage005_deleteFromHistory.

/**
   * Verify that a video can be deleted from the File page
   */
@Test(groups = { "FilePage", "filePage005_deleteFromHistory", "Media" })
@RelatedIssue(issueID = "SUS-317", comment = "Product code defect. Test manually that the video can be deleted")
public void filePage005_deleteFromHistory() {
    YoutubeVideo video = YoutubeVideoProvider.getLatestVideoForQuery("pokemon");
    // Go to Special:Videos to add a video
    SpecialVideosPageObject specialVideos = new SpecialVideosPageObject(driver);
    specialVideos.loginAs(credentials.userNameStaff, credentials.passwordStaff, wikiURL);
    specialVideos.openSpecialVideoPage(wikiURL);
    // Add a Youtube video we'll delete
    VetAddVideoComponentObject vetAddingVideo = specialVideos.clickAddAVideo();
    vetAddingVideo.addVideoByUrl(video.getUrl());
    // Verify the video is actually there
    specialVideos.verifyVideoAdded(video.getTitle());
    // Go to the history tab and add a second video to test deleting a version
    FilePage filePage = new FilePage().open(video.getFileName());
    filePage.selectHistoryTab();
    filePage.replaceVideo(VideoContent.YOUTUBE_VIDEO_URL5);
    // Load the file page again, should have the same name
    filePage.open(video.getFileName()).verifyEmbeddedVideoIsPresent();
    //Removed following lines until SUS-317 is fixed
    //// Go to the history tab and verify there are at least two videos
    //filePage.selectHistoryTab();
    //filePage.verifyVersionCountAtLeast(2);
    //// Delete the second version
    //DeletePageObject deletePage = filePage.deleteVersion(2);
    //deletePage.submitDeletion();
    //Removed above lines until SUS-317is fixed
    // Load the file page again, should have the same name
    filePage.open(video.getFileName()).verifyEmbeddedVideoIsPresent();
    // Delete the first version and thus the whole page
    DeletePageObject deletePage = filePage.deleteVersion(1);
    deletePage.submitDeletion();
    // Go back to the file page and make sure its gone
    filePage.open(video.getFileName()).verifyEmptyFilePage();
}
Also used : DeletePageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.actions.DeletePageObject) YoutubeVideo(com.wikia.webdriver.common.core.video.YoutubeVideo) VetAddVideoComponentObject(com.wikia.webdriver.pageobjectsfactory.componentobject.vet.VetAddVideoComponentObject) FilePage(com.wikia.webdriver.pageobjectsfactory.pageobject.special.filepage.FilePage) SpecialVideosPageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.special.SpecialVideosPageObject) Test(org.testng.annotations.Test) RelatedIssue(com.wikia.webdriver.common.core.annotations.RelatedIssue)

Example 5 with DeletePageObject

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

the class BlogTests method BlogTests_004_deleteUndelete.

@Test(groups = { "BlogTests_004", "BlogTests" })
public void BlogTests_004_deleteUndelete() {
    WikiBasePageObject base = new WikiBasePageObject();
    base.loginAs(credentials.userNameStaff, credentials.passwordStaff, wikiURL);
    UserProfilePageObject userProfile = base.openProfilePage(credentials.userName4, wikiURL);
    userProfile.clickOnBlogTab();
    BlogPageObject blogPage = userProfile.openFirstPost();
    String blogTitle = blogPage.getBlogName();
    DeletePageObject deletePage = blogPage.deleteUsingDropdown();
    deletePage.submitDeletion();
    List<Notification> confirmNotifications = base.getNotifications(NotificationType.CONFIRM);
    Assertion.assertEquals(confirmNotifications.size(), 1, DeletePageObject.AssertionMessages.INVALID_NUMBER_OF_CONFIRMING_NOTIFICATIONS);
    SpecialRestorePageObject restore = base.getNotifications(NotificationType.CONFIRM).stream().findFirst().get().undelete();
    restore.giveReason(blogPage.getTimeStamp());
    restore.restorePage();
    confirmNotifications = blogPage.getNotifications(NotificationType.CONFIRM);
    Assertion.assertEquals(confirmNotifications.size(), 1, SpecialRestorePageObject.AssertionMessages.INVALID_NUMBER_OF_CONFIRMING_NOTIFICATIONS);
    Assertion.assertTrue(confirmNotifications.stream().findFirst().get().isVisible(), SpecialRestorePageObject.AssertionMessages.BANNER_NOTIFICATION_NOT_VISIBLE);
    blogPage.verifyBlogTitle(blogTitle);
}
Also used : BlogPageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.wikipage.blog.BlogPageObject) DeletePageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.actions.DeletePageObject) WikiBasePageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.WikiBasePageObject) SpecialRestorePageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.special.SpecialRestorePageObject) UserProfilePageObject(com.wikia.webdriver.pageobjectsfactory.pageobject.UserProfilePageObject) Notification(com.wikia.webdriver.elements.oasis.components.notifications.Notification) Test(org.testng.annotations.Test)

Aggregations

DeletePageObject (com.wikia.webdriver.pageobjectsfactory.pageobject.actions.DeletePageObject)11 Test (org.testng.annotations.Test)10 Execute (com.wikia.webdriver.common.core.annotations.Execute)6 Notification (com.wikia.webdriver.elements.oasis.components.notifications.Notification)6 RelatedIssue (com.wikia.webdriver.common.core.annotations.RelatedIssue)5 FilePage (com.wikia.webdriver.pageobjectsfactory.pageobject.special.filepage.FilePage)5 YoutubeVideo (com.wikia.webdriver.common.core.video.YoutubeVideo)3 UseUnstablePageLoadStrategy (com.wikia.webdriver.common.driverprovider.UseUnstablePageLoadStrategy)3 VetAddVideoComponentObject (com.wikia.webdriver.pageobjectsfactory.componentobject.vet.VetAddVideoComponentObject)3 WikiBasePageObject (com.wikia.webdriver.pageobjectsfactory.pageobject.WikiBasePageObject)3 ArticlePageObject (com.wikia.webdriver.pageobjectsfactory.pageobject.article.ArticlePageObject)3 SpecialRestorePageObject (com.wikia.webdriver.pageobjectsfactory.pageobject.special.SpecialRestorePageObject)3 SpecialVideosPageObject (com.wikia.webdriver.pageobjectsfactory.pageobject.special.SpecialVideosPageObject)3 ArticleContent (com.wikia.webdriver.common.core.api.ArticleContent)2 MiniEditorComponentObject (com.wikia.webdriver.pageobjectsfactory.componentobject.minieditor.MiniEditorComponentObject)2 UserProfilePageObject (com.wikia.webdriver.pageobjectsfactory.pageobject.UserProfilePageObject)2 SpecialNewFilesPage (com.wikia.webdriver.pageobjectsfactory.pageobject.special.SpecialNewFilesPage)2 BlogPageObject (com.wikia.webdriver.pageobjectsfactory.pageobject.wikipage.blog.BlogPageObject)2 RenamePageObject (com.wikia.webdriver.pageobjectsfactory.pageobject.actions.RenamePageObject)1 CreateNewWikiPageObjectStep1 (com.wikia.webdriver.pageobjectsfactory.pageobject.createnewwiki.CreateNewWikiPageObjectStep1)1