예제 #1
0
 /** Used so that AllTests can set the persistent test context. */
 public static void setContext(PersistentTestContext context) {
   AbstractTest.context = context;
   BaseElement.setContext(context);
   TestUtils.setContext(context);
 }
  @Test
  @IgnoreBrowser(
      value = "internet.*",
      version = "8\\.*",
      reason = "See http://jira.xwiki.org/browse/XE-1146")
  public void testKeyboardShortcuts() {
    ViewPage vp = util.gotoPage("Sandbox", "WebHome");

    // Test default edit mode (WYSIWYG for sandbox webhome) key
    vp.sendKeys("e");
    vp.waitUntilPageIsLoaded();
    Assert.assertTrue(util.isInWYSIWYGEditMode());

    // Test Cancel key
    vp.sendKeys(Keys.ALT, "c");
    vp.waitUntilPageIsLoaded();
    Assert.assertTrue(util.isInViewMode());

    // Test Wiki edit key
    vp.sendKeys("k");
    vp.waitUntilPageIsLoaded();
    Assert.assertTrue(util.isInWikiEditMode());

    // Test WYSIWYG edit mode key
    vp = this.util.gotoPage("Sandbox", "WebHome");
    vp.sendKeys("e");
    vp.waitUntilPageIsLoaded();
    Assert.assertTrue(util.isInWYSIWYGEditMode());

    // Test Inline edit mode key
    vp = this.util.gotoPage("Sandbox", "WebHome");
    vp.sendKeys("f");
    vp.waitUntilPageIsLoaded();
    Assert.assertTrue(util.isInInlineEditMode());

    // Test Rights edit mode key
    vp = this.util.gotoPage("Sandbox", "WebHome");
    vp.sendKeys("r");
    vp.waitUntilPageIsLoaded();
    Assert.assertTrue(util.isInRightsEditMode());

    // Test Object edit mode key
    vp = this.util.gotoPage("Sandbox", "WebHome");
    vp.sendKeys("o");
    vp.waitUntilPageIsLoaded();
    Assert.assertTrue(util.isInObjectEditMode());

    // Test Class edit mode key
    vp = this.util.gotoPage("Sandbox", "WebHome");
    vp.sendKeys("s");
    vp.waitUntilPageIsLoaded();
    Assert.assertTrue(util.isInClassEditMode());

    // Test Delete key
    vp = this.util.gotoPage("Sandbox", "WebHome");
    vp.sendKeys(Keys.DELETE);
    Assert.assertTrue(util.isInDeleteMode());

    // Test Rename key
    vp = this.util.gotoPage("Sandbox", "WebHome");
    vp.sendKeys(Keys.F2);
    Assert.assertTrue(util.isInRenameMode());
  }