1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.test.ui

File KeyboardShortcutsTest.java

 

Code metrics

0
44
1
1
118
66
1
0.02
44
1
1

Classes

Class Line # Actions
KeyboardShortcutsTest 37 44 0% 1 0
1.0100%
 

Contributing tests

This file is covered by 1 test. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.test.ui;
21   
22    import org.junit.Assert;
23    import org.junit.Rule;
24    import org.junit.Test;
25    import org.openqa.selenium.Keys;
26    import org.xwiki.administration.test.po.AdministrationPage;
27    import org.xwiki.test.ui.browser.IgnoreBrowser;
28    import org.xwiki.test.ui.browser.IgnoreBrowsers;
29    import org.xwiki.test.ui.po.ViewPage;
30   
31    /**
32    * Verify the keyboard shortcuts feature of XWiki.
33    *
34    * @version $Id: 9caad27375e6cad0e8e5e25bbe151a941568cda8 $
35    * @since 2.6RC1
36    */
 
37    public class KeyboardShortcutsTest extends AbstractTest
38    {
39    @Rule
40    public AdminAuthenticationRule adminAuthenticationRule = new AdminAuthenticationRule(getUtil());
41   
 
42  1 toggle @Test
43    @IgnoreBrowsers({
44    @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason="See http://jira.xwiki.org/browse/XE-1146"),
45    @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason="See http://jira.xwiki.org/browse/XE-1177")
46    })
47    public void testKeyboardShortcuts()
48    {
49  1 ViewPage vp = getUtil().gotoPage("Sandbox", "WebHome");
50   
51    // Test default edit mode (WYSIWYG for Sandbox.WebHome) key
52  1 vp.sendKeys("e");
53   
54    // Test Cancel key
55  1 vp.sendKeys(Keys.chord(Keys.ALT, "c"));
56  1 vp.waitUntilPageIsLoaded();
57  1 Assert.assertTrue(getUtil().isInViewMode());
58   
59    // Test Wiki edit key
60  1 vp.sendKeys("k");
61  1 vp.waitUntilPageIsLoaded();
62  1 Assert.assertTrue(getUtil().isInWikiEditMode());
63   
64    // Test WYSIWYG edit mode key
65  1 vp = getUtil().gotoPage("Sandbox", "WebHome");
66  1 vp.sendKeys("g");
67   
68    // Test Inline Form edit mode key
69  1 vp = getUtil().gotoPage("Sandbox", "WebHome");
70  1 vp.sendKeys("f");
71  1 vp.waitUntilPageIsLoaded();
72  1 Assert.assertTrue(getUtil().isInInlineEditMode());
73   
74    // Test Rights edit mode key on a terminal document
75  1 vp = getUtil().gotoPage("Sandbox", "TestPage1");
76  1 vp.sendKeys("r");
77  1 vp.waitUntilPageIsLoaded();
78  1 Assert.assertTrue(getUtil().isInRightsEditMode());
79   
80    // Test Rights edit mode key on a non terminal document
81  1 vp = getUtil().gotoPage("Sandbox", "WebHome");
82  1 vp.sendKeys("r");
83  1 vp.waitUntilPageIsLoaded();
84  1 Assert.assertTrue(getUtil().isInAdminMode());
85  1 AdministrationPage administrationPage = new AdministrationPage();
86  1 Assert.assertTrue(administrationPage.hasSection("PageRights"));
87   
88    // Test Object edit mode key
89  1 vp = getUtil().gotoPage("Sandbox", "WebHome");
90  1 vp.sendKeys("o");
91  1 vp.waitUntilPageIsLoaded();
92  1 Assert.assertTrue(getUtil().isInObjectEditMode());
93   
94    // Test Class edit mode key
95  1 vp = getUtil().gotoPage("Sandbox", "WebHome");
96  1 vp.sendKeys("s");
97  1 vp.waitUntilPageIsLoaded();
98  1 Assert.assertTrue(getUtil().isInClassEditMode());
99   
100    // Test Delete key
101  1 vp = getUtil().gotoPage("Sandbox", "WebHome");
102  1 vp.sendKeys(Keys.DELETE);
103  1 vp.waitUntilPageIsLoaded();
104  1 Assert.assertTrue(getUtil().isInDeleteMode());
105   
106    // Test Rename key
107  1 vp = getUtil().gotoPage("Sandbox", "WebHome");
108  1 vp.sendKeys(Keys.F2);
109  1 vp.waitUntilPageIsLoaded();
110  1 Assert.assertTrue(getUtil().isInRenameMode());
111   
112    // Test View Source key
113  1 vp = getUtil().gotoPage("Sandbox", "WebHome");
114  1 vp.sendKeys("d");
115  1 vp.waitUntilPageIsLoaded();
116  1 Assert.assertTrue(getUtil().isInSourceViewMode());
117    }
118    }