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 2020/04/11 13:00:34 UTC
[directory-studio] branch master updated: Fix UI tests on Mac
This is an automated email from the ASF dual-hosted git repository.
seelmann pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-studio.git
The following commit(s) were added to refs/heads/master by this push:
new c4b6350 Fix UI tests on Mac
c4b6350 is described below
commit c4b63507fe5208abc17308ccb244a6b980bdc19e
Author: Stefan Seelmann <ma...@stefan-seelmann.de>
AuthorDate: Sat Apr 11 15:00:16 2020 +0200
Fix UI tests on Mac
---
tests/test.integration.ui/pom-first.xml | 5 +-
.../integration/ui/bots/SchemaSearchViewBot.java | 3 +-
.../studio/test/integration/ui/bots/StudioBot.java | 54 ++++++++++++++--------
3 files changed, 41 insertions(+), 21 deletions(-)
diff --git a/tests/test.integration.ui/pom-first.xml b/tests/test.integration.ui/pom-first.xml
index 59db61f..a02a02d 100644
--- a/tests/test.integration.ui/pom-first.xml
+++ b/tests/test.integration.ui/pom-first.xml
@@ -98,7 +98,6 @@
org.apache.directory.studio.schemaeditor,
org.apache.directory.studio.schemaeditor.help,
org.apache.directory.studio.valueeditors,
- bcprov,
org.eclipse.core.runtime,
org.eclipse.ui</Require-Bundle>
@@ -106,6 +105,10 @@
org.apache.commons.codec.digest,
org.apache.http.conn.ssl,
org.apache.log4j,
+ org.bouncycastle.asn1,
+ org.bouncycastle.asn1.x509,
+ org.bouncycastle.jce.provider,
+ org.bouncycastle.x509,
org.dom4j,
org.dom4j.io</Import-Package>
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SchemaSearchViewBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SchemaSearchViewBot.java
index 9785b87..fc5efa9 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SchemaSearchViewBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SchemaSearchViewBot.java
@@ -25,7 +25,6 @@ import java.util.List;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
-import org.eclipse.swtbot.swt.finder.keyboard.Keystrokes;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarToggleButton;
@@ -47,7 +46,7 @@ public class SchemaSearchViewBot
SWTBotToolbarToggleButton button = view.toolbarToggleButton( "Show Search Field" );
button.select();
view.bot().text().setText( text );
- view.bot().text().pressShortcut( Keystrokes.LF );
+ view.bot().buttonWithTooltip( "Search" ).click();
}
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 147dbba..bd1c3a6 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
@@ -22,10 +22,13 @@ package org.apache.directory.studio.test.integration.ui.bots;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
-import org.eclipse.swtbot.swt.finder.keyboard.Keystrokes;
import org.eclipse.swtbot.swt.finder.results.VoidResult;
import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
import org.eclipse.swtbot.swt.finder.utils.SWTUtils;
@@ -197,7 +200,32 @@ public class StudioBot
{
if ( SWTUtils.isMac() )
{
- new SWTBot().activeShell().pressShortcut( SWT.COMMAND, ',' );
+ // new SWTBot().activeShell().pressShortcut( SWT.COMMAND, ',' );
+ final IWorkbench workbench = PlatformUI.getWorkbench();
+ workbench.getDisplay().asyncExec( new Runnable()
+ {
+ public void run()
+ {
+ IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
+ if ( window != null )
+ {
+ Menu appMenu = workbench.getDisplay().getSystemMenu();
+ for ( MenuItem item : appMenu.getItems() )
+ {
+ if ( item.getText().startsWith( "Preferences" ) )
+ {
+ Event event = new Event();
+ event.time = ( int ) System.currentTimeMillis();
+ event.widget = item;
+ event.display = workbench.getDisplay();
+ item.setSelection( true );
+ item.notifyListeners( SWT.Selection, event );
+ break;
+ }
+ }
+ }
+ }
+ } );
}
else
{
@@ -247,27 +275,17 @@ public class StudioBot
public void navigationHistoryBack()
{
- if ( SWTUtils.isMac() )
- {
- new SWTBot().activeShell().pressShortcut( Keystrokes.COMMAND, Keystrokes.ALT, Keystrokes.LEFT );
- }
- else
- {
- new SWTBot().activeShell().pressShortcut( Keystrokes.ALT, Keystrokes.LEFT );
- }
+ SWTBotMenu backMenu = new SWTWorkbenchBot().menu( "Navigate" ).menu( "Back" );
+ String firstItem = backMenu.menuItems().get( 0 );
+ backMenu.menu( firstItem ).click();
}
public void navigationHistoryForward()
{
- if ( SWTUtils.isMac() )
- {
- new SWTBot().activeShell().pressShortcut( Keystrokes.COMMAND, Keystrokes.ALT, Keystrokes.RIGHT );
- }
- else
- {
- new SWTBot().activeShell().pressShortcut( Keystrokes.ALT, Keystrokes.RIGHT );
- }
+ SWTBotMenu forwardMenu = new SWTWorkbenchBot().menu( "Navigate" ).menu( "Forward" );
+ String firstItem = forwardMenu.menuItems().get( 0 );
+ forwardMenu.menu( firstItem ).click();
}
}