mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 12:29:55 +00:00
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>
This commit is contained in:
@@ -36,10 +36,10 @@ class TestProjectConfig(SeleniumFunctionalTestCase):
|
|||||||
|
|
||||||
url = reverse('projectconf', args=(TestProjectConfig.project_id,))
|
url = reverse('projectconf', args=(TestProjectConfig.project_id,))
|
||||||
self.get(url)
|
self.get(url)
|
||||||
self.wait_until_visible('#config-nav', poll=3)
|
self.wait_until_visible('#config-nav')
|
||||||
bbv_page_link = self._get_config_nav_item(9)
|
bbv_page_link = self._get_config_nav_item(9)
|
||||||
bbv_page_link.click()
|
bbv_page_link.click()
|
||||||
self.wait_until_visible('#config-nav', poll=3)
|
self.wait_until_visible('#config-nav')
|
||||||
|
|
||||||
def test_no_underscore_iamgefs_type(self):
|
def test_no_underscore_iamgefs_type(self):
|
||||||
"""
|
"""
|
||||||
@@ -48,13 +48,13 @@ class TestProjectConfig(SeleniumFunctionalTestCase):
|
|||||||
self._navigate_bbv_page()
|
self._navigate_bbv_page()
|
||||||
imagefs_type = "foo_bar"
|
imagefs_type = "foo_bar"
|
||||||
|
|
||||||
self.wait_until_visible('#change-image_fstypes-icon', poll=2)
|
self.wait_until_visible('#change-image_fstypes-icon')
|
||||||
|
|
||||||
self.click('#change-image_fstypes-icon')
|
self.click('#change-image_fstypes-icon')
|
||||||
|
|
||||||
self.enter_text('#new-imagefs_types', imagefs_type)
|
self.enter_text('#new-imagefs_types', imagefs_type)
|
||||||
|
|
||||||
element = self.wait_until_visible('#hintError-image-fs_type', poll=2)
|
element = self.wait_until_visible('#hintError-image-fs_type')
|
||||||
|
|
||||||
self.assertTrue(("A valid image type cannot include underscores" in element.text),
|
self.assertTrue(("A valid image type cannot include underscores" in element.text),
|
||||||
"Did not find underscore error message")
|
"Did not find underscore error message")
|
||||||
@@ -68,7 +68,7 @@ class TestProjectConfig(SeleniumFunctionalTestCase):
|
|||||||
|
|
||||||
imagefs_type = "btrfs"
|
imagefs_type = "btrfs"
|
||||||
|
|
||||||
self.wait_until_visible('#change-image_fstypes-icon', poll=2)
|
self.wait_until_visible('#change-image_fstypes-icon')
|
||||||
|
|
||||||
self.click('#change-image_fstypes-icon')
|
self.click('#change-image_fstypes-icon')
|
||||||
|
|
||||||
@@ -87,22 +87,20 @@ class TestProjectConfig(SeleniumFunctionalTestCase):
|
|||||||
"""
|
"""
|
||||||
self._navigate_bbv_page()
|
self._navigate_bbv_page()
|
||||||
|
|
||||||
self.wait_until_visible('#change-image_fstypes-icon', poll=2)
|
self.wait_until_visible('#change-image_fstypes-icon')
|
||||||
|
|
||||||
self.click('#change-image_fstypes-icon')
|
self.click('#change-image_fstypes-icon')
|
||||||
|
|
||||||
checkboxes_selector = '.fs-checkbox-fstypes'
|
checkboxes_selector = '.fs-checkbox-fstypes'
|
||||||
|
|
||||||
self.wait_until_visible(checkboxes_selector, poll=2)
|
self.wait_until_visible(checkboxes_selector)
|
||||||
checkboxes = self.find_all(checkboxes_selector)
|
checkboxes = self.find_all(checkboxes_selector)
|
||||||
|
|
||||||
for checkbox in checkboxes:
|
for checkbox in checkboxes:
|
||||||
if checkbox.get_attribute("value") == "cpio":
|
if checkbox.get_attribute("value") == "cpio":
|
||||||
checkbox.click()
|
checkbox.click()
|
||||||
|
self.wait_until_visible('#new-imagefs_types')
|
||||||
element = self.driver.find_element(By.ID, 'new-imagefs_types')
|
element = self.driver.find_element(By.ID, 'new-imagefs_types')
|
||||||
|
|
||||||
self.wait_until_visible('#new-imagefs_types', poll=2)
|
|
||||||
|
|
||||||
self.assertTrue(("cpio" in element.get_attribute('value'),
|
self.assertTrue(("cpio" in element.get_attribute('value'),
|
||||||
"Imagefs not added into the textbox"))
|
"Imagefs not added into the textbox"))
|
||||||
checkbox.click()
|
checkbox.click()
|
||||||
@@ -118,20 +116,19 @@ class TestProjectConfig(SeleniumFunctionalTestCase):
|
|||||||
|
|
||||||
# activate the input to edit download dir
|
# activate the input to edit download dir
|
||||||
try:
|
try:
|
||||||
change_dl_dir_btn = self.wait_until_visible('#change-dl_dir-icon', poll=2)
|
change_dl_dir_btn = self.wait_until_visible('#change-dl_dir-icon')
|
||||||
except TimeoutException:
|
except TimeoutException:
|
||||||
# If download dir is not displayed, test is skipped
|
# If download dir is not displayed, test is skipped
|
||||||
change_dl_dir_btn = None
|
change_dl_dir_btn = None
|
||||||
|
|
||||||
if change_dl_dir_btn:
|
if change_dl_dir_btn:
|
||||||
change_dl_dir_btn = self.wait_until_visible('#change-dl_dir-icon', poll=2)
|
|
||||||
change_dl_dir_btn.click()
|
change_dl_dir_btn.click()
|
||||||
|
|
||||||
# downloads dir path doesn't start with / or ${...}
|
# downloads dir path doesn't start with / or ${...}
|
||||||
input_field = self.wait_until_visible('#new-dl_dir', poll=2)
|
input_field = self.wait_until_visible('#new-dl_dir')
|
||||||
input_field.clear()
|
input_field.clear()
|
||||||
self.enter_text('#new-dl_dir', 'home/foo')
|
self.enter_text('#new-dl_dir', 'home/foo')
|
||||||
element = self.wait_until_visible('#hintError-initialChar-dl_dir', poll=2)
|
element = self.wait_until_visible('#hintError-initialChar-dl_dir')
|
||||||
|
|
||||||
msg = 'downloads directory path starts with invalid character but ' \
|
msg = 'downloads directory path starts with invalid character but ' \
|
||||||
'treated as valid'
|
'treated as valid'
|
||||||
@@ -141,7 +138,7 @@ class TestProjectConfig(SeleniumFunctionalTestCase):
|
|||||||
self.driver.find_element(By.ID, 'new-dl_dir').clear()
|
self.driver.find_element(By.ID, 'new-dl_dir').clear()
|
||||||
self.enter_text('#new-dl_dir', '/foo/bar a')
|
self.enter_text('#new-dl_dir', '/foo/bar a')
|
||||||
|
|
||||||
element = self.wait_until_visible('#hintError-dl_dir', poll=2)
|
element = self.wait_until_visible('#hintError-dl_dir')
|
||||||
msg = 'downloads directory path characters invalid but treated as valid'
|
msg = 'downloads directory path characters invalid but treated as valid'
|
||||||
self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg)
|
self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg)
|
||||||
|
|
||||||
@@ -149,7 +146,7 @@ class TestProjectConfig(SeleniumFunctionalTestCase):
|
|||||||
self.driver.find_element(By.ID,'new-dl_dir').clear()
|
self.driver.find_element(By.ID,'new-dl_dir').clear()
|
||||||
self.enter_text('#new-dl_dir', '${TOPDIR}/down foo')
|
self.enter_text('#new-dl_dir', '${TOPDIR}/down foo')
|
||||||
|
|
||||||
element = self.wait_until_visible('#hintError-dl_dir', poll=2)
|
element = self.wait_until_visible('#hintError-dl_dir')
|
||||||
msg = 'downloads directory path characters invalid but treated as valid'
|
msg = 'downloads directory path characters invalid but treated as valid'
|
||||||
self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg)
|
self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg)
|
||||||
|
|
||||||
@@ -177,10 +174,7 @@ class TestProjectConfig(SeleniumFunctionalTestCase):
|
|||||||
self._navigate_bbv_page()
|
self._navigate_bbv_page()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
btn_chg_sstate_dir = self.wait_until_visible(
|
btn_chg_sstate_dir = self.wait_until_visible('#change-sstate_dir-icon')
|
||||||
'#change-sstate_dir-icon',
|
|
||||||
poll=2
|
|
||||||
)
|
|
||||||
self.click('#change-sstate_dir-icon')
|
self.click('#change-sstate_dir-icon')
|
||||||
except TimeoutException:
|
except TimeoutException:
|
||||||
# If sstate_dir is not displayed, test is skipped
|
# If sstate_dir is not displayed, test is skipped
|
||||||
@@ -188,10 +182,10 @@ class TestProjectConfig(SeleniumFunctionalTestCase):
|
|||||||
|
|
||||||
if btn_chg_sstate_dir: # Skip continuation if sstate_dir is not displayed
|
if btn_chg_sstate_dir: # Skip continuation if sstate_dir is not displayed
|
||||||
# path doesn't start with / or ${...}
|
# path doesn't start with / or ${...}
|
||||||
input_field = self.wait_until_visible('#new-sstate_dir', poll=2)
|
input_field = self.wait_until_visible('#new-sstate_dir')
|
||||||
input_field.clear()
|
input_field.clear()
|
||||||
self.enter_text('#new-sstate_dir', 'home/foo')
|
self.enter_text('#new-sstate_dir', 'home/foo')
|
||||||
element = self.wait_until_visible('#hintError-initialChar-sstate_dir', poll=2)
|
element = self.wait_until_visible('#hintError-initialChar-sstate_dir')
|
||||||
|
|
||||||
msg = 'sstate directory path starts with invalid character but ' \
|
msg = 'sstate directory path starts with invalid character but ' \
|
||||||
'treated as valid'
|
'treated as valid'
|
||||||
@@ -201,7 +195,7 @@ class TestProjectConfig(SeleniumFunctionalTestCase):
|
|||||||
self.driver.find_element(By.ID, 'new-sstate_dir').clear()
|
self.driver.find_element(By.ID, 'new-sstate_dir').clear()
|
||||||
self.enter_text('#new-sstate_dir', '/foo/bar a')
|
self.enter_text('#new-sstate_dir', '/foo/bar a')
|
||||||
|
|
||||||
element = self.wait_until_visible('#hintError-sstate_dir', poll=2)
|
element = self.wait_until_visible('#hintError-sstate_dir')
|
||||||
msg = 'sstate directory path characters invalid but treated as valid'
|
msg = 'sstate directory path characters invalid but treated as valid'
|
||||||
self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg)
|
self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg)
|
||||||
|
|
||||||
@@ -209,7 +203,7 @@ class TestProjectConfig(SeleniumFunctionalTestCase):
|
|||||||
self.driver.find_element(By.ID,'new-sstate_dir').clear()
|
self.driver.find_element(By.ID,'new-sstate_dir').clear()
|
||||||
self.enter_text('#new-sstate_dir', '${TOPDIR}/down foo')
|
self.enter_text('#new-sstate_dir', '${TOPDIR}/down foo')
|
||||||
|
|
||||||
element = self.wait_until_visible('#hintError-sstate_dir', poll=2)
|
element = self.wait_until_visible('#hintError-sstate_dir')
|
||||||
msg = 'sstate directory path characters invalid but treated as valid'
|
msg = 'sstate directory path characters invalid but treated as valid'
|
||||||
self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg)
|
self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg)
|
||||||
|
|
||||||
@@ -233,13 +227,14 @@ class TestProjectConfig(SeleniumFunctionalTestCase):
|
|||||||
var_name, field, btn_id, input_id, value, save_btn, *_ = kwargs.values()
|
var_name, field, btn_id, input_id, value, save_btn, *_ = kwargs.values()
|
||||||
""" Change bitbake variable value """
|
""" Change bitbake variable value """
|
||||||
self._navigate_bbv_page()
|
self._navigate_bbv_page()
|
||||||
self.wait_until_visible(f'#{btn_id}', poll=2)
|
self.wait_until_visible(f'#{btn_id}')
|
||||||
if kwargs.get('new_variable'):
|
if kwargs.get('new_variable'):
|
||||||
self.find(f"#{btn_id}").clear()
|
self.find(f"#{btn_id}").clear()
|
||||||
self.enter_text(f"#{btn_id}", f"{var_name}")
|
self.enter_text(f"#{btn_id}", f"{var_name}")
|
||||||
else:
|
else:
|
||||||
self.click(f'#{btn_id}')
|
self.click(f'#{btn_id}')
|
||||||
self.wait_until_visible(f'#{input_id}', poll=2)
|
|
||||||
|
self.wait_until_visible(f'#{input_id}')
|
||||||
|
|
||||||
if kwargs.get('is_select'):
|
if kwargs.get('is_select'):
|
||||||
select = Select(self.find(f'#{input_id}'))
|
select = Select(self.find(f'#{input_id}'))
|
||||||
|
|||||||
Reference in New Issue
Block a user