Package org.xwiki.appwithinminutes.test.po

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


     * @return the in-line edit mode for the new document
     */
    public EntryEditPage clickCreateDocumentButton()
    {
        createDocumentButton.click();
        return new EntryEditPage();
    }
View Full Code Here


        userPicker.sendKeys("thomas").waitForSuggestions().sendKeys(Keys.ENTER);
        editor.clickSaveAndView();

        // Create the application entry.
        ClassSheetPage classSheetPage = new ClassSheetPage();
        EntryEditPage entryEditPage =
            classSheetPage.createNewDocument(getTestClassName(), getTestMethodName() + "Entry");

        // Assert the initial value.
        String id = getTestClassName() + "." + getTestMethodName() + "_0_user1";
        userPicker = new UserPicker(getDriver().findElement(By.id(id)));
        List<UserElement> selectedUsers = userPicker.waitToLoad().getAcceptedSuggestions();
        Assert.assertEquals(1, selectedUsers.size());
        assertUserElement(selectedUsers.get(0), "Thomas Mortagne");
        Assert.assertEquals("", userPicker.getValue());

        // Change the selected user.
        userPicker.sendKeys("eduard").waitForSuggestions().sendKeys(Keys.ENTER).waitForSuggestionsToFadeOut();
        // We wait for the page to load because Selenium doesn't do it all the time when Save & View is clicked.
        entryEditPage.clickSaveAndView().waitUntilPageIsLoaded();

        // Assert the view mode.
        List<WebElement> users = getDriver().findElements(By.className("user"));
        Assert.assertEquals(1, users.size());
        assertUserElement(new UserElement(users.get(0)), "Eduard Moraru", "Enygma2002");
View Full Code Here

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

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

        // Assert the new field is displayed in the edit sheet (field name was auto-generated).
        // Apparently WebElement#getText() takes into account the text-transform CSS property.
        Assert.assertEquals("POPULATION SIZE", entryEditPage.getLabel("number1"));

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

        // Assert both entries are displayed in the live table.
        entriesLiveTable = homePage.getEntriesLiveTable();
        entriesLiveTable.waitUntilReady();
View Full Code Here

        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.
View Full Code Here

        // Save and edit the class template in in-line edit mode.
        editor.clickSaveAndView();
        new ClassSheetPage().clickTemplateLink().edit();

        // Assert the order of the form fields.
        List<String> fieldNames = new EntryEditPage().getFieldNames();
        Assert.assertEquals("date1", fieldNames.get(0));
        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");

        // Save and edit the class template again.
        editor.clickSaveAndView();
        new ClassSheetPage().clickTemplateLink().edit();

        // Assert the order of the form fields.
        fieldNames = new EntryEditPage().getFieldNames();
        Assert.assertEquals("date2", fieldNames.get(0));
        Assert.assertEquals("date1", fieldNames.get(1));
    }
View Full Code Here

        // Save and edit the class template.
        editor.clickSaveAndView();
        new ClassSheetPage().clickTemplateLink().edit();

        // Change the field value.
        EntryEditPage inlineEditor = new EntryEditPage();
        Assert.assertEquals("13", inlineEditor.getValue("number1"));
        inlineEditor.setValue("number1", "27");

        // 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

        // Save and edit the template.
        editor.clickSaveAndView();
        new ClassSheetPage().clickTemplateLink().edit();

        // The sheet should display only the first field.
        EntryEditPage inlineEditor = new EntryEditPage();
        List<String> fieldNames = inlineEditor.getFieldNames();
        Assert.assertEquals(1, fieldNames.size());
        Assert.assertEquals("number1", fieldNames.get(0));

        // Assert the value of the first field. The class template should have been updated.
        Assert.assertEquals("9", inlineEditor.getValue("number1"));
    }
View Full Code Here

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

    public void testEntryNameWithURLSpecialCharacters()
    {
        EntryNamePane entryNamePane = homePage.clickAddNewEntry();
        String entryName = "A?b=c&d#" + RandomStringUtils.randomAlphanumeric(3);
        entryNamePane.setName(entryName);
        EntryEditPage entryEditPage = entryNamePane.clickAdd();
        entryEditPage.setValue("description", "This is a test panel.");
        entryEditPage.clickSaveAndView();

        getUtil().gotoPage(getTestClassName(), getTestMethodName());
        homePage = new ApplicationHomePage();
        LiveTableElement entriesLiveTable = homePage.getEntriesLiveTable();
        entriesLiveTable.waitUntilReady();
View Full Code Here

        homeEditPage.addLiveTableColumn("Static List");

        // Add first entry.
        EntryNamePane entryNamePane = homeEditPage.clickFinish().clickAddNewEntry();
        entryNamePane.setName("Foo");
        EntryEditPage entryEditPage = entryNamePane.clickAdd();
        entryEditPage.setValue("staticList1", "value1");
        entryEditPage.clickSaveAndView().clickBreadcrumbLink(appName + " Home");

        // Add second entry.
        entryNamePane = new ApplicationHomePage().clickAddNewEntry();
        entryNamePane.setName("Bar");
        entryEditPage = entryNamePane.clickAdd();
        entryEditPage.setValue("staticList1", "value2");
        entryEditPage.clickSaveAndView().clickBreadcrumbLink(appName + " Home");

        // Filter the Static List column of the live table.
        LiveTableElement liveTable = new ApplicationHomePage().getEntriesLiveTable();
        liveTable.waitUntilReady();
        Assert.assertEquals(2, liveTable.getRowCount());
View Full Code Here

TOP

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

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.