Package org.xwiki.appwithinminutes.test.po

Examples of org.xwiki.appwithinminutes.test.po.ClassFieldEditPane


        ApplicationsLiveTableElement appsLiveTable = homePage.getAppsLiveTable();
        appsLiveTable.waitUntilReady();
        ApplicationClassEditPage classEditor = appsLiveTable.clickEditApplication(appName);

        // Edit the existing class field.
        ClassFieldEditPane fieldEditPane = new ClassFieldEditPane("shortText1");
        fieldEditPane.setPrettyName("City Name");
        fieldEditPane.openConfigPanel();
        fieldEditPane.setName("cityName");

        // Move to the next step.
        ApplicationHomeEditPage homeEditPage = classEditor.clickNextStep();
        homeEditPage.setDescription("demo");
View Full Code Here


        // Move to the next step.
        ApplicationClassEditPage classEditPage = appCreatePage.clickNextStep();

        // Step 2
        // Add a 'Short Text' field.
        ClassFieldEditPane fieldEditPane = classEditPage.addField("Short Text");

        // Set the field pretty name and default value
        fieldEditPane.setPrettyName("City Name");
        fieldEditPane.setDefaultValue("Paris");

        // Move to the next step.
        ApplicationHomeEditPage homeEditPage = classEditPage.clickNextStep().waitUntilPageIsLoaded();

        // Move back to the second step.
        classEditPage = homeEditPage.clickPreviousStep();

        // Open the configuration panel and set the field name
        fieldEditPane = new ClassFieldEditPane("shortText1");
        fieldEditPane.openConfigPanel();
        fieldEditPane.setName("cityName");

        // Move to the next step.
        homeEditPage = classEditPage.clickNextStep();

        // Step 3
        // Enter the application description.
        String appDescription = "Simple application to manage data about various cities";
        homeEditPage.setDescription(appDescription);

        // Add the Short Text field from the previous step to the list of columns.
        homeEditPage.addLiveTableColumn("City Name");

        // Click the finish button which should lead us to the application home page.
        ApplicationHomePage homePage = homeEditPage.clickFinish();

        // Assert the application description is present.
        Assert.assertTrue(homePage.getContent().contains(appDescription));

        // Add a new entry.
        String firstEntryName = RandomStringUtils.randomAlphanumeric(6);
        EntryNamePane entryNamePane = homePage.clickAddNewEntry();
        entryNamePane.setName(firstEntryName);
        EntryEditPage entryEditPage = entryNamePane.clickAdd();

        // Assert the pretty name and the default value of the Short Text field.
        // Apparently WebElement#getText() takes into account the text-transform CSS property.
        Assert.assertEquals("CITY NAME", entryEditPage.getLabel("cityName"));
        Assert.assertEquals("Paris", entryEditPage.getValue("cityName"));

        // Change the field value.
        entryEditPage.setValue("cityName", "London");

        // Save and go back to the application home page.
        String appHomePageTitle = appName + " Home";
        entryEditPage.clickSaveAndView().clickBreadcrumbLink(appHomePageTitle);
        homePage = new ApplicationHomePage();

        // Assert the entry we have just created is listed in the live table.
        LiveTableElement entriesLiveTable = homePage.getEntriesLiveTable();
        entriesLiveTable.waitUntilReady();
        Assert.assertTrue(entriesLiveTable.hasRow("City Name", "London"));

        // Assert that the application space index lists only the home page and the entry we have just created. The rest
        // of the documents (class, template, sheet, preferences) should be marked as hidden.
        LiveTableElement appSpaceIndexLiveTable = SpaceIndexPage.gotoPage(appName).getLiveTable();
        appSpaceIndexLiveTable.waitUntilReady();
        Assert.assertEquals(2, appSpaceIndexLiveTable.getRowCount());
        Assert.assertTrue(appSpaceIndexLiveTable.hasRow("Page", "WebHome"));
        Assert.assertTrue(appSpaceIndexLiveTable.hasRow("Page", firstEntryName));

        // Go back to the application home page.
        getDriver().navigate().back();

        // Click the edit button.
        homePage.edit();
        homeEditPage = new ApplicationHomeEditPage();

        // Change the application description.
        appDescription = "The best app!";
        homeEditPage.setDescription(appDescription);

        // Remove one of the live table columns.
        homeEditPage.removeLiveTableColumn("Actions");

        // Save
        homePage = homeEditPage.clickSaveAndView();

        // Assert that the application description has changed and that the column has been removed.
        Assert.assertTrue(homePage.getContent().contains(appDescription));
        entriesLiveTable = homePage.getEntriesLiveTable();
        entriesLiveTable.waitUntilReady();
        Assert.assertFalse(entriesLiveTable.hasColumn("Actions"));

        // Click the link to edit the application.
        classEditPage = homePage.clickEditApplication();

        // Drag a Number field.
        fieldEditPane = classEditPage.addField("Number");

        // Set the field pretty name.
        fieldEditPane.setPrettyName("Population Size");

        // Fast forward.
        homeEditPage = classEditPage.clickNextStep();
        // Just wait for the WYSIWYG editor (which is used for setting the application description) to load so that the
        // page layout is stable before we click on the Finish button.
View Full Code Here

        appCreatePage.setApplicationName(appName);
        appCreatePage.waitForApplicationNamePreview();
        ApplicationClassEditPage classEditPage = appCreatePage.clickNextStep();

        // Add a standard field.
        ClassFieldEditPane numberField = classEditPage.addField("Number");

        // Add the Title and Content fields.
        ClassFieldEditPane titleField = classEditPage.addField("Title");
        ClassFieldEditPane contentField = classEditPage.addField("Content");

        // Change the default field pretty names.
        // See XWIKI-9154: The application live table uses the standard 'Page title' heading instead of the pretty name
        // set for the Title field
        titleField.setPrettyName("My Title");
        contentField.setPrettyName("My Content");

        // Set the default values that will be saved in the template.
        numberField.setDefaultValue("13");
        String defaultTitle = "Enter title here";
        titleField.setDefaultValue(defaultTitle);
        String defaultContent = "Enter content here";
        contentField.setDefaultValue(defaultContent);

        // Add live table columns for Title and Content.
        ApplicationHomeEditPage homeEditPage = classEditPage.clickNextStep().waitUntilPageIsLoaded();
        homeEditPage.addLiveTableColumn("My Title");
        homeEditPage.addLiveTableColumn("My Content");

        // Add an application entry.
        EntryNamePane entryNamePane = homeEditPage.clickFinish().clickAddNewEntry();
        entryNamePane.setName("Test");
        EntryEditPage entryEditPage = entryNamePane.clickAdd();
        RichTextAreaElement contentTextArea = entryEditPage.getContentEditor().waitToLoad().getRichTextArea();
        Assert.assertEquals("13", entryEditPage.getValue("number1"));
        Assert.assertEquals(defaultTitle, entryEditPage.getDocumentTitle());
        Assert.assertEquals(defaultTitle, entryEditPage.getTitle());
        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());
        Assert.assertTrue(liveTable.hasRow("My Title", "Foo"));
        Assert.assertTrue(liveTable.hasRow("My Content", "Bar"));

        // Check that the title and the content of the class have not been changed.
        getUtil().gotoPage(appName + "Code", appName + "Class", "edit", "editor=wiki");
        WikiEditPage editPage = new WikiEditPage();
        Assert.assertEquals(appName + " Class", editPage.getTitle());
        Assert.assertEquals("", editPage.getContent());

        // Now edit the class and check if the default values for title and content are taken from the template.
        editPage.editInline();
        Assert.assertEquals(defaultTitle, new ClassFieldEditPane("title1").getDefaultValue());
        Assert.assertEquals(defaultContent, new ClassFieldEditPane("content1").getDefaultValue());
    }
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 testEmptyCanvasHint()
    {
        Assert.assertTrue(editor.getContent().contains(EMPTY_CANVAS_HINT));
        ClassFieldEditPane field = editor.addField("Short Text");
        Assert.assertFalse(editor.getContent().contains(EMPTY_CANVAS_HINT));
        field.delete().clickYes();
        Assert.assertTrue(editor.getContent().contains(EMPTY_CANVAS_HINT));
    }
View Full Code Here

        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)"));
View Full Code Here

        // Save and edit again the class.
        inlineEditor.clickSaveAndView().clickBreadcrumbLink(getTestMethodName() + " Class").edit();

        // Rename the class field.
        ClassFieldEditPane field = new ClassFieldEditPane("number1");
        field.openConfigPanel();
        field.setName("age");

        // Save and edit again the class template.
        new ApplicationClassEditPage().clickSaveAndView();
        new ClassSheetPage().clickTemplateLink().edit();
        Assert.assertEquals("27", new EntryEditPage().getValue("age"));
View Full Code Here

    @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See http://jira.xwiki.org/browse/XE-1177")})
    public void testInvalidFieldName()
    {
        String invalidFieldNameErrorMessage = "Property names must follow these naming rules:";

        ClassFieldEditPane field = editor.addField("Static List");
        field.openConfigPanel();
        field.setName("3times");
        // Save the page and expect the error.
        editor.getSaveAndViewButton().click();
        waitForPageSourceContains(invalidFieldNameErrorMessage);

        getDriver().navigate().back();
        editor = new ApplicationClassEditPage();
        field = editor.addField("User");
        field.openConfigPanel();
        // Unfortunately we don't allow Unicode letters because they are not fully supported in tag names.
        // See XWIKI-7306: The class editor doesn't validate properly the field names
        field.setName("\u021Bar\u0103");
        // Save the page and expect the error.
        editor.getSaveAndViewButton().click();
        waitForPageSourceContains(invalidFieldNameErrorMessage);

        getDriver().navigate().back();
        editor = new ApplicationClassEditPage();
        field = editor.addField("Group");
        field.openConfigPanel();
        field.setName("alice>bob");
        // Save the page and expect the error.
        editor.getSaveAndViewButton().click();
        waitForPageSourceContains(invalidFieldNameErrorMessage);
    }
View Full Code Here

    @IgnoreBrowsers({
    @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 testDuplicateFieldName()
    {
        ClassFieldEditPane field = editor.addField("Short Text");
        field.setPrettyName("Alice");
        field.openConfigPanel();
        field.setName("carol");

        field = editor.addField("Short Text");
        field.setPrettyName("Bob");
        field.openConfigPanel();
        field.setName("carol");

        // Save the page and expect the error.
        editor.getSaveAndViewButton().click();
        waitForPageSourceContains("The class has two fields with the same name: carol");
    }
View Full Code Here

    @IgnoreBrowsers({
    @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 testSwapFieldNames()
    {
        ClassFieldEditPane field = editor.addField("Short Text");
        field.openConfigPanel();
        field.setName("alice");

        field = editor.addField("Number");
        field.openConfigPanel();
        field.setName("bob");

        editor.clickSaveAndView().edit();
        editor = new ApplicationClassEditPage();

        field = new ClassFieldEditPane("alice");
        field.openConfigPanel();
        field.setName("bob");

        field = new ClassFieldEditPane("bob");
        field.openConfigPanel();
        field.setName("alice");

        // Save the page and expect the error.
        editor.getSaveAndViewButton().click();
        waitForPageSourceContains("The class has two fields with the same name: alice");
    }
View Full Code Here

        // Save and edit again.
        editor.clickSaveAndView().edit();
        editor = new ApplicationClassEditPage();

        // Set default value for the previously added field.
        new ClassFieldEditPane("number1").setDefaultValue("9");

        // Add a new field
        editor.addField("Database List");

        // The options panel should be displayed now.
View Full Code Here

TOP

Related Classes of org.xwiki.appwithinminutes.test.po.ClassFieldEditPane

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.