You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2021/01/10 17:19:27 UTC
[directory-studio] branch DIRSTUDIO-1262-eclipse-2020-12 updated:
Stabilize UI tests
This is an automated email from the ASF dual-hosted git repository.
seelmann pushed a commit to branch DIRSTUDIO-1262-eclipse-2020-12
in repository https://gitbox.apache.org/repos/asf/directory-studio.git
The following commit(s) were added to refs/heads/DIRSTUDIO-1262-eclipse-2020-12 by this push:
new a543b2d Stabilize UI tests
a543b2d is described below
commit a543b2d9c7154f913ab5a61af34ad5e8416b0fbb
Author: Stefan Seelmann <ma...@stefan-seelmann.de>
AuthorDate: Sun Jan 10 18:19:11 2021 +0100
Stabilize UI tests
---
.../studio/test/integration/ui/bots/BotUtils.java | 33 +++++++++++++++-------
.../studio/test/integration/ui/bots/StudioBot.java | 2 ++
.../studio/test/integration/ui/bots/WizardBot.java | 1 +
3 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BotUtils.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BotUtils.java
index 600b3e0..93d01b2 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BotUtils.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BotUtils.java
@@ -55,15 +55,7 @@ public class BotUtils
{
public boolean test() throws Exception
{
- String shellText = bot.activeShell().getText();
- for ( String label : labels )
- {
- if ( shellText.equals( label ) && bot.button( "OK" ) != null )
- {
- return true;
- }
- }
- return false;
+ return getShell( labels ) != null;
}
@@ -80,7 +72,28 @@ public class BotUtils
ErrorDialog.AUTOMATED_MODE = errorDialogAutomatedMode;
}
- return bot.activeShell();
+ return getShell( labels );
+ }
+
+
+ private static SWTBotShell getShell( final String... labels )
+ {
+ SWTBotShell[] shells = bot.shells();
+ for ( SWTBotShell shell : shells )
+ {
+ String shellText = shell.getText();
+ for ( String label : labels )
+ {
+ if ( shellText.equals( label ) )
+ {
+ shell.activate();
+ if( bot.button( "OK" ) != null) {
+ return shell;
+ }
+ }
+ }
+ }
+ return null;
}
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java
index ff904a4..341afbe 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java
@@ -154,6 +154,7 @@ public class StudioBot
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
// set default/dark theme
+ /*
IThemeManager tm = workbench.getService( IThemeManager.class );
IThemeEngine te = tm.getEngineForDisplay( Display.getCurrent() );
int random = new Random().nextInt( 3 );
@@ -169,6 +170,7 @@ public class StudioBot
te.setTheme( "org.eclipse.e4.ui.css.theme.high-contrast", false );
break;
}
+ */
// close welcome view
IWorkbenchPage page = window.getActivePage();
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/WizardBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/WizardBot.java
index 92489f2..db3e9ad 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/WizardBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/WizardBot.java
@@ -60,6 +60,7 @@ public abstract class WizardBot extends DialogBot
protected boolean isButtonEnabled( String buttonTitle )
{
+ activate();
return bot.button( buttonTitle ).isEnabled();
}