1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-30 00:20:08 +00:00

bitbake: toaster/tests/functional: Tweak the project creation function for better reuse

Tweak the function name and return the created project ID.

Allow the release_name test to be skipped with a value of None.

Add an extra wait call to ensure the create project button is ready
before clicking it.

(Bitbake rev: d20c6e3c67298c5db33b220a2e4a554e6f2c4418)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2024-10-17 14:42:28 +01:00
parent 86bcd2da05
commit 9ed0df26fb
2 changed files with 17 additions and 9 deletions
@@ -140,7 +140,7 @@ class SeleniumFunctionalTestCase(SeleniumTestCaseBase):
return False return False
return element return element
def _create_test_new_project( def create_new_project(
self, self,
project_name, project_name,
release, release,
@@ -183,6 +183,8 @@ class SeleniumFunctionalTestCase(SeleniumTestCaseBase):
if checkbox.is_selected(): if checkbox.is_selected():
checkbox.click() checkbox.click()
self.wait_until_clickable('#create-project-button')
self.driver.find_element(By.ID, "create-project-button").click() self.driver.find_element(By.ID, "create-project-button").click()
element = self.wait_until_visible('#project-created-notification', poll=3) element = self.wait_until_visible('#project-created-notification', poll=3)
@@ -200,11 +202,17 @@ class SeleniumFunctionalTestCase(SeleniumTestCaseBase):
data = req.json() data = req.json()
self.assertGreater(len(data['results']), 0, f"New project:{project_name} not found in database") self.assertGreater(len(data['results']), 0, f"New project:{project_name} not found in database")
project_id = data['results'][0]['id']
self.wait_until_visible('#project-release-title')
# check release # check release
self.assertTrue(re.search( if release_title is not None:
release_title, self.assertTrue(re.search(
self.driver.find_element(By.XPATH, release_title,
self.driver.find_element(By.XPATH,
"//span[@id='project-release-title']" "//span[@id='project-release-title']"
).text), ).text),
'The project release is not defined') 'The project release is not defined')
return project_id
@@ -24,7 +24,7 @@ class TestCreateNewProject(SeleniumFunctionalTestCase):
release = '3' release = '3'
release_title = 'Yocto Project master' release_title = 'Yocto Project master'
project_name = 'projectmaster' project_name = 'projectmaster'
self._create_test_new_project( self.create_new_project(
project_name, project_name,
release, release,
release_title, release_title,
@@ -40,7 +40,7 @@ class TestCreateNewProject(SeleniumFunctionalTestCase):
release = '1' release = '1'
release_title = 'Yocto Project 5.0 "Scarthgap"' release_title = 'Yocto Project 5.0 "Scarthgap"'
project_name = 'projectscarthgap' project_name = 'projectscarthgap'
self._create_test_new_project( self.create_new_project(
project_name, project_name,
release, release,
release_title, release_title,
@@ -56,7 +56,7 @@ class TestCreateNewProject(SeleniumFunctionalTestCase):
release = '5' release = '5'
release_title = 'Yocto Project 4.0 "Kirkstone"' release_title = 'Yocto Project 4.0 "Kirkstone"'
project_name = 'projectkirkstone' project_name = 'projectkirkstone'
self._create_test_new_project( self.create_new_project(
project_name, project_name,
release, release,
release_title, release_title,
@@ -72,7 +72,7 @@ class TestCreateNewProject(SeleniumFunctionalTestCase):
release = '2' release = '2'
release_title = 'Local Yocto Project' release_title = 'Local Yocto Project'
project_name = 'projectlocal' project_name = 'projectlocal'
self._create_test_new_project( self.create_new_project(
project_name, project_name,
release, release,
release_title, release_title,