Package org.xwiki.appwithinminutes.test.po

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


        super.setUp();

        getUtil().deleteSpace(getTestClassName());
        getUtil().gotoPage(getTestClassName(), getTestMethodName(), "edit",
            "editor=inline&template=AppWithinMinutes.ClassTemplate&title=" + getTestMethodName() + " Class");
        editor = new ApplicationClassEditPage();
    }
View Full Code Here


        // Wait for the preview.
        appCreatePage.waitForApplicationNamePreview();

        // 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.
        homeEditPage.setDescription(appDescription);
        homePage = homeEditPage.clickFinish();
View Full Code Here

        String appName = RandomStringUtils.randomAlphabetic(6);
        appCreatePage.setApplicationName(appName);
        appCreatePage.waitForApplicationNamePreview();

        // Step 2
        ApplicationClassEditPage classEditPage = appCreatePage.clickNextStep();
        classEditPage.addField("Short Text");

        // Back to Step 1
        appCreatePage = classEditPage.clickPreviousStep();
        appCreatePage.setApplicationName(appName);
        appCreatePage.waitForApplicationNamePreview();
        // Test that the application wasn't created.
        Assert.assertFalse(appCreatePage.getContent().contains(ApplicationNameTest.APP_NAME_USED_WARNING_MESSAGE));

        // Step 2 again
        classEditPage = appCreatePage.clickNextStep();
        Assert.assertTrue(classEditPage.getContent().contains(ClassEditorTest.EMPTY_CANVAS_HINT));
        classEditPage.addField("Number");

        // Step 3 and back to Step 2
        classEditPage = classEditPage.clickNextStep().waitUntilPageIsLoaded().clickPreviousStep();
        Assert.assertFalse(classEditPage.getContent().contains(ClassEditorTest.EMPTY_CANVAS_HINT));
        Assert.assertFalse(classEditPage.hasPreviousStep());
    }
View Full Code Here

        createApplication(appName);

        // Edit the application.
        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");

        // Finish editing.
        ApplicationHomePage homePage = homeEditPage.clickFinish();
        Assert.assertTrue(homePage.getContent().contains("demo"));
View Full Code Here

    private void createApplication(String appName)
    {
        ApplicationCreatePage appCreatePage = homePage.clickCreateApplication();
        appCreatePage.setApplicationName(appName);
        appCreatePage.waitForApplicationNamePreview();
        ApplicationClassEditPage classEditPage = appCreatePage.clickNextStep();
        classEditPage.addField("Short Text");
        // Wait for the application home edit page to load before clicking finish to be sure the page layout is stable.
        classEditPage.clickNextStep().waitUntilPageIsLoaded().clickFinish()
            .clickBreadcrumbLink(AppWithinMinutesHomePage.TITLE);
        homePage = new AppWithinMinutesHomePage();
    }
View Full Code Here

        // Create a new application.
        String appName = RandomStringUtils.randomAlphabetic(6);
        ApplicationCreatePage appCreatePage = ApplicationCreatePage.gotoPage();
        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();
View Full Code Here

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

        // 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");

        // Save and edit the class template again.
View Full Code Here

        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

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

TOP

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

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.