Java Code Examples for org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences#KEYBOARD_STRATEGY

The following examples show how to use org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences#KEYBOARD_STRATEGY . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CoreSwtbotTools.java    From dsl-devkit with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Sets common SWTBot preferences.
 */
public static void initializePreferences() {
  // -Dorg.eclipse.swtbot.playback.delay=2
  SWTBotPreferences.PLAYBACK_DELAY = BOT_PLAYBACK_DELAY;

  // System.setProperty("org.eclipse.swtbot.keyboardLayout", "EN_US");
  SWTBotPreferences.KEYBOARD_LAYOUT = "org.eclipse.swtbot.swt.finder.keyboard.EN_US";

  // SWTBot Keyboard strategies
  SWTBotPreferences.KEYBOARD_STRATEGY = "org.eclipse.swtbot.swt.finder.keyboard.SWTKeyboardStrategy";

  // keyboard type interval
  SWTBotPreferences.TYPE_INTERVAL = KEYBOARD_TYPE_INTERVAL;

  // Waiting for Widgets
  SWTBotPreferences.TIMEOUT = BOT_WIDGET_TIMEOUT;

  // screenshot directory
  SWTBotPreferences.SCREENSHOTS_DIR = System.getProperty(SWTBotPreferenceConstants.KEY_SCREENSHOTS_DIR, "target/screenshots");

  // test window focus policy
  workbenchFocusPolicy = WorkbenchFocusPolicy.valueOf(System.getProperty(PROPERTY_COM_AVALOQ_TEST_WORKBENCHFOCUSPOLICY, WorkbenchFocusPolicy.REFOCUS.toString()));

  preferencesInitialized = true;
}
 
Example 2
Source File: DeChKeyboardLayoutTest.java    From dsl-devkit with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Tests com.avaloq.test.swtbot.DE_CH.
 */
@Test
public void testDeChKeyboardLayout() {
  SWTBotPreferences.KEYBOARD_LAYOUT = "com.avaloq.test.swtbot.DE_CH";
  SWTBotPreferences.KEYBOARD_STRATEGY = "org.eclipse.swtbot.swt.finder.keyboard.MockKeyboardStrategy";
  SwtWorkbenchBot bot = new SwtWorkbenchBot();

  bot.closeWelcomePage();
  bot.menu("File").menu("New").menu("Untitled Text File").click();
  SWTBotEclipseEditor editor = bot.activeEditor().toTextEditor();
  editor.setFocus();
  editor.typeText(EXPECTED_RESULT);
  String actualResult = editor.getText();
  bot.closeAllEditors();

  assertEquals("Written and read characters must exactly match", EXPECTED_RESULT, actualResult);
}
 
Example 3
Source File: SwtBotUtil.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Initialize the bot's preferences.
 */
public static void initializeBotPreferences() {
  // NOTE: the keyboard layout must match the keyboard used for the OS.
  // The default keyboard layouts are: EN_US, MAC_EN_US, EN_GB, MAC_EN_GB, FR_FR, DE_DE.
  // TF-69: "com.avaloq.test.swtbot.DE_CH" is a custom keyboard layout, saved in the package "com.avaloq.test.swtbot"
  SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
  SWTBotPreferences.KEYBOARD_STRATEGY = System.getProperty("org.eclipse.swtbot.keyboard.strategy", "org.eclipse.swtbot.swt.finder.keyboard.SWTKeyboardStrategy");
  SWTBotPreferences.PLAYBACK_DELAY = PLAYBACK_DELAY;
  SWTBotPreferences.TIMEOUT = TIMEOUT;
}