Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 35DCCE00C45; Tue, 7 Jun 2016 08:38:02 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high * trust * [192.55.52.115 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id C84C4E00C39 for ; Tue, 7 Jun 2016 08:37:54 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP; 07 Jun 2016 08:37:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,433,1459839600"; d="scan'208";a="117614703" Received: from tblazejc-mobl.ger.corp.intel.com (HELO lp.ger.corp.intel.com) ([10.252.19.29]) by fmsmga004.fm.intel.com with ESMTP; 07 Jun 2016 08:37:46 -0700 From: Elliot Smith To: toaster@yoctoproject.org Date: Tue, 7 Jun 2016 16:37:28 +0100 Message-Id: <1465313849-20109-7-git-send-email-elliot.smith@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1465313849-20109-1-git-send-email-elliot.smith@intel.com> References: <1465313849-20109-1-git-send-email-elliot.smith@intel.com> Subject: [PATCH][v2 7/8] toaster-tests: fix tests for latest Selenium version X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jun 2016 15:38:02 -0000 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 Signed-off-by: Ed Bartosh --- bitbake/lib/toaster/tests/browser/README | 7 ++++--- bitbake/lib/toaster/tests/browser/test_js_unit_tests.py | 8 ++++---- bitbake/lib/toaster/toastergui/static/js/tests/test.js | 8 -------- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/bitbake/lib/toaster/tests/browser/README b/bitbake/lib/toaster/tests/browser/README index 63e8169..f57154e 100644 --- a/bitbake/lib/toaster/tests/browser/README +++ b/bitbake/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/bitbake/lib/toaster/tests/browser/test_js_unit_tests.py b/bitbake/lib/toaster/tests/browser/test_js_unit_tests.py index e63da8e..3c0b962 100644 --- a/bitbake/lib/toaster/tests/browser/test_js_unit_tests.py +++ b/bitbake/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/bitbake/lib/toaster/toastergui/static/js/tests/test.js b/bitbake/lib/toaster/toastergui/static/js/tests/test.js index 2b62118..44b7522 100644 --- a/bitbake/lib/toaster/toastergui/static/js/tests/test.js +++ b/bitbake/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(""+details.failed+""); - body.append(""+details.passed+""); - body.append(""+details.total+""); -}); - QUnit.test("Layer alert notification", function(assert) { var layer = { "layerdetailurl":"/toastergui/project/1/layer/22", -- 1.9.3 --------------------------------------------------------------------- Intel Corporation (UK) Limited Registered No. 1134945 (England) Registered Office: Pipers Way, Swindon SN3 1RJ VAT No: 860 2173 47 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.