use of org.xwiki.tag.test.po.TaggablePage in project xwiki-platform by xwiki.
the class CompareVersionsTest method setUp.
@Before
public void setUp() throws Exception {
String pageName = "PageWithManyVersions";
// Check if the test page exists.
testPage = getUtil().gotoPage(getTestClassName(), pageName);
if (testPage.exists()) {
// TODO: Remove when XWIKI-6688 (Possible race condition when clicking on a tab at the bottom of a page in
// view mode) is fixed.
testPage.waitForDocExtraPaneActive("comments");
// versions of the test page.
return;
}
// Since this test also verifies diffs when the parent/child relationship is modified, use this mode (which
// isn't the default) for testing purpose. Also note that in the "reference" mode there's no diff to display
// when the document is moved to a different parent since it means changing the identity of the document for
// now and thus changing it means getting a new document.
getUtil().setHierarchyMode("parentchild");
getDriver().navigate().refresh();
// Create the test page.
testPage = getUtil().createPage(getTestClassName(), pageName, "one\ntwo\nthree", "Test");
// Change the content and the meta data.
WikiEditPage wikiEditPage = testPage.editWiki();
wikiEditPage.setContent("one\n**two**\nfour");
wikiEditPage.setTitle("Compare verSions test");
wikiEditPage.setParent("Sandbox.WebHome");
wikiEditPage.setEditComment("Changed content and meta data.");
wikiEditPage.clickSaveAndContinue();
wikiEditPage.setTitle("Compare versions test");
wikiEditPage.setMinorEdit(true);
wikiEditPage.setEditComment("Fix typo in title.");
wikiEditPage.clickSaveAndContinue();
// Add objects.
ObjectEditPage objectEditPage = wikiEditPage.editObjects();
FormElement form = objectEditPage.addObject("XWiki.JavaScriptExtension");
Map<String, String> assignment = new HashMap<String, String>();
assignment.put("XWiki.JavaScriptExtension_0_name", "JavaScript code");
assignment.put("XWiki.JavaScriptExtension_0_code", "var tmp = alice;\nalice = bob;\nbob = tmp;");
assignment.put("XWiki.JavaScriptExtension_0_use", "onDemand");
form.fillFieldsByName(assignment);
objectEditPage.clickSaveAndContinue();
assignment.put("XWiki.JavaScriptExtension_0_name", "Code snippet");
assignment.put("XWiki.JavaScriptExtension_0_code", "var tmp = alice;\nalice = 2 * bob;\nbob = tmp;");
form.fillFieldsByName(assignment);
objectEditPage.clickSaveAndContinue();
// Create class.
ClassEditPage classEditPage = objectEditPage.editClass();
classEditPage.addProperty("age", "Number");
classEditPage.addProperty("color", "String");
classEditPage.getNumberClassEditElement("age").setNumberType("integer");
classEditPage.clickSaveAndContinue();
classEditPage.deleteProperty("color");
testPage = classEditPage.clickSaveAndView();
// Add tags.
TaggablePage taggablePage = new TaggablePage();
AddTagsPane addTagsPane = taggablePage.addTags();
addTagsPane.setTags("foo,bar");
addTagsPane.add();
taggablePage.removeTag("foo");
// Attach files.
AttachmentsPane attachmentsPane = testPage.openAttachmentsDocExtraPane();
// TODO: Update this code when we (re)add support for uploading multiple files at once.
for (String fileName : new String[] { "SmallAttachment.txt", "SmallAttachment2.txt", "SmallAttachment.txt" }) {
attachmentsPane.setFileToUpload(this.getClass().getResource('/' + fileName).getPath());
attachmentsPane.waitForUploadToFinish(fileName);
attachmentsPane.clickHideProgress();
}
attachmentsPane.deleteAttachmentByFileByName("SmallAttachment2.txt");
// Add comments.
getUtil().createUserAndLogin("Alice", "ecila");
testPage = getUtil().gotoPage(getTestClassName(), pageName);
CommentsTab commentsTab = testPage.openCommentsDocExtraPane();
commentsTab.postComment("first line\nsecond line", true);
commentsTab.editCommentByID(0, "first line\nline in between\nsecond line");
commentsTab.replyToCommentByID(0, "this is a reply");
commentsTab.deleteCommentByID(1);
}
use of org.xwiki.tag.test.po.TaggablePage in project xwiki-platform by xwiki.
the class EditInlineTest method testInlineEditPreservesTags.
/* See XWIKI-2199 */
@Test
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177")
public void testInlineEditPreservesTags() {
String tag1 = RandomStringUtils.randomAlphanumeric(4);
String tag2 = RandomStringUtils.randomAlphanumeric(4);
getUtil().gotoPage(getTestClassName(), getTestMethodName(), "save", "tags=" + tag1 + "%7C" + tag2);
TaggablePage taggablePage = new TaggablePage();
Assert.assertTrue(taggablePage.hasTag(tag1));
Assert.assertTrue(taggablePage.hasTag(tag2));
taggablePage.editInline().clickSaveAndView();
taggablePage = new TaggablePage();
Assert.assertTrue(taggablePage.hasTag(tag1));
Assert.assertTrue(taggablePage.hasTag(tag2));
}
use of org.xwiki.tag.test.po.TaggablePage in project xwiki-platform by xwiki.
the class AddRemoveTagsTest method testAddTagContainingPipe.
/**
* Add a tag that contains the pipe character, which is used to separate stored tags.
*/
@Test
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177")
public void testAddTagContainingPipe() {
String tag = RandomStringUtils.randomAlphanumeric(3) + "|" + RandomStringUtils.randomAlphanumeric(3);
Assert.assertFalse(taggablePage.hasTag(tag));
AddTagsPane addTagsPane = taggablePage.addTags();
addTagsPane.setTags(tag);
Assert.assertTrue(addTagsPane.add());
Assert.assertTrue(taggablePage.hasTag(tag));
// Reload the page and test again.
getUtil().gotoPage(getTestClassName(), getTestMethodName());
taggablePage = new TaggablePage();
Assert.assertTrue(taggablePage.hasTag(tag));
}
use of org.xwiki.tag.test.po.TaggablePage in project xwiki-platform by xwiki.
the class AddRemoveTagsTest method setUp.
@Before
public void setUp() throws Exception {
// Create a new test page.
getUtil().rest().deletePage(getTestClassName(), getTestMethodName());
getUtil().createPage(getTestClassName(), getTestMethodName(), null, null);
taggablePage = new TaggablePage();
}
Aggregations