Package org.xwiki.test.ui.po.editor

Examples of org.xwiki.test.ui.po.editor.UserPicker.sendKeys()


    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");
        assertUserElement(suggestions.get(1), "Thomas Mortagne");

        // Match the first name.
View Full Code Here


        Assert.assertEquals(2, suggestions.size());
        assertUserElement(suggestions.get(0), "Eduard Moraru", "Enygma2002");
        assertUserElement(suggestions.get(1), "Thomas Mortagne");

        // Match the first name.
        suggestions = userPicker.sendKeys(Keys.BACK_SPACE, Keys.BACK_SPACE, "As").waitForSuggestions().getSuggestions();
        Assert.assertEquals(1, suggestions.size());
        assertUserElement(suggestions.get(0), "Thomas Mortagne");

        // Match the alias.
        suggestions = userPicker.sendKeys(Keys.BACK_SPACE, "20").waitForSuggestions().getSuggestions();
View Full Code Here

        suggestions = userPicker.sendKeys(Keys.BACK_SPACE, Keys.BACK_SPACE, "As").waitForSuggestions().getSuggestions();
        Assert.assertEquals(1, suggestions.size());
        assertUserElement(suggestions.get(0), "Thomas Mortagne");

        // Match the alias.
        suggestions = userPicker.sendKeys(Keys.BACK_SPACE, "20").waitForSuggestions().getSuggestions();
        Assert.assertEquals(1, suggestions.size());
        assertUserElement(suggestions.get(0), "Eduard Moraru", "Enygma2002");

        // The guest user shouldn't be suggested.
        suggestions = userPicker.clear().sendKeys("guest").waitForSuggestions().getSuggestions();
View Full Code Here

        // "a" should bring many suggestions. Also, a single letter should bring suggestions.
        Assert.assertTrue(userPicker.clear().sendKeys("a").waitForSuggestions().getSuggestions().size() > 2);

        // An empty text input shouldn't bring any suggestions.
        try {
            userPicker.sendKeys(Keys.BACK_SPACE).waitForSuggestions();
            Assert.fail();
        } catch (Exception e) {
        }

        // We should be able to close the list of suggestions using the escape key.
View Full Code Here

            Assert.fail();
        } catch (Exception e) {
        }

        // We should be able to close the list of suggestions using the escape key.
        userPicker.sendKeys("mor").waitForSuggestions().sendKeys(Keys.ESCAPE).waitForSuggestionsToFadeOut();

        // The list of suggestions should close itself after a while.
        userPicker.moveMouseOver().sendKeys(Keys.BACK_SPACE).waitForSuggestions().waitForSuggestionsToDisappear();

        // The list of suggestions should stay open if the mouse is over it.
View Full Code Here

        // The list of suggestions should close itself after a while.
        userPicker.moveMouseOver().sendKeys(Keys.BACK_SPACE).waitForSuggestions().waitForSuggestionsToDisappear();

        // The list of suggestions should stay open if the mouse is over it.
        userPicker.sendKeys(Keys.BACK_SPACE).waitForSuggestions().getSuggestions().get(0).moveMouseOver();
        try {
            userPicker.waitForSuggestionsToDisappear();
            Assert.fail();
        } catch (Exception e) {
        }
View Full Code Here

    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());
        assertUserElement(selectedUsers.get(0), "Thomas Mortagne");
        Assert.assertEquals("", userPicker.getValue());
        // The link to clear the list of selected users should be displayed if at least 2 users are selected.
View Full Code Here

        Assert.assertEquals("", userPicker.getValue());
        // The link to clear the list of selected users should be displayed if at least 2 users are selected.
        Assert.assertFalse(userPicker.getClearSelectionLink().isDisplayed());

        // Use the mouse. Since we have single selection by default, the previously selected user should be replaced.
        userPicker.sendKeys("mor").waitForSuggestions().select("Enygma2002");
        selectedUsers = userPicker.waitForSuggestionsToFadeOut().getAcceptedSuggestions();
        Assert.assertEquals(1, selectedUsers.size());
        assertUserElement(selectedUsers.get(0), "Eduard Moraru", "Enygma2002");
        Assert.assertEquals("", userPicker.getValue());
        Assert.assertFalse(userPicker.getClearSelectionLink().isDisplayed());
View Full Code Here

        selectedUsers.get(0).delete();
        Assert.assertEquals(0, userPicker.getAcceptedSuggestions().size());
        Assert.assertFalse(userPicker.getClearSelectionLink().isDisplayed());

        // When there is only one suggestion, Enter key should select it.
        userPicker.sendKeys("admin").waitForSuggestions().sendKeys(Keys.ENTER);
        selectedUsers = userPicker.waitForSuggestionsToFadeOut().getAcceptedSuggestions();
        Assert.assertEquals(1, selectedUsers.size());
        assertUserElement(selectedUsers.get(0), "Administrator", "Admin", "noavatar.png");
        Assert.assertEquals("", userPicker.getValue());
        Assert.assertFalse(userPicker.getClearSelectionLink().isDisplayed());
View Full Code Here

        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();
        Assert.assertTrue(userPicker.getClearSelectionLink().isDisplayed());
        List<UserElement> selectedUsers = userPicker.getAcceptedSuggestions();
        Assert.assertEquals(2, selectedUsers.size());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.