Package org.xwiki.appwithinminutes.test.po

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


    }

    @Test
    public void testSuggestions()
    {
        UserPicker userPicker = new UserClassFieldEditPane(editor.addField("User").getName()).getUserPicker();

        // The suggestions should be case-insensitive. Match the last name.
        List<UserElement> suggestions = userPicker.sendKeys("mOr").waitForSuggestions().getSuggestions();
        Assert.assertEquals(2, suggestions.size());
        assertUserElement(suggestions.get(0), "Eduard Moraru", "Enygma2002");
View Full Code Here


    }

    @Test
    public void testSingleSelection()
    {
        UserPicker userPicker = new UserClassFieldEditPane(editor.addField("User").getName()).getUserPicker();

        // Use the keyboard.
        userPicker.sendKeys("mor").waitForSuggestions().sendKeys(Keys.ARROW_DOWN, Keys.ARROW_DOWN, Keys.ENTER);
        List<UserElement> selectedUsers = userPicker.waitForSuggestionsToFadeOut().getAcceptedSuggestions();
        Assert.assertEquals(1, selectedUsers.size());
View Full Code Here

    }

    @Test
    public void testMultipleSelection()
    {
        UserClassFieldEditPane userField = new UserClassFieldEditPane(editor.addField("User").getName());
        userField.openConfigPanel();
        userField.setMultipleSelect(true);
        userField.closeConfigPanel();
        UserPicker userPicker = userField.getUserPicker();

        // Select 2 users.
        userPicker.sendKeys("tmortagne").waitForSuggestions().sendKeys(Keys.ENTER).waitForSuggestionsToFadeOut();
        Assert.assertFalse(userPicker.getClearSelectionLink().isDisplayed());
        userPicker.sendKeys("2002").waitForSuggestions().select("Enygma").waitForSuggestionsToFadeOut();
View Full Code Here

    }

    @Test
    public void testSaveAndInitialSelection()
    {
        UserPicker userPicker = new UserClassFieldEditPane(editor.addField("User").getName()).getUserPicker();
        userPicker.sendKeys("thomas").waitForSuggestions().sendKeys(Keys.ENTER);
        editor.clickSaveAndView().edit();

        UserClassFieldEditPane userField = new UserClassFieldEditPane("user1");
        userPicker = userField.getUserPicker().waitToLoad();
        List<UserElement> selectedUsers = userPicker.getAcceptedSuggestions();
        Assert.assertEquals(1, selectedUsers.size());
        assertUserElement(selectedUsers.get(0), "Thomas Mortagne");
        Assert.assertEquals("", userPicker.getValue());

        // Enable multiple selection.
        userField.openConfigPanel();
        userField.setMultipleSelect(true);
        userField.closeConfigPanel();

        // Re-take the user picker because the display has been reloaded.
        userPicker = userField.getUserPicker();

        // Select one more user.
        userPicker.waitToLoad().sendKeys("admin").waitForSuggestions().sendKeys(Keys.ENTER);
        editor.clickSaveAndContinue();
        editor.clickCancel().edit();

        userPicker = new UserClassFieldEditPane("user1").getUserPicker().waitToLoad();
        selectedUsers = userPicker.getAcceptedSuggestions();
        Assert.assertEquals(2, selectedUsers.size());
        assertUserElement(selectedUsers.get(0), "Thomas Mortagne");
        assertUserElement(selectedUsers.get(1), "Administrator", "Admin", "noavatar.png");
        Assert.assertEquals("", userPicker.getValue());

        // We should be able to input free text also.
        userPicker.sendKeys("foobar").waitForSuggestions().sendKeys(Keys.ESCAPE).waitForSuggestionsToFadeOut();
        editor.clickSaveAndContinue();
        editor.clickCancel().edit();

        userPicker = new UserClassFieldEditPane("user1").getUserPicker().waitToLoad();
        selectedUsers = userPicker.getAcceptedSuggestions();
        Assert.assertEquals(3, selectedUsers.size());
        assertUserElement(selectedUsers.get(2), "foobar", "foobar", "noavatar.png");
        Assert.assertEquals("", userPicker.getValue());

        // Delete the fake user.
        selectedUsers.get(2).delete();
        Assert.assertEquals(2, userPicker.getAcceptedSuggestions().size());

        // Delete all selected users.
        userPicker.getClearSelectionLink().click();
        editor.clickSaveAndContinue();
        editor.clickCancel().edit();

        userPicker = new UserClassFieldEditPane("user1").getUserPicker().waitToLoad();
        Assert.assertEquals(0, userPicker.getAcceptedSuggestions().size());
        Assert.assertEquals("", userPicker.getValue());
    }
View Full Code Here

    @Test
    public void testApplicationEntry()
    {
        // Create the application class.
        UserPicker userPicker = new UserClassFieldEditPane(editor.addField("User").getName()).getUserPicker();
        userPicker.sendKeys("thomas").waitForSuggestions().sendKeys(Keys.ENTER);
        editor.clickSaveAndView();

        // Create the application entry.
        ClassSheetPage classSheetPage = new ClassSheetPage();
View Full Code Here

TOP

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

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.