diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-10-18 13:57:34 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-10-24 11:24:03 +0100 |
commit | 57bdcaf4177320cfc0f00ea49ffc166cbdc44d89 (patch) | |
tree | 04c19c932597f6cb3b1296c37a39028441a8d32c /bitbake/lib/toaster/tests/functional/test_project_config.py | |
parent | d17f42ec123ee6297a6610f36f600c307fe8036e (diff) | |
download | poky-57bdcaf4177320cfc0f00ea49ffc166cbdc44d89.tar.gz |
bitbake: toaster/tests/functional/project_config: Fix the wait calls to avoid polling
Drop poll calls within the module, adding wait calls for elements of the
page where testing showed it was needed.
(Bitbake rev: 26746eae31f126ff87e678da66dcc976e412c89b)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/tests/functional/test_project_config.py')
-rw-r--r-- | bitbake/lib/toaster/tests/functional/test_project_config.py | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/bitbake/lib/toaster/tests/functional/test_project_config.py b/bitbake/lib/toaster/tests/functional/test_project_config.py index 41149e5e55..fcb1bc3284 100644 --- a/bitbake/lib/toaster/tests/functional/test_project_config.py +++ b/bitbake/lib/toaster/tests/functional/test_project_config.py | |||
@@ -36,10 +36,10 @@ class TestProjectConfig(SeleniumFunctionalTestCase): | |||
36 | 36 | ||
37 | url = reverse('projectconf', args=(TestProjectConfig.project_id,)) | 37 | url = reverse('projectconf', args=(TestProjectConfig.project_id,)) |
38 | self.get(url) | 38 | self.get(url) |
39 | self.wait_until_visible('#config-nav', poll=3) | 39 | self.wait_until_visible('#config-nav') |
40 | bbv_page_link = self._get_config_nav_item(9) | 40 | bbv_page_link = self._get_config_nav_item(9) |
41 | bbv_page_link.click() | 41 | bbv_page_link.click() |
42 | self.wait_until_visible('#config-nav', poll=3) | 42 | self.wait_until_visible('#config-nav') |
43 | 43 | ||
44 | def test_no_underscore_iamgefs_type(self): | 44 | def test_no_underscore_iamgefs_type(self): |
45 | """ | 45 | """ |
@@ -48,13 +48,13 @@ class TestProjectConfig(SeleniumFunctionalTestCase): | |||
48 | self._navigate_bbv_page() | 48 | self._navigate_bbv_page() |
49 | imagefs_type = "foo_bar" | 49 | imagefs_type = "foo_bar" |
50 | 50 | ||
51 | self.wait_until_visible('#change-image_fstypes-icon', poll=2) | 51 | self.wait_until_visible('#change-image_fstypes-icon') |
52 | 52 | ||
53 | self.click('#change-image_fstypes-icon') | 53 | self.click('#change-image_fstypes-icon') |
54 | 54 | ||
55 | self.enter_text('#new-imagefs_types', imagefs_type) | 55 | self.enter_text('#new-imagefs_types', imagefs_type) |
56 | 56 | ||
57 | element = self.wait_until_visible('#hintError-image-fs_type', poll=2) | 57 | element = self.wait_until_visible('#hintError-image-fs_type') |
58 | 58 | ||
59 | self.assertTrue(("A valid image type cannot include underscores" in element.text), | 59 | self.assertTrue(("A valid image type cannot include underscores" in element.text), |
60 | "Did not find underscore error message") | 60 | "Did not find underscore error message") |
@@ -68,7 +68,7 @@ class TestProjectConfig(SeleniumFunctionalTestCase): | |||
68 | 68 | ||
69 | imagefs_type = "btrfs" | 69 | imagefs_type = "btrfs" |
70 | 70 | ||
71 | self.wait_until_visible('#change-image_fstypes-icon', poll=2) | 71 | self.wait_until_visible('#change-image_fstypes-icon') |
72 | 72 | ||
73 | self.click('#change-image_fstypes-icon') | 73 | self.click('#change-image_fstypes-icon') |
74 | 74 | ||
@@ -87,22 +87,20 @@ class TestProjectConfig(SeleniumFunctionalTestCase): | |||
87 | """ | 87 | """ |
88 | self._navigate_bbv_page() | 88 | self._navigate_bbv_page() |
89 | 89 | ||
90 | self.wait_until_visible('#change-image_fstypes-icon', poll=2) | 90 | self.wait_until_visible('#change-image_fstypes-icon') |
91 | |||
92 | self.click('#change-image_fstypes-icon') | 91 | self.click('#change-image_fstypes-icon') |
93 | 92 | ||
94 | checkboxes_selector = '.fs-checkbox-fstypes' | 93 | checkboxes_selector = '.fs-checkbox-fstypes' |
95 | 94 | ||
96 | self.wait_until_visible(checkboxes_selector, poll=2) | 95 | self.wait_until_visible(checkboxes_selector) |
97 | checkboxes = self.find_all(checkboxes_selector) | 96 | checkboxes = self.find_all(checkboxes_selector) |
98 | 97 | ||
99 | for checkbox in checkboxes: | 98 | for checkbox in checkboxes: |
100 | if checkbox.get_attribute("value") == "cpio": | 99 | if checkbox.get_attribute("value") == "cpio": |
101 | checkbox.click() | 100 | checkbox.click() |
101 | self.wait_until_visible('#new-imagefs_types') | ||
102 | element = self.driver.find_element(By.ID, 'new-imagefs_types') | 102 | element = self.driver.find_element(By.ID, 'new-imagefs_types') |
103 | 103 | ||
104 | self.wait_until_visible('#new-imagefs_types', poll=2) | ||
105 | |||
106 | self.assertTrue(("cpio" in element.get_attribute('value'), | 104 | self.assertTrue(("cpio" in element.get_attribute('value'), |
107 | "Imagefs not added into the textbox")) | 105 | "Imagefs not added into the textbox")) |
108 | checkbox.click() | 106 | checkbox.click() |
@@ -118,20 +116,19 @@ class TestProjectConfig(SeleniumFunctionalTestCase): | |||
118 | 116 | ||
119 | # activate the input to edit download dir | 117 | # activate the input to edit download dir |
120 | try: | 118 | try: |
121 | change_dl_dir_btn = self.wait_until_visible('#change-dl_dir-icon', poll=2) | 119 | change_dl_dir_btn = self.wait_until_visible('#change-dl_dir-icon') |
122 | except TimeoutException: | 120 | except TimeoutException: |
123 | # If download dir is not displayed, test is skipped | 121 | # If download dir is not displayed, test is skipped |
124 | change_dl_dir_btn = None | 122 | change_dl_dir_btn = None |
125 | 123 | ||
126 | if change_dl_dir_btn: | 124 | if change_dl_dir_btn: |
127 | change_dl_dir_btn = self.wait_until_visible('#change-dl_dir-icon', poll=2) | ||
128 | change_dl_dir_btn.click() | 125 | change_dl_dir_btn.click() |
129 | 126 | ||
130 | # downloads dir path doesn't start with / or ${...} | 127 | # downloads dir path doesn't start with / or ${...} |
131 | input_field = self.wait_until_visible('#new-dl_dir', poll=2) | 128 | input_field = self.wait_until_visible('#new-dl_dir') |
132 | input_field.clear() | 129 | input_field.clear() |
133 | self.enter_text('#new-dl_dir', 'home/foo') | 130 | self.enter_text('#new-dl_dir', 'home/foo') |
134 | element = self.wait_until_visible('#hintError-initialChar-dl_dir', poll=2) | 131 | element = self.wait_until_visible('#hintError-initialChar-dl_dir') |
135 | 132 | ||
136 | msg = 'downloads directory path starts with invalid character but ' \ | 133 | msg = 'downloads directory path starts with invalid character but ' \ |
137 | 'treated as valid' | 134 | 'treated as valid' |
@@ -141,7 +138,7 @@ class TestProjectConfig(SeleniumFunctionalTestCase): | |||
141 | self.driver.find_element(By.ID, 'new-dl_dir').clear() | 138 | self.driver.find_element(By.ID, 'new-dl_dir').clear() |
142 | self.enter_text('#new-dl_dir', '/foo/bar a') | 139 | self.enter_text('#new-dl_dir', '/foo/bar a') |
143 | 140 | ||
144 | element = self.wait_until_visible('#hintError-dl_dir', poll=2) | 141 | element = self.wait_until_visible('#hintError-dl_dir') |
145 | msg = 'downloads directory path characters invalid but treated as valid' | 142 | msg = 'downloads directory path characters invalid but treated as valid' |
146 | self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) | 143 | self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) |
147 | 144 | ||
@@ -149,7 +146,7 @@ class TestProjectConfig(SeleniumFunctionalTestCase): | |||
149 | self.driver.find_element(By.ID,'new-dl_dir').clear() | 146 | self.driver.find_element(By.ID,'new-dl_dir').clear() |
150 | self.enter_text('#new-dl_dir', '${TOPDIR}/down foo') | 147 | self.enter_text('#new-dl_dir', '${TOPDIR}/down foo') |
151 | 148 | ||
152 | element = self.wait_until_visible('#hintError-dl_dir', poll=2) | 149 | element = self.wait_until_visible('#hintError-dl_dir') |
153 | msg = 'downloads directory path characters invalid but treated as valid' | 150 | msg = 'downloads directory path characters invalid but treated as valid' |
154 | self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) | 151 | self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) |
155 | 152 | ||
@@ -177,10 +174,7 @@ class TestProjectConfig(SeleniumFunctionalTestCase): | |||
177 | self._navigate_bbv_page() | 174 | self._navigate_bbv_page() |
178 | 175 | ||
179 | try: | 176 | try: |
180 | btn_chg_sstate_dir = self.wait_until_visible( | 177 | btn_chg_sstate_dir = self.wait_until_visible('#change-sstate_dir-icon') |
181 | '#change-sstate_dir-icon', | ||
182 | poll=2 | ||
183 | ) | ||
184 | self.click('#change-sstate_dir-icon') | 178 | self.click('#change-sstate_dir-icon') |
185 | except TimeoutException: | 179 | except TimeoutException: |
186 | # If sstate_dir is not displayed, test is skipped | 180 | # If sstate_dir is not displayed, test is skipped |
@@ -188,10 +182,10 @@ class TestProjectConfig(SeleniumFunctionalTestCase): | |||
188 | 182 | ||
189 | if btn_chg_sstate_dir: # Skip continuation if sstate_dir is not displayed | 183 | if btn_chg_sstate_dir: # Skip continuation if sstate_dir is not displayed |
190 | # path doesn't start with / or ${...} | 184 | # path doesn't start with / or ${...} |
191 | input_field = self.wait_until_visible('#new-sstate_dir', poll=2) | 185 | input_field = self.wait_until_visible('#new-sstate_dir') |
192 | input_field.clear() | 186 | input_field.clear() |
193 | self.enter_text('#new-sstate_dir', 'home/foo') | 187 | self.enter_text('#new-sstate_dir', 'home/foo') |
194 | element = self.wait_until_visible('#hintError-initialChar-sstate_dir', poll=2) | 188 | element = self.wait_until_visible('#hintError-initialChar-sstate_dir') |
195 | 189 | ||
196 | msg = 'sstate directory path starts with invalid character but ' \ | 190 | msg = 'sstate directory path starts with invalid character but ' \ |
197 | 'treated as valid' | 191 | 'treated as valid' |
@@ -201,7 +195,7 @@ class TestProjectConfig(SeleniumFunctionalTestCase): | |||
201 | self.driver.find_element(By.ID, 'new-sstate_dir').clear() | 195 | self.driver.find_element(By.ID, 'new-sstate_dir').clear() |
202 | self.enter_text('#new-sstate_dir', '/foo/bar a') | 196 | self.enter_text('#new-sstate_dir', '/foo/bar a') |
203 | 197 | ||
204 | element = self.wait_until_visible('#hintError-sstate_dir', poll=2) | 198 | element = self.wait_until_visible('#hintError-sstate_dir') |
205 | msg = 'sstate directory path characters invalid but treated as valid' | 199 | msg = 'sstate directory path characters invalid but treated as valid' |
206 | self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) | 200 | self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) |
207 | 201 | ||
@@ -209,7 +203,7 @@ class TestProjectConfig(SeleniumFunctionalTestCase): | |||
209 | self.driver.find_element(By.ID,'new-sstate_dir').clear() | 203 | self.driver.find_element(By.ID,'new-sstate_dir').clear() |
210 | self.enter_text('#new-sstate_dir', '${TOPDIR}/down foo') | 204 | self.enter_text('#new-sstate_dir', '${TOPDIR}/down foo') |
211 | 205 | ||
212 | element = self.wait_until_visible('#hintError-sstate_dir', poll=2) | 206 | element = self.wait_until_visible('#hintError-sstate_dir') |
213 | msg = 'sstate directory path characters invalid but treated as valid' | 207 | msg = 'sstate directory path characters invalid but treated as valid' |
214 | self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) | 208 | self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) |
215 | 209 | ||
@@ -233,13 +227,14 @@ class TestProjectConfig(SeleniumFunctionalTestCase): | |||
233 | var_name, field, btn_id, input_id, value, save_btn, *_ = kwargs.values() | 227 | var_name, field, btn_id, input_id, value, save_btn, *_ = kwargs.values() |
234 | """ Change bitbake variable value """ | 228 | """ Change bitbake variable value """ |
235 | self._navigate_bbv_page() | 229 | self._navigate_bbv_page() |
236 | self.wait_until_visible(f'#{btn_id}', poll=2) | 230 | self.wait_until_visible(f'#{btn_id}') |
237 | if kwargs.get('new_variable'): | 231 | if kwargs.get('new_variable'): |
238 | self.find(f"#{btn_id}").clear() | 232 | self.find(f"#{btn_id}").clear() |
239 | self.enter_text(f"#{btn_id}", f"{var_name}") | 233 | self.enter_text(f"#{btn_id}", f"{var_name}") |
240 | else: | 234 | else: |
241 | self.click(f'#{btn_id}') | 235 | self.click(f'#{btn_id}') |
242 | self.wait_until_visible(f'#{input_id}', poll=2) | 236 | |
237 | self.wait_until_visible(f'#{input_id}') | ||
243 | 238 | ||
244 | if kwargs.get('is_select'): | 239 | if kwargs.get('is_select'): |
245 | select = Select(self.find(f'#{input_id}')) | 240 | select = Select(self.find(f'#{input_id}')) |