[oe-commits] [bitbake] 14/26: toaster-tests: fix tests for latest Selenium version

git at git.openembedded.org git at git.openembedded.org
Tue Jun 14 10:10:22 UTC 2016


rpurdie pushed a commit to branch master-next
in repository bitbake.

commit 571c2b70d3c123614618672ce7532bb5f4c36630
Author: Elliot Smith <elliot.smith at intel.com>
AuthorDate: Tue Jun 7 16:37:28 2016 +0100

    toaster-tests: fix tests for latest Selenium version
    
    Previously, we didn't specify a specific version of Selenium.
    When upgrading to Python 3 and installing Selenium to work with it,
    the JS unit test broke, as the report format produced by Selenium
    had changed.
    
    Modify the test so that it works with the latest Selenium report
    format.
    
    Add a note to the README that the given Selenium version should
    be used to prevent unexpected test failures.
    
    Signed-off-by: Elliot Smith <elliot.smith at intel.com>
    Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
---
 lib/toaster/tests/browser/README                | 7 ++++---
 lib/toaster/tests/browser/test_js_unit_tests.py | 8 ++++----
 lib/toaster/toastergui/static/js/tests/test.js  | 8 --------
 3 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/lib/toaster/tests/browser/README b/lib/toaster/tests/browser/README
index 63e8169..f57154e 100644
--- a/lib/toaster/tests/browser/README
+++ b/lib/toaster/tests/browser/README
@@ -4,10 +4,11 @@ These tests require Selenium to be installed in your Python environment.
 
 The simplest way to install this is via pip:
 
-  pip install selenium
+  pip install selenium==2.53.2
 
-Alternatively, if you used pip to install the libraries required by Toaster,
-selenium will already be installed.
+Note that if you use other versions of Selenium, some of the tests (such as
+tests.browser.test_js_unit_tests.TestJsUnitTests) may fail, as these rely on
+a Selenium test report with a version-specific format.
 
 To run tests against Chrome:
 
diff --git a/lib/toaster/tests/browser/test_js_unit_tests.py b/lib/toaster/tests/browser/test_js_unit_tests.py
index e63da8e..3c0b962 100644
--- a/lib/toaster/tests/browser/test_js_unit_tests.py
+++ b/lib/toaster/tests/browser/test_js_unit_tests.py
@@ -38,11 +38,11 @@ class TestJsUnitTests(SeleniumTestCase):
     def test_that_js_unit_tests_pass(self):
         url = reverse('js-unit-tests')
         self.get(url)
-        self.wait_until_present('#tests-failed')
+        self.wait_until_present('#qunit-testresult .failed')
 
-        failed = self.find("#tests-failed").text
-        passed = self.find("#tests-passed").text
-        total = self.find("#tests-total").text
+        failed = self.find("#qunit-testresult .failed").text
+        passed = self.find("#qunit-testresult .passed").text
+        total = self.find("#qunit-testresult .total").text
 
         logger.info("Js unit tests completed %s out of %s passed, %s failed",
                     passed,
diff --git a/lib/toaster/toastergui/static/js/tests/test.js b/lib/toaster/toastergui/static/js/tests/test.js
index 2b62118..44b7522 100644
--- a/lib/toaster/toastergui/static/js/tests/test.js
+++ b/lib/toaster/toastergui/static/js/tests/test.js
@@ -2,14 +2,6 @@
 /* Unit tests for Toaster's JS */
 
 /* libtoaster tests */
-QUnit.done(function(details){
-    /* Selenium test will look for these elements to get the results */
-  var body = $('body');
-  body.append("<span id='tests-failed'>"+details.failed+"</span>");
-  body.append("<span id='tests-passed'>"+details.passed+"</span>");
-  body.append("<span id='tests-total'>"+details.total+"</span>");
-});
-
 QUnit.test("Layer alert notification", function(assert) {
   var layer = {
     "layerdetailurl":"/toastergui/project/1/layer/22",

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list