diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-10-22 13:33:18 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-10-24 11:24:03 +0100 |
| commit | 524bbe060e9db2b62f4a18eda9bc4d820c427386 (patch) | |
| tree | 45b5a64f3e2664cb8ce33ce5022ce392566a6462 | |
| parent | ed7105cb3f11db3f36c1bc2af2f07704a38827dd (diff) | |
| download | poky-524bbe060e9db2b62f4a18eda9bc4d820c427386.tar.gz | |
bitbake: toaster/tests/browser: Add various fixes for test failures encountered
Fixes for the browser tests which:
* Add/improve waiting for specific elements
* Waiting for elements to be interactable, not just visible
* Hiding notification windows
* Using more specific asserts to obtain improved error messages
(Bitbake rev: 0c3f9bc2b9516d2af391f2e081280eb7fa62a05e)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
4 files changed, 13 insertions, 7 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 a1f8057113..9ab81fb11b 100644 --- a/bitbake/lib/toaster/tests/browser/test_all_builds_page.py +++ b/bitbake/lib/toaster/tests/browser/test_all_builds_page.py | |||
| @@ -200,6 +200,7 @@ class TestAllBuildsPage(SeleniumTestCase): | |||
| 200 | 200 | ||
| 201 | # should see a rebuild button for non-command-line builds | 201 | # should see a rebuild button for non-command-line builds |
| 202 | self.wait_until_visible('#allbuildstable tbody tr') | 202 | self.wait_until_visible('#allbuildstable tbody tr') |
| 203 | self.wait_until_visible('.rebuild-btn') | ||
| 203 | selector = 'div[data-latest-build-result="%s"] .rebuild-btn' % build1.id | 204 | selector = 'div[data-latest-build-result="%s"] .rebuild-btn' % build1.id |
| 204 | run_again_button = self.find_all(selector) | 205 | run_again_button = self.find_all(selector) |
| 205 | self.assertEqual(len(run_again_button), 1, | 206 | self.assertEqual(len(run_again_button), 1, |
diff --git a/bitbake/lib/toaster/tests/browser/test_landing_page.py b/bitbake/lib/toaster/tests/browser/test_landing_page.py index f3300430ba..210359d561 100644 --- a/bitbake/lib/toaster/tests/browser/test_landing_page.py +++ b/bitbake/lib/toaster/tests/browser/test_landing_page.py | |||
| @@ -44,6 +44,7 @@ class TestLandingPage(SeleniumTestCase): | |||
| 44 | # and info modal is appearing when clicking on the info sign | 44 | # and info modal is appearing when clicking on the info sign |
| 45 | info_sign.click() # click on the info sign make attribute 'aria-describedby' visible | 45 | info_sign.click() # click on the info sign make attribute 'aria-describedby' visible |
| 46 | info_model_id = info_sign.get_attribute('aria-describedby') | 46 | info_model_id = info_sign.get_attribute('aria-describedby') |
| 47 | self.wait_until_visible(f'#{info_model_id}') | ||
| 47 | info_modal = self.find(f'#{info_model_id}') | 48 | info_modal = self.find(f'#{info_model_id}') |
| 48 | self.assertTrue(info_modal.is_displayed()) | 49 | self.assertTrue(info_modal.is_displayed()) |
| 49 | self.assertTrue("Toaster version information" in info_modal.text) | 50 | self.assertTrue("Toaster version information" in info_modal.text) |
diff --git a/bitbake/lib/toaster/tests/browser/test_layerdetails_page.py b/bitbake/lib/toaster/tests/browser/test_layerdetails_page.py index c4f3f79d34..a6d1bc46c2 100644 --- a/bitbake/lib/toaster/tests/browser/test_layerdetails_page.py +++ b/bitbake/lib/toaster/tests/browser/test_layerdetails_page.py | |||
| @@ -100,7 +100,7 @@ class TestLayerDetailsPage(SeleniumTestCase): | |||
| 100 | (self.initial_values, value)) | 100 | (self.initial_values, value)) |
| 101 | 101 | ||
| 102 | # Make sure the input visible beofre sending keys | 102 | # Make sure the input visible beofre sending keys |
| 103 | self.wait_until_visible("#layer-git input[type=text]") | 103 | self.wait_until_clickable("#layer-git input[type=text]") |
| 104 | inputs.send_keys("-edited") | 104 | inputs.send_keys("-edited") |
| 105 | 105 | ||
| 106 | # Save the new values | 106 | # Save the new values |
| @@ -211,6 +211,7 @@ class TestLayerDetailsPage(SeleniumTestCase): | |||
| 211 | self.get(self.url) | 211 | self.get(self.url) |
| 212 | 212 | ||
| 213 | # Add the layer | 213 | # Add the layer |
| 214 | self.wait_until_clickable("#add-remove-layer-btn") | ||
| 214 | self.click("#add-remove-layer-btn") | 215 | self.click("#add-remove-layer-btn") |
| 215 | 216 | ||
| 216 | notification = self.wait_until_visible("#change-notification-msg") | 217 | notification = self.wait_until_visible("#change-notification-msg") |
| @@ -218,12 +219,17 @@ class TestLayerDetailsPage(SeleniumTestCase): | |||
| 218 | expected_text = "You have added 1 layer to your project: %s" % \ | 219 | expected_text = "You have added 1 layer to your project: %s" % \ |
| 219 | self.imported_layer_version.layer.name | 220 | self.imported_layer_version.layer.name |
| 220 | 221 | ||
| 221 | self.assertTrue(expected_text in notification.text, | 222 | self.assertIn(expected_text, notification.text, |
| 222 | "Expected notification text %s not found was " | 223 | "Expected notification text %s not found was " |
| 223 | " \"%s\" instead" % | 224 | " \"%s\" instead" % |
| 224 | (expected_text, notification.text)) | 225 | (expected_text, notification.text)) |
| 225 | 226 | ||
| 227 | hide_button = self.find('#hide-alert') | ||
| 228 | hide_button.click() | ||
| 229 | self.wait_until_not_visible('#change-notification') | ||
| 230 | |||
| 226 | # Remove the layer | 231 | # Remove the layer |
| 232 | self.wait_until_clickable("#add-remove-layer-btn") | ||
| 227 | self.click("#add-remove-layer-btn") | 233 | self.click("#add-remove-layer-btn") |
| 228 | 234 | ||
| 229 | notification = self.wait_until_visible("#change-notification-msg") | 235 | notification = self.wait_until_visible("#change-notification-msg") |
| @@ -231,7 +237,7 @@ class TestLayerDetailsPage(SeleniumTestCase): | |||
| 231 | expected_text = "You have removed 1 layer from your project: %s" % \ | 237 | expected_text = "You have removed 1 layer from your project: %s" % \ |
| 232 | self.imported_layer_version.layer.name | 238 | self.imported_layer_version.layer.name |
| 233 | 239 | ||
| 234 | self.assertTrue(expected_text in notification.text, | 240 | self.assertIn(expected_text, notification.text, |
| 235 | "Expected notification text %s not found was " | 241 | "Expected notification text %s not found was " |
| 236 | " \"%s\" instead" % | 242 | " \"%s\" instead" % |
| 237 | (expected_text, notification.text)) | 243 | (expected_text, notification.text)) |
diff --git a/bitbake/lib/toaster/tests/browser/test_new_project_page.py b/bitbake/lib/toaster/tests/browser/test_new_project_page.py index b6187db105..e50f236c32 100644 --- a/bitbake/lib/toaster/tests/browser/test_new_project_page.py +++ b/bitbake/lib/toaster/tests/browser/test_new_project_page.py | |||
| @@ -89,12 +89,10 @@ class TestNewProjectPage(SeleniumTestCase): | |||
| 89 | radio = self.driver.find_element(By.ID, 'type-new') | 89 | radio = self.driver.find_element(By.ID, 'type-new') |
| 90 | radio.click() | 90 | radio.click() |
| 91 | 91 | ||
| 92 | self.click("#create-project-button") | 92 | self.wait_until_visible('#hint-error-project-name') |
| 93 | |||
| 94 | self.wait_until_present('#hint-error-project-name') | ||
| 95 | element = self.find('#hint-error-project-name') | 93 | element = self.find('#hint-error-project-name') |
| 96 | 94 | ||
| 97 | self.assertTrue(("Project names must be unique" in element.text), | 95 | self.assertIn("Project names must be unique", element.text, |
| 98 | "Did not find unique project name error message") | 96 | "Did not find unique project name error message") |
| 99 | 97 | ||
| 100 | # Try and click it anyway, if it submits we'll have a new project in | 98 | # Try and click it anyway, if it submits we'll have a new project in |
