From 3b4ce03294d93bbe779be380c64c16f3eb19ff2e Mon Sep 17 00:00:00 2001 From: gforcada Date: Wed, 29 Jun 2016 20:55:40 +0200 Subject: [PATCH] [fc] Repository: plone.app.robotframework Branch: refs/heads/master Date: 2016-06-29T16:51:56+02:00 Author: Maurits van Rees (mauritsvanrees) Commit: https://github.com/plone/plone.app.robotframework/commit/d513cb779ed4b5071d36345941d1ca94d7448de0 Do not use run_on_failure from Selenium2Library. This interferes with Wait until keyword succeeds: an initial failure is seen as total failure instead of checking the retries of this keyword. Added `Plone Test Setup` and `Plone Test Teardown` keywords. In that last one, in case of a failure do what used to be done by run_on_failure. This means a screen shot by default, but you can override this on the command line with for example ROBOT_SELENIUM_RUN_ON_FAILURE=Debug, or Nothing to ignore it. See https://github.com/plone/Products.CMFPlone/pull/1652 Files changed: M CHANGES.rst M src/plone/app/robotframework/selenium.robot Repository: plone.app.robotframework Branch: refs/heads/master Date: 2016-06-29T20:55:40+02:00 Author: Gil Forcada Codinachs (gforcada) Commit: https://github.com/plone/plone.app.robotframework/commit/fdea4a1b81176dfb816d6fa1314451cfd5f20a80 Merge pull request #57 from plone/maurits-no-run-on-failure Do not use run_on_failure from Selenium2Library. Files changed: M CHANGES.rst M src/plone/app/robotframework/selenium.robot --- last_commit.txt | 334 +++++++++++++++++------------------------------- 1 file changed, 119 insertions(+), 215 deletions(-) diff --git a/last_commit.txt b/last_commit.txt index c6aa3b4995..73fc808944 100644 --- a/last_commit.txt +++ b/last_commit.txt @@ -2,249 +2,153 @@ Repository: plone.app.robotframework Branch: refs/heads/master -Date: 2016-06-23T12:25:48+02:00 -Author: Johannes Raggam (thet) -Commit: https://github.com/plone/plone.app.robotframework/commit/2db142dae1f46f6ff42dc6ea0babec82100051b8 +Date: 2016-06-29T16:51:56+02:00 +Author: Maurits van Rees (mauritsvanrees) +Commit: https://github.com/plone/plone.app.robotframework/commit/d513cb779ed4b5071d36345941d1ca94d7448de0 -Add ``Running tests with the Google Chrome browser`` section. +Do not use run_on_failure from Selenium2Library. + +This interferes with Wait until keyword succeeds: an initial failure +is seen as total failure instead of checking the retries of this +keyword. + +Added `Plone Test Setup` and `Plone Test Teardown` keywords. In that +last one, in case of a failure do what used to be done by +run_on_failure. This means a screen shot by default, but you can +override this on the command line with for example +ROBOT_SELENIUM_RUN_ON_FAILURE=Debug, or Nothing to ignore it. + +See https://github.com/plone/Products.CMFPlone/pull/1652 Files changed: M CHANGES.rst -M docs/source/happy.rst +M src/plone/app/robotframework/selenium.robot diff --git a/CHANGES.rst b/CHANGES.rst -index d930674..056edee 100644 +index 056edee..9563427 100644 --- a/CHANGES.rst +++ b/CHANGES.rst -@@ -10,7 +10,8 @@ Breaking changes: +@@ -10,6 +10,16 @@ Breaking changes: New features: --- *add item here* -+- Add ``Running tests with the Google Chrome browser`` section. -+ [thet] - - Bug fixes: - -diff --git a/docs/source/happy.rst b/docs/source/happy.rst -index 0a27ba3..96e36ad 100644 ---- a/docs/source/happy.rst -+++ b/docs/source/happy.rst -@@ -300,6 +300,25 @@ Or exclude matching tests from being run: - $ bin/test -t \!robot - - -+Running tests with the Google Chrome browser -+-------------------------------------------- -+ -+In our setup, robot framework uses Firefox to run the robot tests. -+If you want to use a different browser, you can define it in an environment variable and make sure, any necessary webdriver application are installed. -+The tests can be started like so:: -+ -+ ROBOT_BROWSER=NAME_OF_EXECUTABLE_TO_USE ./bin/test --all -m MODULE_TO_TEST -+ -+In case for Google Chrome, do the following: -+ -+* Install the ``ChromeDriver`` from https://sites.google.com/a/chromium.org/chromedriver/ -+ ChromeDriver needs to be accessible from your path. -+ -+* Start the tests like so (An example testing the ``test_tinymce.robot`` test from ``Products.CMFPlone``):: -+ -+ ROBOT_BROWSER=chrome ./bin/test --all -m Products.CMFPlone -t test_tinymce.robot -+ -+ - How to write more tests - ----------------------- - - - -Repository: plone.app.robotframework - - -Branch: refs/heads/master -Date: 2016-06-23T22:36:38+02:00 -Author: Johannes Raggam (thet) -Commit: https://github.com/plone/plone.app.robotframework/commit/3adcec202471ff0412cab13466808321b1e81b76 - -updates according to feedback - -Files changed: -M docs/source/happy.rst - -diff --git a/docs/source/happy.rst b/docs/source/happy.rst -index 96e36ad..f60ea2f 100644 ---- a/docs/source/happy.rst -+++ b/docs/source/happy.rst -@@ -300,14 +300,29 @@ Or exclude matching tests from being run: - $ bin/test -t \!robot - - --Running tests with the Google Chrome browser ---------------------------------------------- -+Running tests with a different browser -+-------------------------------------- - --In our setup, robot framework uses Firefox to run the robot tests. --If you want to use a different browser, you can define it in an environment variable and make sure, any necessary webdriver application are installed. --The tests can be started like so:: -+Our robot configuration uses Firefox to run robot tests per default. -+To change this, you can pass an environment variable to zope.testrunner script. -+Make sure, any necessary webdriver applications are installed along with your browser (Firefox until version 46 ships with one preinstalled). -+Run your tests like so:: - -- ROBOT_BROWSER=NAME_OF_EXECUTABLE_TO_USE ./bin/test --all -m MODULE_TO_TEST -+ ROBOT_BROWSER=BROWSER_CONFIG_NAME ./bin/test --all -m MODULE_TO_TEST -+ -+The browser name is a configuration variable from Selenium2Library. -+The most important ones are:: -+ -+- android -+- chrome -+- firefox -+- internetexplorer -+- iphone -+- opera -+- phantomjs -+- safari -+ -+For more information see: http://robotframework.org/Selenium2Library/doc/Selenium2Library.html#Open%20Browser - - In case for Google Chrome, do the following: - - - -Repository: plone.app.robotframework - - -Branch: refs/heads/master -Date: 2016-06-28T13:02:49+02:00 -Author: Johannes Raggam (thet) -Commit: https://github.com/plone/plone.app.robotframework/commit/0a0c1209db5199b61675e47e2d1b0c60ce358dcc - -note about starting different version of firefox browser - -Files changed: -M docs/source/happy.rst - -diff --git a/docs/source/happy.rst b/docs/source/happy.rst -index f60ea2f..60131ae 100644 ---- a/docs/source/happy.rst -+++ b/docs/source/happy.rst -@@ -334,6 +334,22 @@ In case for Google Chrome, do the following: - ROBOT_BROWSER=chrome ./bin/test --all -m Products.CMFPlone -t test_tinymce.robot - - -+.. note:: -+ If you want to run the tests with a different Firefox version than already installed, you can do the following (this applies to Linux based Systems): -+ -+ 1) Download the required version from https://ftp.mozilla.org/pub/firefox/releases/ -+ -+ 2) Unzip it in a folder -+ -+ 3) Modify the ``PATH`` environment variable in a terminal to include the firefox binary before any other, like so:: -+ -+ $ export PATH=/home/user/Desktop/firefox43:$PATH -+ -+ 4) Run the tests in the same terminal session, where the modified PATH applies:: -+ -+ $ ./bin/test --all -m Products.CMFPlone -t test_tinymce.robot -+ -+ - How to write more tests - ----------------------- - ++- Do not use ``run_on_failure`` from ``Selenium2Library``. This ++ interferes with ``Wait until keyword succeeds``: an initial failure ++ is seen as total failure instead of checking the retries of this ++ keyword. Added ``Plone Test Setup`` and ``Plone Test Teardown`` ++ keywords. In that last one, in case of a failure do what used to be ++ done by ``run_on_failure``. This means a screen shot by default, ++ but you can override this on the command line with for example ++ ``ROBOT_SELENIUM_RUN_ON_FAILURE=Debug``, or ``Nothing`` to ignore ++ it. See https://github.com/plone/Products.CMFPlone/pull/1652 [maurits] ++ + - Add ``Running tests with the Google Chrome browser`` section. + [thet] + +diff --git a/src/plone/app/robotframework/selenium.robot b/src/plone/app/robotframework/selenium.robot +index a902601..4fa87c0 100644 +--- a/src/plone/app/robotframework/selenium.robot ++++ b/src/plone/app/robotframework/selenium.robot +@@ -1,8 +1,11 @@ + *** Settings *** + ++# We set run_on_failure to Nothing because anything else interferes with ++# 'Wait until keyword succeeds', interpreting an initial failure as complete failure, ++# instead of waiting for a successful retry. + Library Selenium2Library timeout=${SELENIUM_TIMEOUT} + ... implicit_wait=${SELENIUM_IMPLICIT_WAIT} +-... run_on_failure=${SELENIUM_RUN_ON_FAILURE} ++... run_on_failure=Nothing + + Resource variables.robot + Resource ${CMFPLONE_SELECTORS} +@@ -37,6 +40,15 @@ Wait until location is + Wait until keyword succeeds ${TIMEOUT} ${IMPLICIT_WAIT} + ... Location should be ${expected_url} + ++Plone Test Setup ++ Open SauceLabs test browser ++ Refresh JS/CSS resources ++ ++Plone Test Teardown ++ Run Keyword If Test Failed ${SELENIUM_RUN_ON_FAILURE} ++ Report test status ++ Close all browsers ++ + # ---------------------------------------------------------------------------- + # Elements + # ---------------------------------------------------------------------------- Repository: plone.app.robotframework Branch: refs/heads/master -Date: 2016-06-28T13:14:17+02:00 -Author: Jens W. Klein (jensens) -Commit: https://github.com/plone/plone.app.robotframework/commit/876043f59f0d4202bee0255a35a0371bdd2500da +Date: 2016-06-29T20:55:40+02:00 +Author: Gil Forcada Codinachs (gforcada) +Commit: https://github.com/plone/plone.app.robotframework/commit/fdea4a1b81176dfb816d6fa1314451cfd5f20a80 -Merge pull request #56 from plone/thet-doc-differentbrowser +Merge pull request #57 from plone/maurits-no-run-on-failure -Add ``Running tests with the Google Chrome browser`` section. +Do not use run_on_failure from Selenium2Library. Files changed: M CHANGES.rst -M docs/source/happy.rst +M src/plone/app/robotframework/selenium.robot diff --git a/CHANGES.rst b/CHANGES.rst -index d930674..056edee 100644 +index 056edee..9563427 100644 --- a/CHANGES.rst +++ b/CHANGES.rst -@@ -10,7 +10,8 @@ Breaking changes: +@@ -10,6 +10,16 @@ Breaking changes: New features: --- *add item here* -+- Add ``Running tests with the Google Chrome browser`` section. -+ [thet] - - Bug fixes: - -diff --git a/docs/source/happy.rst b/docs/source/happy.rst -index 0a27ba3..60131ae 100644 ---- a/docs/source/happy.rst -+++ b/docs/source/happy.rst -@@ -300,6 +300,56 @@ Or exclude matching tests from being run: - $ bin/test -t \!robot - - -+Running tests with a different browser -+-------------------------------------- -+ -+Our robot configuration uses Firefox to run robot tests per default. -+To change this, you can pass an environment variable to zope.testrunner script. -+Make sure, any necessary webdriver applications are installed along with your browser (Firefox until version 46 ships with one preinstalled). -+Run your tests like so:: -+ -+ ROBOT_BROWSER=BROWSER_CONFIG_NAME ./bin/test --all -m MODULE_TO_TEST -+ -+The browser name is a configuration variable from Selenium2Library. -+The most important ones are:: -+ -+- android -+- chrome -+- firefox -+- internetexplorer -+- iphone -+- opera -+- phantomjs -+- safari -+ -+For more information see: http://robotframework.org/Selenium2Library/doc/Selenium2Library.html#Open%20Browser -+ -+In case for Google Chrome, do the following: -+ -+* Install the ``ChromeDriver`` from https://sites.google.com/a/chromium.org/chromedriver/ -+ ChromeDriver needs to be accessible from your path. -+ -+* Start the tests like so (An example testing the ``test_tinymce.robot`` test from ``Products.CMFPlone``):: -+ -+ ROBOT_BROWSER=chrome ./bin/test --all -m Products.CMFPlone -t test_tinymce.robot -+ -+ -+.. note:: -+ If you want to run the tests with a different Firefox version than already installed, you can do the following (this applies to Linux based Systems): -+ -+ 1) Download the required version from https://ftp.mozilla.org/pub/firefox/releases/ -+ -+ 2) Unzip it in a folder -+ -+ 3) Modify the ``PATH`` environment variable in a terminal to include the firefox binary before any other, like so:: -+ -+ $ export PATH=/home/user/Desktop/firefox43:$PATH -+ -+ 4) Run the tests in the same terminal session, where the modified PATH applies:: -+ -+ $ ./bin/test --all -m Products.CMFPlone -t test_tinymce.robot -+ -+ - How to write more tests - ----------------------- - ++- Do not use ``run_on_failure`` from ``Selenium2Library``. This ++ interferes with ``Wait until keyword succeeds``: an initial failure ++ is seen as total failure instead of checking the retries of this ++ keyword. Added ``Plone Test Setup`` and ``Plone Test Teardown`` ++ keywords. In that last one, in case of a failure do what used to be ++ done by ``run_on_failure``. This means a screen shot by default, ++ but you can override this on the command line with for example ++ ``ROBOT_SELENIUM_RUN_ON_FAILURE=Debug``, or ``Nothing`` to ignore ++ it. See https://github.com/plone/Products.CMFPlone/pull/1652 [maurits] ++ + - Add ``Running tests with the Google Chrome browser`` section. + [thet] + +diff --git a/src/plone/app/robotframework/selenium.robot b/src/plone/app/robotframework/selenium.robot +index a902601..4fa87c0 100644 +--- a/src/plone/app/robotframework/selenium.robot ++++ b/src/plone/app/robotframework/selenium.robot +@@ -1,8 +1,11 @@ + *** Settings *** + ++# We set run_on_failure to Nothing because anything else interferes with ++# 'Wait until keyword succeeds', interpreting an initial failure as complete failure, ++# instead of waiting for a successful retry. + Library Selenium2Library timeout=${SELENIUM_TIMEOUT} + ... implicit_wait=${SELENIUM_IMPLICIT_WAIT} +-... run_on_failure=${SELENIUM_RUN_ON_FAILURE} ++... run_on_failure=Nothing + + Resource variables.robot + Resource ${CMFPLONE_SELECTORS} +@@ -37,6 +40,15 @@ Wait until location is + Wait until keyword succeeds ${TIMEOUT} ${IMPLICIT_WAIT} + ... Location should be ${expected_url} + ++Plone Test Setup ++ Open SauceLabs test browser ++ Refresh JS/CSS resources ++ ++Plone Test Teardown ++ Run Keyword If Test Failed ${SELENIUM_RUN_ON_FAILURE} ++ Report test status ++ Close all browsers ++ + # ---------------------------------------------------------------------------- + # Elements + # ----------------------------------------------------------------------------