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

The following examples show how to use org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences#PLAYBACK_DELAY . 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: MergeSegmentsTest.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 每个测试开始之前执行
 */
@Before
public void setUp() {
	if (SLOW_PLAYBACK) {
		SWTBotPreferences.PLAYBACK_DELAY = 500;
	}
	SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
	INVISIBLE_CHAR = XlfEditor.INVISIBLE_CHAR;
	reTag = "(" + INVISIBLE_CHAR + "\\d+)?" + INVISIBLE_CHAR + "(x|bx|ex|g|bpt|ept|mrk|sub|ph|it)" + INVISIBLE_CHAR + "(\\d+" + INVISIBLE_CHAR + ")?";
	bot = HSBot.bot();
	bot.closeAllEditors();
	ts = TS.getInstance();
	prjName = "swtBot-Project-001";
	fileName = "HSCAT8-3.xlf";
	ProjectTreeView.doubleClickXlfFile(prjName, fileName);
	xe = new XlfEditor(bot.editorByTitle(fileName));
}
 
Example 3
Source File: MergeSegmentsTest.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 每个测试开始之前执行
 */
@Before
public void setUp() {
	if (SLOW_PLAYBACK) {
		SWTBotPreferences.PLAYBACK_DELAY = 500;
	}
	SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
	INVISIBLE_CHAR = XlfEditor.INVISIBLE_CHAR;
	reTag = "(" + INVISIBLE_CHAR + "\\d+)?" + INVISIBLE_CHAR + "(x|bx|ex|g|bpt|ept|mrk|sub|ph|it)" + INVISIBLE_CHAR + "(\\d+" + INVISIBLE_CHAR + ")?";
	bot = HSBot.bot();
	bot.closeAllEditors();
	ts = TS.getInstance();
	prjName = "swtBot-Project-001";
	fileName = "HSCAT8-3.xlf";
	ProjectTreeView.doubleClickXlfFile(prjName, fileName);
	xe = new XlfEditor(bot.editorByTitle(fileName));
}
 
Example 4
Source File: GeoMapTest.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Before
public void setUp() {
	SWTBotPreferences.PLAYBACK_DELAY = 1000; // slow down tests...Otherwise we won't see anything
	display = Display.getCurrent();
	parent = createUI(display);

	bot = new SWTBot(parent);
	geoMapPositioned = geoMap = bot.widget(Is.isA(GeoMap.class));
	geoMapBot = new SWTBotGeoMap(geoMap);
}
 
Example 5
Source File: GeoMapViewerTest.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Before
public void setUp() {
	SWTBotPreferences.PLAYBACK_DELAY = 1000; // slow down tests...Otherwise we won't see anything
	display = Display.getCurrent();
	parent = createUI(display);

	bot = new SWTBot(parent);
	GeoMap geoMap = bot.widget(Is.isA(GeoMap.class));
	geoMapBot = new SWTBotGeoMap(geoMap);
}
 
Example 6
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;
}
 
Example 7
Source File: TestDemos.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
@BeforeClass
public static void startTest() {
	if (DEBUG_MODE == 2) {
		SWTBotPreferences.PLAYBACK_DELAY = 500;
	}
	SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
	bot = HSBot.bot();
}
 
Example 8
Source File: TestDemos.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
@BeforeClass
public static void startTest() {
	if (DEBUG_MODE == 2) {
		SWTBotPreferences.PLAYBACK_DELAY = 500;
	}
	SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
	bot = HSBot.bot();
}
 
Example 9
Source File: ICEResourcePageTester.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void beforeAllTests() {
	super.beforeAllTests();
	// Initialize static or otherwise shared resources here.
	SWTBotPreferences.PLAYBACK_DELAY = 100;
	openView("Other", "Resources");

	// ---- Open an ICEFormEditor with an ICEResourcePage. ---- //
	ICEFormEditor editor;
	Form form;

	// Create a new Form with a ResourceComponent.
	sharedResources = new ResourceComponent();
	form = new Form();
	form.addComponent(sharedResources);

	// Create the ICEFormEditor (it should have an ICEResourcePage).
	sharedEditorRef = openICEFormEditor(form);
	editor = (ICEFormEditor) sharedEditorRef.getEditor(false);
	// The editor should not be null.
	assertNotNull(editor);

	// Get the ICEResourcePage from the editor.
	sharedPage = editor.getResourcePage();
	// -------------------------------------------------------- //

	// try {
	// Thread.sleep(99999);
	// } catch (InterruptedException e) {
	// // TODO Auto-generated catch block
	// e.printStackTrace();
	// }

	return;
}
 
Example 10
Source File: VIBELauncherTester.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Tests the functionality of the VIBE Launcher item.
 */
@Test
public void checkVIBELauncher() {

	SWTBotPreferences.PLAYBACK_DELAY = 100;

	// Open the ICE perspective
	bot.menu("Window").menu("Perspective").menu("Open Perspective")
			.menu("Other...").click();
	bot.table(0).select("ICE");
	bot.button().click();

	// Create a new reflectivity model item
	bot.toolbarButtonWithTooltip("Create an Item").click();
	bot.list(0).select("VIBE Launcher");
	bot.button("Finish").click();

	// Check the starting form label
	assertTrue("Ready to process.".equals(bot.clabel(0).getText()));
	
	//Check that the Cancel and Browse buttons are enabled
	assertTrue(bot.button("Cancel").isEnabled());
	assertTrue(bot.button("Browse...").isEnabled());
	
	//Test that the input file combo box can be manipulated
	bot.comboBoxWithLabel("Input File:").setSelection(1);
	
	// Check that this made the form dirty
	assertTrue("There are unsaved changes on the form.".equals(bot.clabel(0).getText()));
	
	// Save and check that the header's text returned to normal.
	bot.toolbarButtonWithTooltip("Save (Ctrl+S)").click();
	assertTrue(bot.clabel(0).getText().equals("Ready to process."));
	
	//Click the custom file box.
	bot.checkBox("Use custom key-value pair file?").click();

	//Set the selection of the key-value combo box
	bot.comboBox().setSelection(1);;
	
	//Check that the key-value browse button is enabled
	assertTrue(bot.button("Browse...", 1).isEnabled());
	
	//Check the host table's initial contents
	assertTrue("localhost".equals(bot.table(1).cell(0, 0)));
	assertEquals(1, bot.table(1).rowCount());
	
	//Add a row and check that it was added correctly
	bot.button("+").click();
	assertEquals(2, bot.table(1).rowCount());
	assertTrue("".equals(bot.table(1).cell(1, 0)));
	
	//Try editing the table and ensure the change was accepted
	bot.table(1).click(1, 0);
	bot.text("").typeText("8.8.8.8");
	bot.table(1).click(0, 0);
	assertTrue("8.8.8.8".equals(bot.table(1).cell(1, 0)));
	
	//Remove a row from the table and check that it is gone
	bot.button("-").click();
	assertEquals(1, bot.table(1).rowCount());
	assertTrue("8.8.8.8".equals(bot.table(1).cell(0, 0)));
	
	//Remove rows until the table is empty and remove another. Nothing should happen.
	bot.button("-").click();
	bot.button("-").click();
	
	// See if the tab can be changed
	bot.cTabItem("Output Files and Data").activate();
	
	
}
 
Example 11
Source File: VIBEKeyValuePairTester.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Tests the functionality of the VIBE Key-Value Pair item.
 */
@Test
public void checkVIBEKeyValuePair() {

	SWTBotPreferences.PLAYBACK_DELAY = 100;

	// Open the ICE perspective
	bot.menu("Window").menu("Perspective").menu("Open Perspective")
			.menu("Other...").click();
	bot.table(0).select("ICE");
	bot.button().click();

	// Create a new reflectivity model item
	bot.toolbarButtonWithTooltip("Create an Item").click();
	bot.list(0).select("VIBE Key-Value Pair");
	bot.button("Finish").click();

	// Check the starting form label
	assertTrue("Ready to process.".equals(bot.clabel(0).getText()));

	// Check that the cancel button is enabled
	assertTrue(bot.button("Cancel").isEnabled());

	//The table should be empty at the start
	assertEquals(0, bot.table(1).rowCount());
	
	//Set the table to the NTG template
	bot.radio(1).click();
	
	// Check the table's values for the default settings
	assertTrue("ELECTRICAL".equals(bot.table(1).cell(0, 0)));

	// Change the first row's value to two
	bot.table(1).click(0, 1);
	bot.text("1 ", 0).setText("2");
	bot.table(1).click(0, 0);

	// Check that the cell was set
	assertTrue("2".equals(bot.table(1).cell(0, 1)));

	// Makes sure the form registers that it is dirty
	assertTrue("There are unsaved changes on the form."
			.equals(bot.clabel(0).getText()));

	// Save and check that the header's text returned to normal.
	bot.toolbarButtonWithTooltip("Save (Ctrl+S)").click();
	assertTrue(bot.clabel(0).getText().equals("Ready to process."));

	// Make sure there are 21 rows
	assertEquals(21, bot.table(1).rowCount());

	// Add a row and check that it is there.
	bot.button("+").click();
	assertEquals(22, bot.table(1).rowCount());

	// Remove the second from last row and test that there are one fewer
	// rows and that the last row is empty.
	bot.table(1).click(20, 0);
	bot.button("-").click();
	assertEquals(21, bot.table(1).rowCount());
	System.out.println(bot.table(1).cell(20, 0));
	assertTrue("".equals(bot.table(1).cell(20, 0)));

	// Check that the form reports the job as complete after performing it.
	bot.button("Go!").click();
	assertTrue(bot.clabel(0).getText().equals("Done!"));

	// Set the template to DualFoil
	bot.radio(2).click();

	// Check that a couple of the DualFoil's rows are set up correctly
	assertTrue("NUMSEG".equals(bot.table(1).cell(14, 0)));
	assertTrue("CUTOFFL".equals(bot.table(1).cell(17, 0)));
	assertTrue("2.0,2.0,2.0,2.0,2.0".equals(bot.table(1).cell(17, 1)));

	// Set the NUMSEG key to 8.
	bot.table(1).click(14, 1);
	bot.text("5", 0).setText("8");
	bot.table(1).click(14, 0);

	// CUTOFFL should have had its vector increased in size to account for
	// the new NUMSEG value
	assertTrue("2.0,2.0,2.0,2.0,2.0,0.0,0.0,0.0"
			.equals(bot.table(1).cell(17, 1)));

	// Set NUMSEG to 4
	bot.table(1).click(14, 1);
	bot.text("8", 0).setText("4");
	bot.table(1).click(14, 0);

	// CUTOFFL should have been reduced to only 4 numbers
	assertTrue("2.0,2.0,2.0,2.0".equals(bot.table(1).cell(17, 1)));

}