diff options
Diffstat (limited to 'bitbake/lib/toaster/tests/browser/test_layerdetails_page.py')
-rw-r--r-- | bitbake/lib/toaster/tests/browser/test_layerdetails_page.py | 52 |
1 files changed, 20 insertions, 32 deletions
diff --git a/bitbake/lib/toaster/tests/browser/test_layerdetails_page.py b/bitbake/lib/toaster/tests/browser/test_layerdetails_page.py index 5c29548b78..6abfdef699 100644 --- a/bitbake/lib/toaster/tests/browser/test_layerdetails_page.py +++ b/bitbake/lib/toaster/tests/browser/test_layerdetails_page.py | |||
@@ -64,7 +64,7 @@ class TestLayerDetailsPage(SeleniumTestCase): | |||
64 | args=(self.project.pk, | 64 | args=(self.project.pk, |
65 | self.imported_layer_version.pk)) | 65 | self.imported_layer_version.pk)) |
66 | 66 | ||
67 | def _edit_layerdetails(self): | 67 | def test_edit_layerdetails_page(self): |
68 | """ Edit all the editable fields for the layer refresh the page and | 68 | """ Edit all the editable fields for the layer refresh the page and |
69 | check that the new values exist""" | 69 | check that the new values exist""" |
70 | 70 | ||
@@ -100,24 +100,19 @@ 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 |
107 | for save_btn in self.find_all(".change-btn"): | 107 | for save_btn in self.find_all(".change-btn"): |
108 | save_btn.click() | 108 | save_btn.click() |
109 | 109 | ||
110 | try: | 110 | self.wait_until_visible("#save-changes-for-switch") |
111 | self.wait_until_visible("#save-changes-for-switch", poll=3) | 111 | # Ensure scrolled into view |
112 | btn_save_chg_for_switch = self.wait_until_clickable( | 112 | self.driver.execute_script('window.scrollTo({behavior: "instant", top: 0, left: 0})') |
113 | "#save-changes-for-switch", poll=3) | 113 | btn_save_chg_for_switch = self.wait_until_clickable( |
114 | btn_save_chg_for_switch.click() | 114 | "#save-changes-for-switch") |
115 | except ElementClickInterceptedException: | 115 | btn_save_chg_for_switch.click() |
116 | self.skipTest( | ||
117 | "save-changes-for-switch click intercepted. Element not visible or maybe covered by another element.") | ||
118 | except TimeoutException: | ||
119 | self.skipTest( | ||
120 | "save-changes-for-switch is not clickable within the specified timeout.") | ||
121 | 116 | ||
122 | self.wait_until_visible("#edit-layer-source") | 117 | self.wait_until_visible("#edit-layer-source") |
123 | 118 | ||
@@ -147,17 +142,10 @@ class TestLayerDetailsPage(SeleniumTestCase): | |||
147 | new_dir = "/home/test/my-meta-dir" | 142 | new_dir = "/home/test/my-meta-dir" |
148 | dir_input.send_keys(new_dir) | 143 | dir_input.send_keys(new_dir) |
149 | 144 | ||
150 | try: | 145 | self.wait_until_visible("#save-changes-for-switch") |
151 | self.wait_until_visible("#save-changes-for-switch", poll=3) | 146 | btn_save_chg_for_switch = self.wait_until_clickable( |
152 | btn_save_chg_for_switch = self.wait_until_clickable( | 147 | "#save-changes-for-switch") |
153 | "#save-changes-for-switch", poll=3) | 148 | btn_save_chg_for_switch.click() |
154 | btn_save_chg_for_switch.click() | ||
155 | except ElementClickInterceptedException: | ||
156 | self.skipTest( | ||
157 | "save-changes-for-switch click intercepted. Element not properly visible or maybe behind another element.") | ||
158 | except TimeoutException: | ||
159 | self.skipTest( | ||
160 | "save-changes-for-switch is not clickable within the specified timeout.") | ||
161 | 149 | ||
162 | self.wait_until_visible("#edit-layer-source") | 150 | self.wait_until_visible("#edit-layer-source") |
163 | 151 | ||
@@ -168,12 +156,6 @@ class TestLayerDetailsPage(SeleniumTestCase): | |||
168 | "Expected %s in the dir value for layer directory" % | 156 | "Expected %s in the dir value for layer directory" % |
169 | new_dir) | 157 | new_dir) |
170 | 158 | ||
171 | def test_edit_layerdetails_page(self): | ||
172 | try: | ||
173 | self._edit_layerdetails() | ||
174 | except ElementClickInterceptedException: | ||
175 | self.skipTest( | ||
176 | "ElementClickInterceptedException occured. Element not visible or maybe covered by another element.") | ||
177 | 159 | ||
178 | def test_delete_layer(self): | 160 | def test_delete_layer(self): |
179 | """ Delete the layer """ | 161 | """ Delete the layer """ |
@@ -211,6 +193,7 @@ class TestLayerDetailsPage(SeleniumTestCase): | |||
211 | self.get(self.url) | 193 | self.get(self.url) |
212 | 194 | ||
213 | # Add the layer | 195 | # Add the layer |
196 | self.wait_until_clickable("#add-remove-layer-btn") | ||
214 | self.click("#add-remove-layer-btn") | 197 | self.click("#add-remove-layer-btn") |
215 | 198 | ||
216 | notification = self.wait_until_visible("#change-notification-msg") | 199 | notification = self.wait_until_visible("#change-notification-msg") |
@@ -218,12 +201,17 @@ class TestLayerDetailsPage(SeleniumTestCase): | |||
218 | expected_text = "You have added 1 layer to your project: %s" % \ | 201 | expected_text = "You have added 1 layer to your project: %s" % \ |
219 | self.imported_layer_version.layer.name | 202 | self.imported_layer_version.layer.name |
220 | 203 | ||
221 | self.assertTrue(expected_text in notification.text, | 204 | self.assertIn(expected_text, notification.text, |
222 | "Expected notification text %s not found was " | 205 | "Expected notification text %s not found was " |
223 | " \"%s\" instead" % | 206 | " \"%s\" instead" % |
224 | (expected_text, notification.text)) | 207 | (expected_text, notification.text)) |
225 | 208 | ||
209 | hide_button = self.find('#hide-alert') | ||
210 | hide_button.click() | ||
211 | self.wait_until_not_visible('#change-notification') | ||
212 | |||
226 | # Remove the layer | 213 | # Remove the layer |
214 | self.wait_until_clickable("#add-remove-layer-btn") | ||
227 | self.click("#add-remove-layer-btn") | 215 | self.click("#add-remove-layer-btn") |
228 | 216 | ||
229 | notification = self.wait_until_visible("#change-notification-msg") | 217 | notification = self.wait_until_visible("#change-notification-msg") |
@@ -231,7 +219,7 @@ class TestLayerDetailsPage(SeleniumTestCase): | |||
231 | expected_text = "You have removed 1 layer from your project: %s" % \ | 219 | expected_text = "You have removed 1 layer from your project: %s" % \ |
232 | self.imported_layer_version.layer.name | 220 | self.imported_layer_version.layer.name |
233 | 221 | ||
234 | self.assertTrue(expected_text in notification.text, | 222 | self.assertIn(expected_text, notification.text, |
235 | "Expected notification text %s not found was " | 223 | "Expected notification text %s not found was " |
236 | " \"%s\" instead" % | 224 | " \"%s\" instead" % |
237 | (expected_text, notification.text)) | 225 | (expected_text, notification.text)) |