merge-update from trunk
[taxeditor.git] / eu.etaxonomy.taxeditor.test / src / test / java / eu / etaxonomy / taxeditor / test / AbstractEditorTest.java
1 /**
2 *
3 */
4 package eu.etaxonomy.taxeditor.test;
5
6 import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
7 import org.eclipse.swtbot.eclipse.finder.waits.Conditions;
8 import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
9 import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
10 import org.junit.Before;
11 import org.junit.runner.RunWith;
12
13 /**
14 * @author n.hoffmann
15 *
16 */
17 @RunWith(SWTBotJunit4ClassRunner.class)
18 public abstract class AbstractEditorTest {
19
20 protected SWTWorkbenchBot bot;
21
22 public SwtBotUtils utils;
23
24 @Before
25 public void setup() {
26 bot = new SWTWorkbenchBot();
27 SWTBotPreferences.TIMEOUT = 300000;
28 utils = new SwtBotUtils(bot);
29
30 // unfortunately swt bot is not available at the time this is set up
31 // if("Choose a nomenclatural code".equals(getActiveShellHeadline())){
32 // ok();
33 // bot.waitUntil(Conditions.shellIsActive("Nomenclatural code set"));
34 // ok();
35 // }
36
37 if("Connecting to datasource: cdm".equals(utils.getActiveShellHeadline())){
38 performLogin();
39 }
40 }
41
42 private void performLogin(){
43 bot.waitUntil(Conditions.shellIsActive("Login"));
44 bot.textWithLabel("Username").setText("admin");
45 bot.textWithLabel("Password").setText("00000");
46 bot.button("OK").click();
47 }
48
49
50
51
52 }