Package org.xwiki.test.ui.po

Examples of org.xwiki.test.ui.po.ViewPage


    @Before
    public void setUp() throws Exception
    {
        super.setUp();
        getUtil().deletePage(getTestClassName(), getTestMethodName());
        ViewPage vp = getUtil().createPage(getTestClassName(), getTestMethodName(), CONTENT, TITLE);
        this.commentsTab = vp.openCommentsDocExtraPane();
    }
View Full Code Here


    public void testPostCommentAsAdminNoJs()
    {
        // In this test class, the only user who logs in is admin.
        getUtil().gotoPage(getTestClassName(), getTestMethodName(), "view", "xpage=xpart&vm=commentsinline.vm");
        this.commentsTab.postComment(COMMENT_CONTENT, false);
        ViewPage vp = new ViewPage();
        // This opens with ?viewer=comments, don't explicitly load the comments tab
        vp.waitUntilPageIsLoaded();
        Assert.assertEquals(COMMENT_CONTENT,
            this.commentsTab.getCommentContentByID(this.commentsTab.getCommentID(COMMENT_CONTENT)));
        Assert.assertEquals(ADMIN,
            this.commentsTab.getCommentAuthorByID(this.commentsTab.getCommentID(COMMENT_CONTENT)));
    }
View Full Code Here

        entryEditPage.setTitle("Foo");
        Assert.assertEquals(defaultContent, contentTextArea.getText());
        contentTextArea.setContent("Bar");

        // Check that the title and the content of the entry have been updated.
        ViewPage entryViewPage = entryEditPage.clickSaveAndView();
        Assert.assertEquals("Foo", entryViewPage.getDocumentTitle());
        Assert.assertTrue(entryViewPage.getContent().contains("Bar"));
        entryViewPage.clickBreadcrumbLink(appName + " Home");

        // Check the entries live table.
        LiveTableElement liveTable = new ApplicationHomePage().getEntriesLiveTable();
        liveTable.waitUntilReady();
        Assert.assertEquals(1, liveTable.getRowCount());
View Full Code Here

    public void testJavascriptExtension()
    {
        // Create a doc
        WikiEditPage wep = WikiEditPage.gotoPage("Test", "SkinxTest");
        wep.setContent("this is the content");
        ViewPage vp = wep.clickSaveAndView();

        // Add an XWikiGroups object
        ObjectEditPage oep = vp.editObjects();
        FormElement objectForm = oep.addObject("XWiki.JavaScriptExtension");
        objectForm.setFieldValue(By.id("XWiki.JavaScriptExtension_0_code"), SCRIPT);
        objectForm.getSelectElement(By.id("XWiki.JavaScriptExtension_0_use")).select("always");
        oep.clickSaveAndView();
        waitForScriptResult();
View Full Code Here

    @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason="See http://jira.xwiki.org/browse/XE-1146"),
    @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason="See http://jira.xwiki.org/browse/XE-1177")
    })
    public void testKeyboardShortcuts()
    {
        ViewPage vp = util.gotoPage("Sandbox", "WebHome");

        // Test default edit mode (WYSIWYG for Sandbox.WebHome) key
        vp.sendKeys("e");

        // Test Cancel key
        vp.sendKeys(Keys.chord(Keys.ALT, "c"));
        vp.waitUntilPageIsLoaded();
        Assert.assertTrue(util.isInViewMode());

        // Test Wiki edit key
        vp.sendKeys("k");
        vp.waitUntilPageIsLoaded();
        Assert.assertTrue(util.isInWikiEditMode());

        // Test WYSIWYG edit mode key
        vp = this.util.gotoPage("Sandbox", "WebHome");
        vp.sendKeys("g");

        // Test Inline Form edit mode key
        vp = this.util.gotoPage("Sandbox", "WebHome");
        vp.sendKeys("f");
        vp.waitUntilPageIsLoaded();
        Assert.assertTrue(util.isInInlineEditMode());

        // Test Rights edit mode key
        vp = this.util.gotoPage("Sandbox", "WebHome");
        vp.sendKeys("r");
        vp.waitUntilPageIsLoaded();
        Assert.assertTrue(util.isInRightsEditMode());

        // Test Object edit mode key
        vp = this.util.gotoPage("Sandbox", "WebHome");
        vp.sendKeys("o");
        vp.waitUntilPageIsLoaded();
        Assert.assertTrue(util.isInObjectEditMode());

        // Test Class edit mode key
        vp = this.util.gotoPage("Sandbox", "WebHome");
        vp.sendKeys("s");
        vp.waitUntilPageIsLoaded();
        Assert.assertTrue(util.isInClassEditMode());

        // Test Delete key
        vp = this.util.gotoPage("Sandbox", "WebHome");
        vp.sendKeys(Keys.DELETE);
        vp.waitUntilPageIsLoaded();
        Assert.assertTrue(util.isInDeleteMode());

        // Test Rename key
        vp = this.util.gotoPage("Sandbox", "WebHome");
        vp.sendKeys(Keys.F2);
        vp.waitUntilPageIsLoaded();
        Assert.assertTrue(util.isInRenameMode());

        // Test View Source key
        vp = this.util.gotoPage("Sandbox", "WebHome");
        vp.sendKeys("d");
        vp.waitUntilPageIsLoaded();
        Assert.assertTrue(util.isInSourceViewMode());
    }
View Full Code Here

        // Add two fields.
        editor.addField("Boolean").setPrettyName("Available");
        editor.addField("Date").setPrettyName("Day");

        // Save and assert they are present.
        ViewPage classView = editor.clickSaveAndView();
        Assert.assertTrue(classView.getContent().contains("Available (boolean1: Boolean)"));
        Assert.assertTrue(classView.getContent().contains("Day (date1: Date)"));

        // Edit again and delete one of the fields.
        classView.edit();
        new ClassFieldEditPane("boolean1").delete().clickYes();

        // Save and check if the field was removed.
        classView = new ApplicationClassEditPage().clickSaveAndView();
        Assert.assertFalse(classView.getContent().contains("Available (boolean1: Boolean)"));
        Assert.assertTrue(classView.getContent().contains("Day (date1: Date)"));

        // Edit the class template and see if the deleted field is now deprecated.
        ObjectEditPage objectEditor = new ClassSheetPage().clickTemplateLink().editObjects();
        String className = String.format("%s.%s", getTestClassName(), getTestMethodName());
        Assert.assertTrue(objectEditor.isPropertyDeprecated(className, "boolean1"));
View Full Code Here

        Assert.assertEquals("date2", fieldNames.get(1));

        // Go back to the class editor.
        getDriver().navigate().back();
        getDriver().navigate().back();
        new ViewPage().edit();
        editor = new ApplicationClassEditPage();

        // Change the order of the class fields.
        editor.moveFieldBefore("date2", "date1");
View Full Code Here

    {
        editor.addField("Date");
        editor.clickSaveAndContinue();

        // Check if the field was added.
        ViewPage viewer = editor.clickCancel();
        Assert.assertTrue(viewer.getContent().contains("Date (date1: Date)"));

        // Edit again. This time check the error message.
        viewer.edit();
        editor = new ApplicationClassEditPage();

        // Try to set the field name to an invalid value.
        ClassFieldEditPane field = new ClassFieldEditPane("date1");
        field.openConfigPanel();
View Full Code Here

        field = editor.addField("Number");
        field.openConfigPanel();
        Assert.assertEquals("number2", field.getName());

        // Save and assert both fields have been added.
        ViewPage viewer = editor.clickSaveAndView();
        Assert.assertTrue(viewer.getContent().contains("Short Text (number1: String)"));
        Assert.assertTrue(viewer.getContent().contains("Number (number2: Number)"));
    }
View Full Code Here

        Assert.assertTrue(classSheetPage.hasProperty("color", "Your favorite color", "String"));
        Assert.assertTrue(classSheetPage.hasProperty("age", "Your current age", "Number"));

        // Create and bind a sheet.
        classSheetPage = classSheetPage.clickCreateSheetButton().clickBindSheetLink();
        ViewPage sheetPage = classSheetPage.clickSheetLink();
        Assert.assertEquals(className + " Sheet", sheetPage.getDocumentTitle());
        sheetPage.clickBreadcrumbLink(classTitle);

        // Create the template.
        classSheetPage = classSheetPage.clickCreateTemplateButton().clickAddObjectToTemplateLink();
        ViewPage templatePage = classSheetPage.clickTemplateLink();
        Assert.assertEquals(className + " Template", templatePage.getDocumentTitle());
        // The default edit button should take us to the In-line edit mode.
        templatePage.edit();
        EntryEditPage editPage = new EntryEditPage();
        editPage.setValue("color", "red");
        editPage.setValue("age", "13");
        editPage.clickSaveAndContinue();
        editPage.clickBreadcrumbLink(classTitle);

        // Create a document based on the class template.
        Assert.assertEquals(spaceName, classSheetPage.getSpaceNameInput().getAttribute("value"));
        editPage = classSheetPage.createNewDocument(spaceName, pageName);

        Assert.assertEquals(pageName, editPage.getDocumentTitle());
        Assert.assertEquals("red", editPage.getValue("color"));
        Assert.assertEquals("13", editPage.getValue("age"));

        editPage.setValue("color", "blue");
        editPage.setValue("age", "27");
        ViewPage viewPage = editPage.clickSaveAndView();

        Assert.assertEquals(pageName, viewPage.getDocumentTitle());
        Assert.assertEquals("Your favorite color\nblue\nYour current age\n27", viewPage.getContent());
        viewPage.clickBreadcrumbLink(classTitle);

        // Assert the created document is listed.
        Assert.assertTrue(classSheetPage.hasDocument(pageName));
    }
View Full Code Here

TOP

Related Classes of org.xwiki.test.ui.po.ViewPage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.