Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 4A816E00E6F; Mon, 13 Jun 2016 06:34:48 -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=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [209.85.192.169 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Received: from mail-pf0-f169.google.com (mail-pf0-f169.google.com [209.85.192.169]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id D5041E00E6F for ; Mon, 13 Jun 2016 06:34:44 -0700 (PDT) Received: by mail-pf0-f169.google.com with SMTP id 62so46432498pfd.1 for ; Mon, 13 Jun 2016 06:34:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rLTjAm0opopDgsk4qNWpZ3wMV5Ht4HKAmxSmLmTBIfI=; b=SPB1Q00NFx/UyBuyDXM5g1TYDCczMVO1SwpMBkbkTEthSlnsEvSdSuU3QFzdxIu0d1 EttQZ78ueBAKYyzz+Lh9+sXG9Ayog840V/+pl/qEq1gjXA49Pi/XHLPRpQ1k1txl78IL kgduDm0IRpsHsvGwaXrGGxm6HFPbLHtsPjIDVI8fkr4qTBiyrkUbjDfH8UoqcjjrgVyJ 5+rPR4nthJm74iuRd3vqm3xeEI41gophUbtlQD1ZLyYG0OlVw6dVlG3mErdxvZ6iWJ5a ec4ZaqdHCoWc9i8Rgc+YiHyFLScJpl+m85v6iNHUXgK/K7TadgSnDuJDnrBx415vI8Db TjFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rLTjAm0opopDgsk4qNWpZ3wMV5Ht4HKAmxSmLmTBIfI=; b=M1h8ULIELPRObEscvFFKybg+uIpfap/J5ds9wcl6PgZTKxI9YLq0vYh+a0Xmb+hXRO umeUz+Glq9D5gGDHmbk24oP8upD6j0tUAWiPdm8IB+qg84iQ+mg5rL22cRY7rSgmCQT7 xyULps757YdesprLvgwD7DSQmulHvvkIR7jLUp3qnb5Vg2pIXTr3pbH1JUk+/64ePJ7j e0nawwp0c8mwu1fSjuHdLbEo09MJ0tMnWkzIOshp8myOz2fFctSKX3MeUUIIrvPle/WM CxjUFgeRFmA4DSKJGPe71jFNIMPJwxI8g6UQkSbmRi9qwXY3JeOsLEywK9M+GE8gpxYd Nhog== X-Gm-Message-State: ALyK8tLqIOyEUPWT7bnBBg4WGIBZ4iCbFqKLxldPPmmjkQofFv+edTqI0YqPdEsjFfiXCElu X-Received: by 10.98.46.70 with SMTP id u67mr20796883pfu.134.1465824884002; Mon, 13 Jun 2016 06:34:44 -0700 (PDT) Received: from orion.ger.corp.intel.com (fmdmzpr02-ext.fm.intel.com. [192.55.55.37]) by smtp.gmail.com with ESMTPSA id y70sm37923217pff.25.2016.06.13.06.34.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Jun 2016 06:34:43 -0700 (PDT) From: Michael Wood To: toaster@yoctoproject.org Date: Mon, 13 Jun 2016 14:34:31 +0100 Message-Id: <1465824871-14753-2-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1465824871-14753-1-git-send-email-michael.g.wood@intel.com> References: <1465824871-14753-1-git-send-email-michael.g.wood@intel.com> Subject: [PATCH 2/2] toaster: tests browser Fix selenium tests after bootstrap3 breakage 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: Mon, 13 Jun 2016 13:34:48 -0000 Fix a number of selectors which have changed after the port to bootstrap3. Also fix the modal wait_until_visible and returning of the text for the radio buttons in the modals for edit custom image and new custom image on the build dashboard. Signed-off-by: Michael Wood --- .../toaster/tests/browser/test_all_builds_page.py | 15 ++++++----- .../tests/browser/test_builddashboard_page.py | 31 +++++++++++----------- .../tests/browser/test_project_config_page.py | 5 +++- 3 files changed, 27 insertions(+), 24 deletions(-) diff --git a/bitbake/lib/toaster/tests/browser/test_all_builds_page.py b/bitbake/lib/toaster/tests/browser/test_all_builds_page.py index e4223f4..5ea6532 100644 --- a/bitbake/lib/toaster/tests/browser/test_all_builds_page.py +++ b/bitbake/lib/toaster/tests/browser/test_all_builds_page.py @@ -27,6 +27,7 @@ from tests.browser.selenium_helpers import SeleniumTestCase from orm.models import BitbakeVersion, Release, Project, Build, Target + class TestAllBuildsPage(SeleniumTestCase): """ Tests for all builds page /builds/ """ @@ -95,17 +96,17 @@ class TestAllBuildsPage(SeleniumTestCase): url = reverse('all-builds') self.get(url) - # shouldn't see a run again button for command-line builds - selector = 'div[data-latest-build-result="%s"] button' % default_build.id + # shouldn't see a rebuild button for command-line builds + selector = 'div[data-latest-build-result="%s"] a.run-again-btn' % default_build.id run_again_button = self.find_all(selector) self.assertEqual(len(run_again_button), 0, - 'should not see a run again button for cli builds') + 'should not see a rebuild button for cli builds') - # should see a run again button for non-command-line builds - selector = 'div[data-latest-build-result="%s"] button' % build1.id + # should see a rebuild button for non-command-line builds + selector = 'div[data-latest-build-result="%s"] a.run-again-btn' % build1.id run_again_button = self.find_all(selector) self.assertEqual(len(run_again_button), 1, - 'should see a run again button for non-cli builds') + 'should see a rebuild button for non-cli builds') def test_tooltips_on_project_name(self): """ @@ -124,7 +125,7 @@ class TestAllBuildsPage(SeleniumTestCase): # get the project name cells from the table cells = self.find_all('#allbuildstable td[class="project"]') - selector = 'i.get-help' + selector = 'span.get-help' for cell in cells: content = cell.get_attribute('innerHTML') diff --git a/bitbake/lib/toaster/tests/browser/test_builddashboard_page.py b/bitbake/lib/toaster/tests/browser/test_builddashboard_page.py index 0d39abb..cdb0616 100644 --- a/bitbake/lib/toaster/tests/browser/test_builddashboard_page.py +++ b/bitbake/lib/toaster/tests/browser/test_builddashboard_page.py @@ -140,7 +140,7 @@ class TestBuildDashboardPage(SeleniumTestCase): dashboard for the Build object build """ self._get_build_dashboard(build) - return self.find_all('#errors div.alert-error') + return self.find_all('#errors div.alert-danger') def _check_for_log_message(self, build, log_message): """ @@ -179,23 +179,15 @@ class TestBuildDashboardPage(SeleniumTestCase): the WebElement modal match the list of text values in expected """ # labels containing the radio buttons we're testing for - labels = modal.find_elements_by_tag_name('label') - - # because the label content has the structure - # label text - # - # we have to regex on its innerHTML, as we can't just retrieve the - # "label text" on its own via the Selenium API - labels_text = sorted(map( - lambda label: label.get_attribute('innerHTML'), labels - )) - - expected = sorted(expected) + labels = modal.find_elements_by_css_selector(".radio") + labels_text = [lab.text for lab in labels] self.assertEqual(len(labels_text), len(expected)) - for idx, label_text in enumerate(labels_text): - self.assertRegexpMatches(label_text, expected[idx]) + for expected_text in expected: + self.assertTrue(expected_text in labels_text, + "Could not find %s in %s" % (expected_text, + labels_text)) def test_exceptions_show_as_errors(self): """ @@ -217,7 +209,13 @@ class TestBuildDashboardPage(SeleniumTestCase): the user choose one of them to edit """ self._get_build_dashboard(self.build1) + + # click the "edit custom image" button, which populates the modal + selector = '[data-role="edit-custom-image-trigger"]' + self.click(selector) + modal = self.driver.find_element_by_id('edit-custom-image-modal') + self.wait_until_visible("#edit-custom-image-modal") # recipes we expect to see in the edit custom image modal expected_recipes = [ @@ -235,10 +233,11 @@ class TestBuildDashboardPage(SeleniumTestCase): self._get_build_dashboard(self.build1) # click the "new custom image" button, which populates the modal - selector = '[data-role="new-custom-image-trigger"] button' + selector = '[data-role="new-custom-image-trigger"]' self.click(selector) modal = self.driver.find_element_by_id('new-custom-image-modal') + self.wait_until_visible("#new-custom-image-modal") # recipes we expect to see in the new custom image modal expected_recipes = [ diff --git a/bitbake/lib/toaster/tests/browser/test_project_config_page.py b/bitbake/lib/toaster/tests/browser/test_project_config_page.py index ede53b6..7fc1252 100644 --- a/bitbake/lib/toaster/tests/browser/test_project_config_page.py +++ b/bitbake/lib/toaster/tests/browser/test_project_config_page.py @@ -99,7 +99,10 @@ class TestProjectConfigsPage(SeleniumTestCase): self.wait_until_visible('#new-imagefs_types') - checkboxes = self.driver.find_elements_by_xpath("//input[@class='fs-checkbox-fstypes']") + checkboxes_selector = '.fs-checkbox-fstypes' + + self.wait_until_visible(checkboxes_selector) + checkboxes = self.find_all(checkboxes_selector) for checkbox in checkboxes: if checkbox.get_attribute("value") == "cpio": -- 2.7.4