use of org.xwiki.test.ui.browser.IgnoreBrowsers in project xwiki-platform by xwiki.
the class AnnotationsTest method addAndDeleteAnnotations.
@Test
@IgnoreBrowsers({ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177") })
public void addAndDeleteAnnotations() {
getUtil().deletePage(getTestClassName(), getTestMethodName());
AnnotatableViewPage annotatableViewPage = new AnnotatableViewPage(getUtil().createPage(getTestClassName(), getTestMethodName(), CONTENT, null));
annotatableViewPage.addAnnotation(ANNOTATED_TEXT_1, ANNOTATION_TEXT_1);
Assert.assertEquals(ANNOTATION_TEXT_1, annotatableViewPage.getAnnotationContentByText(ANNOTATED_TEXT_1));
annotatableViewPage.addAnnotation(ANNOTATED_TEXT_2, ANNOTATION_TEXT_2);
Assert.assertEquals(ANNOTATION_TEXT_2, annotatableViewPage.getAnnotationContentByText(ANNOTATED_TEXT_2));
annotatableViewPage.addAnnotation(ANNOTATED_TEXT_3, ANNOTATION_TEXT_3);
Assert.assertEquals(ANNOTATION_TEXT_3, annotatableViewPage.getAnnotationContentByText(ANNOTATED_TEXT_3));
annotatableViewPage.addAnnotation(ANNOTATED_TEXT_4, ANNOTATION_TEXT_4);
Assert.assertEquals(ANNOTATION_TEXT_4, annotatableViewPage.getAnnotationContentByText(ANNOTATED_TEXT_4));
// It seems that there are some issues refreshing content while this tab is not open. This might be a bug in the
// Annotations Application
annotatableViewPage.showAnnotationsPane();
annotatableViewPage.deleteAnnotationByText(ANNOTATED_TEXT_1);
annotatableViewPage.deleteAnnotationByText(ANNOTATED_TEXT_2);
annotatableViewPage.deleteAnnotationByText(ANNOTATED_TEXT_3);
annotatableViewPage.deleteAnnotationByText(ANNOTATED_TEXT_4);
}
use of org.xwiki.test.ui.browser.IgnoreBrowsers in project xwiki-platform by xwiki.
the class AttachmentTest method testUploadDownloadTwoAttachmentsInSequence.
@Test
@IgnoreBrowsers({ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177") })
public void testUploadDownloadTwoAttachmentsInSequence() {
ViewPage vp = getUtil().createPage(getTestClassName(), getTestMethodName(), null, getTestClassName() + "#" + getTestMethodName());
// TODO: Remove when XWIKI-6688 (Possible race condition when clicking on a tab at the bottom of a page in
// view mode) is fixed.
vp.waitForDocExtraPaneActive("comments");
AttachmentsPane ap = vp.openAttachmentsDocExtraPane();
ap.setFileToUpload(this.getClass().getResource("/" + this.testAttachment).getPath());
ap.waitForUploadToFinish(this.testAttachment);
ap.clickHideProgress();
ap.setFileToUpload(this.getClass().getResource("/" + this.testAttachment2).getPath());
ap.waitForUploadToFinish(this.testAttachment2);
Assert.assertEquals("1.1", ap.getLatestVersionOfAttachment(this.testAttachment));
Assert.assertEquals("1.1", ap.getLatestVersionOfAttachment(this.testAttachment2));
// Verify attachment contents
ap.getAttachmentLink(this.testAttachment).click();
Assert.assertEquals("This is a small attachment.", getDriver().findElement(By.tagName("html")).getText());
getDriver().navigate().back();
vp.waitForDocExtraPaneActive("attachments");
ap.getAttachmentLink(this.testAttachment2).click();
Assert.assertEquals("This is another small attachment.", getDriver().findElement(By.tagName("html")).getText());
}
use of org.xwiki.test.ui.browser.IgnoreBrowsers in project xwiki-platform by xwiki.
the class CommentAsGuestTest method testReplyCommentAsAnonymous.
@Test
@IgnoreBrowsers({ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177") })
public void testReplyCommentAsAnonymous() {
CommentsTab commentsTab = this.vp.openCommentsDocExtraPane();
commentsTab.postCommentAsGuest(COMMENT_CONTENT, COMMENT_AUTHOR, true);
commentsTab.replyToCommentByID(commentsTab.getCommentID(COMMENT_CONTENT), COMMENT_REPLY);
Assert.assertEquals(COMMENT_REPLY, commentsTab.getCommentContentByID(commentsTab.getCommentID(COMMENT_REPLY)));
Assert.assertEquals(COMMENT_AUTHOR, commentsTab.getCommentAuthorByID(commentsTab.getCommentID(COMMENT_REPLY)));
}
use of org.xwiki.test.ui.browser.IgnoreBrowsers in project xwiki-platform by xwiki.
the class CommentAsGuestTest method testPostCommentAsGuestNoJs.
@Test
@IgnoreBrowsers({ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177") })
public void testPostCommentAsGuestNoJs() {
getUtil().gotoPage(getTestClassName(), getTestMethodName(), "view", "xpage=xpart&vm=commentsinline.vm");
CommentsTab commentsTab = new CommentsTab();
commentsTab.postComment(COMMENT_CONTENT, false);
// This opens with ?viewer=comments, don't explicitly load the comments tab
new ViewPage().waitUntilPageIsLoaded();
Assert.assertEquals(COMMENT_CONTENT, commentsTab.getCommentContentByID(commentsTab.getCommentID(COMMENT_CONTENT)));
Assert.assertEquals(COMMENT_AUTHOR, commentsTab.getCommentAuthorByID(commentsTab.getCommentID(COMMENT_CONTENT)));
}
use of org.xwiki.test.ui.browser.IgnoreBrowsers in project xwiki-platform by xwiki.
the class CreatePageIT method createPagesFromTemplate.
/**
* Tests if a new page can be created from a template.
*/
@Test
@IgnoreBrowsers({ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177") })
public void createPagesFromTemplate() throws Exception {
// Step 0: Setup the correct environment for the test
// All these pages are created during this test
getUtil().deleteSpace(getTestClassName());
getUtil().rest().deletePage(getTestClassName(), getTestMethodName());
EntityReference templateInstanceReference = getUtil().resolveDocumentReference(getTestClassName() + "." + TEMPLATE_NAME + "Instance" + ".WebHome");
getUtil().rest().delete(templateInstanceReference);
getUtil().rest().deletePage(getTestClassName(), "NewPage");
getUtil().rest().deletePage(getTestClassName(), TEMPLATE_NAME + "UnexistingInstance");
getUtil().rest().deletePage(getTestClassName(), "EmptyPage");
String templateContent = "Test Template Content";
String templateTitle = "Test Template Title";
String templateProviderName = TEMPLATE_NAME + "Provider";
String templateProviderFullName = getTestClassName() + "." + templateProviderName;
// Step 1: Create a Template and a Template Provider and try to create a new page by using the Add Menu and
// using the created Template
ViewPage templateProviderView = createTemplateAndTemplateProvider(templateProviderName, templateContent, templateTitle, false);
// Create the new document from template
CreatePagePage createPagePage = templateProviderView.createPage();
// Save the number of available templates so that we can make some checks later on.
int availableTemplateSize = createPagePage.getAvailableTemplateSize();
String templateInstanceName = TEMPLATE_NAME + "Instance";
createPagePage.getDocumentPicker().toggleLocationAdvancedEdit();
EditPage templateInstanceEditWysiwyg = createPagePage.createPageFromTemplate(templateInstanceName, getTestClassName(), null, templateProviderFullName);
WikiEditPage templateInstanceEdit = templateInstanceEditWysiwyg.clickSaveAndView().editWiki();
// Verify template instance location and content
assertEquals(templateInstanceName, templateInstanceEdit.getTitle());
assertEquals(getTestClassName() + "." + templateInstanceName, templateInstanceEdit.getMetaDataValue("space"));
assertEquals("WebHome", templateInstanceEdit.getMetaDataValue("page"));
assertEquals(templateContent, templateInstanceEdit.getContent());
// check the parent of the template instance
assertEquals(templateProviderFullName, templateInstanceEdit.getParent());
// Step 2: Create a wanted link and verify that clicking it displays the Template and that we can use it.
// Put a wanted link in the template instance
templateInstanceEdit.setContent("[[doc:NewPage]]");
ViewPage vp = templateInstanceEdit.clickSaveAndView();
// Verify that clicking on the wanted link pops up a box to choose the template.
EntityReference wantedLinkReference = getUtil().resolveDocumentReference(getTestClassName() + "." + TEMPLATE_NAME + "Instance" + ".NewPage");
vp.clickWantedLink(wantedLinkReference, true);
// TODO: a page object should be better here
List<WebElement> templates = getDriver().findElements(By.xpath("//input[@name='type' and @data-type='template']"));
// Note: We need to remove 1 to exclude the "Empty Page" template entry
assertEquals(availableTemplateSize, templates.size());
assertTrue(createPagePage.getAvailableTemplates().contains(templateProviderFullName));
// Step 3: Create a new page when located on a non-existing page
getUtil().gotoPage(getTestClassName(), TEMPLATE_NAME + "UnexistingInstance", "view", "spaceRedirect=false");
vp = new ViewPage();
assertFalse(vp.exists());
DocumentDoesNotExistPage unexistingPage = new DocumentDoesNotExistPage();
unexistingPage.clickEditThisPageToCreate();
CreatePagePage createUnexistingPage = new CreatePagePage();
// Make sure we're in create mode.
assertTrue(getUtil().isInCreateMode());
// count the available templates, make sure they're as many as before and that our template is among them
assertEquals(availableTemplateSize, createUnexistingPage.getAvailableTemplateSize());
assertTrue(createUnexistingPage.getAvailableTemplates().contains(templateProviderFullName));
// select it
createUnexistingPage.setTemplate(templateProviderFullName);
createUnexistingPage.setTerminalPage(true);
// and create
createUnexistingPage.clickCreate();
EditPage ep = new EditPage();
WikiEditPage unexistingPageEdit = ep.clickSaveAndView().editWiki();
// Verify template instance location and content
assertEquals(getTestClassName(), templateInstanceEdit.getMetaDataValue("space"));
assertEquals(TEMPLATE_NAME + "UnexistingInstance", templateInstanceEdit.getMetaDataValue("page"));
assertEquals(TEMPLATE_NAME + "UnexistingInstance", unexistingPageEdit.getTitle());
assertEquals(templateContent, unexistingPageEdit.getContent());
// test that this page has no parent
assertEquals("Main.WebHome", unexistingPageEdit.getParent());
// Step 4: Create an empty new page when there are Templates available
// Make sure we are on a page that exists so that Add > Page will show the space and page fields
CreatePagePage createEmptyPage = unexistingPageEdit.clickCancel().createPage();
assertTrue(createEmptyPage.getAvailableTemplateSize() > 0);
createEmptyPage.getDocumentPicker().toggleLocationAdvancedEdit();
EditPage editEmptyPage = createEmptyPage.createPage(getTestClassName(), "EmptyPage");
ViewPage emptyPage = editEmptyPage.clickSaveAndView();
// make sure it's empty
assertEquals("", emptyPage.getContent());
// make sure parent is the right one
assertEquals("/" + getTestClassName() + "/EmptyPage", emptyPage.getBreadcrumbContent());
// mare sure title is the right one
assertEquals("EmptyPage", emptyPage.getDocumentTitle());
// Step 5: Verify that restricting a Template to a space works
// Restrict the template to its own space
templateProviderView = getUtil().gotoPage(getTestClassName(), TEMPLATE_NAME + "Provider");
templateProviderView.editInline();
TemplateProviderInlinePage templateProviderInline = new TemplateProviderInlinePage();
List<String> allowedSpaces = new ArrayList<String>();
allowedSpaces.add(getTestClassName());
templateProviderInline.setVisibilityRestrictions(allowedSpaces);
templateProviderInline.setCreationRestrictions(allowedSpaces);
templateProviderView = templateProviderInline.clickSaveAndView();
// Verify we can still create a page from template in the test space
createPagePage = templateProviderView.createPage();
// Make sure we get in create mode.
assertTrue(getUtil().isInCreateMode());
assertEquals(availableTemplateSize, createPagePage.getAvailableTemplateSize());
assertTrue(createPagePage.getAvailableTemplates().contains(templateProviderFullName));
// Modify the target space and verify the form can't be submitted
createPagePage.setTemplate(templateProviderFullName);
createPagePage.getDocumentPicker().toggleLocationAdvancedEdit();
createPagePage.getDocumentPicker().setParent("Foo");
createPagePage.getDocumentPicker().setName("Bar");
String currentURL = getDriver().getCurrentUrl();
createPagePage.clickCreate();
assertEquals(currentURL, getDriver().getCurrentUrl());
// and check that an error is displayed to the user
createPagePage.waitForFieldErrorMessage();
// Verify the template we have removed is no longer available.
CreatePagePage.gotoPage();
// make sure that the template provider is not in the list of templates
assertFalse(createPagePage.getAvailableTemplates().contains(templateProviderFullName));
}
Aggregations