changeset 167:7baba5d67a16

Fixes of gui tests and web storage tests, making tests more independent * Makefile: added possibility to change backend for making screenshots * Makefile: fixed problem with web storage (content of thermostat webapp direcory is copied in /webaps/thermostat instead of *.war) * Makefile: add coping configuration files to thermostat user directory, which fixed problem of some tests relying on leftower configuration and make it possible run them independently * README.md: new informations about screenshot backends included * src/org/thermostat/qa/framework/Patterns.java: new possible patterns for some tabs added (versions of tabs highlighted under cursor) * src/org/thermostat/qa/framework/ThermostatUtilities.java: thermostats jaas configruation file is now passed to tomcat * src/org/thermostat/qa/testsuites/GuiClientSmokeTest.java: adding 1 second delay fixed problem, when test sometimes failed * src/org/thermostat/qa/testsuites/GuiHostViewSmokeTest.java: window is now not resized more than necessary (caused problem where part of the window did not fit in lower resolution (1024x768) displays/vncs and test failed) * patterns/1.1.0/noAA/ClientPreferencesDialog/connection_info_label.png: added/updated pattern * patterns/1.1.0/noAA/HostView/memory_tab_chsen.png: same as previous * patterns/1.1.0/noAA/HostView/notes_tab.png: same as previous * patterns/1.1.0/noAA/HostView/notes_tab_chosen.png: same as previous * patterns/1.1.0/noAA/HostView/memory_tab_chosen2.png: same as previous * patterns/1.1.0/noAA/HostView/numa_tab_chosen2.png: same as previous * patterns/1.1.0/noAA/HostView/processor_tab_chosen2.png: same as previous
author Zdenek Zambersky <zzambers@redhat.com>
date Fri, 21 Nov 2014 10:50:09 +0100
parents 9266f046203d
children af42c142855f
files Makefile README.md patterns/1.1.0/noAA/ClientPreferencesDialog/connection_info_label.png patterns/1.1.0/noAA/HostView/memory_tab_chosen2.png patterns/1.1.0/noAA/HostView/memory_tab_chsen.png patterns/1.1.0/noAA/HostView/notes_tab.png patterns/1.1.0/noAA/HostView/notes_tab_chosen.png patterns/1.1.0/noAA/HostView/numa_tab_chosen2.png patterns/1.1.0/noAA/HostView/processor_tab_chosen2.png src/org/thermostat/qa/common/Configuration.java src/org/thermostat/qa/framework/Patterns.java src/org/thermostat/qa/framework/ThermostatUtilities.java src/org/thermostat/qa/testsuites/GuiClientSmokeTest.java src/org/thermostat/qa/testsuites/GuiHostViewSmokeTest.java
diffstat 14 files changed, 26 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Wed Oct 29 15:52:34 2014 +0100
+++ b/Makefile	Fri Nov 21 10:50:09 2014 +0100
@@ -44,6 +44,8 @@
 THERMOSTAT_DIR=$(BUILD_DIR)/thermostat
 THERMOSTAT_WEB_DEPLOY_DIR=$(TOMCAT_DIR)/webapps/thermostat
 
+SCREENSHOT_SOURCE=robot
+
 GNOME_KEYRING_USER_DATA_DIR=$(shell realpath -m "$(BUILD_DIR)/.gnome-keyring" )
 
 JAVADOC_DIR=$(REPORT_DIR)/javadoc
@@ -108,6 +110,13 @@
 	mkdir -p $(LOGS_DIR)/$(DATE)
 	# stop mongo database if running
 	killall mongod || true
+	# copy storage config files
+	cp storageconfig/$(THERMOSTAT_VERSION)/db-mongodb/agent.auth \
+	$(THERMOSTAT_USER_DIR)/etc/
+	cp storageconfig/$(THERMOSTAT_VERSION)/db-mongodb/agent.properties \
+	$(THERMOSTAT_USER_DIR)/etc/
+	cp storageconfig/$(THERMOSTAT_VERSION)/db-mongodb/client.properties \
+	$(THERMOSTAT_USER_DIR)/etc/
 	# (re)start gnome-keyring-daemon with custom configuration
 	killall gnome-keyring-daemon || true
 	export XDG_DATA_HOME="$(GNOME_KEYRING_USER_DATA_DIR)" ;	\
@@ -121,7 +130,7 @@
 	-Dthermostat.executable.name=thermostat \
 	-Dthermostat.executable.path=$(THERMOSTAT_DIR)/distribution/target/image/bin \
 	-Dthermostat.version=$(THERMOSTAT_VERSION) \
-	-Dscreenshot.source=normal \
+	-Dscreenshot.source=$(SCREENSHOT_SOURCE) \
 	-Dclean.after.gui.test=true \
 	$(TEST_PACKAGE).$@ 2>&1 | tee $(LOGS_DIR)/$(DATE)/$@.log
 	# stop gnome-keyring-daemon with custom config after test
@@ -287,7 +296,7 @@
 $(THERMOSTAT_WEB_DEPLOY_DIR): tomcat thermostat-build
 	rm -rf $(THERMOSTAT_WEB_DEPLOY_DIR)
 	mkdir -p $(THERMOSTAT_WEB_DEPLOY_DIR)
-	cp	$(THERMOSTAT_DIR)/web/war/target/*.war $(THERMOSTAT_WEB_DEPLOY_DIR)
+	cp -rT	"$$( echo $(THERMOSTAT_DIR)/web/war/target/*.war | sed 's/.war$$//g' )" $(THERMOSTAT_WEB_DEPLOY_DIR)
 
 .PHONY: thermostat-build
 thermostat-build: | $(THERMOSTAT_DIR)/distribution/target/image	
--- a/README.md	Wed Oct 29 15:52:34 2014 +0100
+++ b/README.md	Fri Nov 21 10:50:09 2014 +0100
@@ -91,6 +91,16 @@
                       if there is any of them running.
                       (see Side Efects)
 
+SCREENSHOT_SOURCE   : sets backend for making screenshots and for mouse,
+                      keyboard emulation, possible values:
+                      robot  - uses java.awt.Robot class
+                      xvfb   - uses import command (imagemagick) to make
+                               screenshots and xdotool for mouse move and
+                               keyboard, it may be necessary when testing inside
+                               vnc or xvfb (imagemagick and xdotool need to be
+                               installed first to use this backend)
+                      (default: robot)
+
 Examples
 ---------
 
Binary file patterns/1.1.0/noAA/ClientPreferencesDialog/connection_info_label.png has changed
Binary file patterns/1.1.0/noAA/HostView/memory_tab_chosen2.png has changed
Binary file patterns/1.1.0/noAA/HostView/memory_tab_chsen.png has changed
Binary file patterns/1.1.0/noAA/HostView/notes_tab.png has changed
Binary file patterns/1.1.0/noAA/HostView/notes_tab_chosen.png has changed
Binary file patterns/1.1.0/noAA/HostView/numa_tab_chosen2.png has changed
Binary file patterns/1.1.0/noAA/HostView/processor_tab_chosen2.png has changed
--- a/src/org/thermostat/qa/common/Configuration.java	Wed Oct 29 15:52:34 2014 +0100
+++ b/src/org/thermostat/qa/common/Configuration.java	Fri Nov 21 10:50:09 2014 +0100
@@ -112,7 +112,7 @@
         String str = System.getProperty("screenshot.source"); // properties.getProperty("screenshot_source");
         if( str.equals("dummy") ){
             this.screenshotsSource = ScreenshotSourceType.DUMMY;
-        }else if( str.equals("normal")){
+        }else if( str.equals("robot")){
             this.screenshotsSource = ScreenshotSourceType.NORMAL;
         }else if( str.equals("xvfb")){
             this.screenshotsSource = ScreenshotSourceType.XVFB;
--- a/src/org/thermostat/qa/framework/Patterns.java	Wed Oct 29 15:52:34 2014 +0100
+++ b/src/org/thermostat/qa/framework/Patterns.java	Fri Nov 21 10:50:09 2014 +0100
@@ -136,7 +136,7 @@
         public static final String OVERVIEW_TAB = "HostView/overview_tab";
         public static final String OVERVIEW_TAB_CHOSEN = "HostView/overview_tab_chosen";
         public static final String PROCESSOR_TAB = "HostView/processor_tab";
-        public static final String PROCESSOR_TAB_CHOSEN = "HostView/processor_tab_chosen";
+        public static final String[] PROCESSOR_TAB_CHOSEN = {"HostView/processor_tab_chosen", "HostView/processor_tab_chosen2"};
         public static final String TINY_HOST_LABEL = "HostView/tiny_host_label";
         public static final String TINY_ID_LABEL = "HostView/tiny_id_label";
     }
--- a/src/org/thermostat/qa/framework/ThermostatUtilities.java	Wed Oct 29 15:52:34 2014 +0100
+++ b/src/org/thermostat/qa/framework/ThermostatUtilities.java	Fri Nov 21 10:50:09 2014 +0100
@@ -619,7 +619,7 @@
     {
         //startup.sh from the apache-tomcat dir
         List<String> lines = new LinkedList<String>();
-        lines.add(tomcatHome + File.separator + "bin/startup.sh");
+        lines.add("JAVA_OPTS=\"-Djava.security.auth.login.config=" + configuration.getThermostatHome() + "etc/thermostat_jaas.conf\" " + tomcatHome + File.separator + "bin/startup.sh");
 
         runBashScriptWithContent("webStorage_startTomcat.sh", lines);     
     }
--- a/src/org/thermostat/qa/testsuites/GuiClientSmokeTest.java	Wed Oct 29 15:52:34 2014 +0100
+++ b/src/org/thermostat/qa/testsuites/GuiClientSmokeTest.java	Fri Nov 21 10:50:09 2014 +0100
@@ -412,6 +412,7 @@
         robot.pressRightKey();
         robot.pressDownKey();
         robot.pressEnterKey();
+        sleepIfRealScreen(2000);
 
         prepareScreenshot(robot, "testEditClientPreferencesTest1");
 
--- a/src/org/thermostat/qa/testsuites/GuiHostViewSmokeTest.java	Wed Oct 29 15:52:34 2014 +0100
+++ b/src/org/thermostat/qa/testsuites/GuiHostViewSmokeTest.java	Fri Nov 21 10:50:09 2014 +0100
@@ -165,7 +165,7 @@
         /* robot.press2Keys(KeyEvent.VK_WINDOWS, KeyEvent.VK_UP);
            does not work, makes only gnome help visible */
         Rectangle from = checkForPattern(robot, Patterns.MainWindow.RESIZABLE, "resizable r l corner");
-        robot.resize(from, 400, 300);
+        robot.resize(from, 100, 0);
         
         sleepIfRealScreen(2000);