Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Tasse2019-05-09 21:44:02 +0000
committerPatrick Tasse2019-05-15 13:08:34 +0000
commita7b5b3908113cec78f68f592ffffce70d04356b7 (patch)
treebc4fd34fe6693025901cccc06c7b9f00b7926b51
parentffdbc470088fbc730686b924cff6590dd018710e (diff)
downloadorg.eclipse.swtbot-a7b5b3908113cec78f68f592ffffce70d04356b7.tar.gz
org.eclipse.swtbot-a7b5b3908113cec78f68f592ffffce70d04356b7.tar.xz
org.eclipse.swtbot-a7b5b3908113cec78f68f592ffffce70d04356b7.zip
Fix SWTBotEclipseEditorTest
Don't assume that the active shell is the active workbench window shell. Change-Id: I2d923a50c73e92ddb92228c148f54af71093b242 Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
-rw-r--r--org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/helpers/NewJavaClass.java7
-rw-r--r--org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/helpers/NewJavaProject.java6
2 files changed, 10 insertions, 3 deletions
diff --git a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/helpers/NewJavaClass.java b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/helpers/NewJavaClass.java
index 9718c00c..1df48593 100644
--- a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/helpers/NewJavaClass.java
+++ b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/helpers/NewJavaClass.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2015 Ketan Padegaonkar and others.
+ * Copyright (c) 2008, 2019 Ketan Padegaonkar and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -27,6 +27,8 @@ public class NewJavaClass {
private SWTWorkbenchBot bot = new SWTWorkbenchBot();
public void createClass(String packageName, String className) {
+ bot.shell().activate();
+
if (!bot.activePerspective().getLabel().equals("Java")) {
SWTBotMenu windowMenu = bot.menu("Window");
SWTBotMenu perspectiveMenu = windowMenu.menu("Open Perspective");
@@ -36,6 +38,7 @@ public class NewJavaClass {
}
}
bot.menu("File").menu("New").menu("Class").click();
+
SWTBotShell shell = bot.shell("New Java Class");
shell.activate();
bot.textWithLabel("Package:").setText(packageName);
@@ -43,5 +46,7 @@ public class NewJavaClass {
bot.button("Finish").click();
bot.waitUntil(Conditions.shellCloses(shell));
+
+ bot.shell().activate();
}
}
diff --git a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/helpers/NewJavaProject.java b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/helpers/NewJavaProject.java
index 8e0584de..91f401c6 100644
--- a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/helpers/NewJavaProject.java
+++ b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/helpers/NewJavaProject.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2015 Ketan Padegaonkar and others.
+ * Copyright (c) 2008, 2019 Ketan Padegaonkar and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -28,6 +28,8 @@ public class NewJavaProject {
private SWTWorkbenchBot bot = new SWTWorkbenchBot();
public void createProject(String projectName) throws Exception {
+ bot.shell().activate();
+
if (!bot.activePerspective().getLabel().equals("Java")) {
// In Mars "Open Perspective" is nested in "Perspective", so use this
// method to recursively find "Open Perspective" and don't assume it is
@@ -39,7 +41,6 @@ public class NewJavaProject {
}
}
bot.menu("File").menu("New").menu("Java Project").click();
-
SWTBotShell shell = bot.shell("New Java Project");
shell.activate();
@@ -48,6 +49,7 @@ public class NewJavaProject {
bot.waitUntil(Conditions.shellCloses(shell));
+ bot.shell().activate();
}
}

Back to the top