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

View File

@@ -140,7 +140,7 @@ class SeleniumFunctionalTestCase(SeleniumTestCaseBase):
return False
return element
def _create_test_new_project(
def create_new_project(
self,
project_name,
release,
@@ -183,6 +183,8 @@ class SeleniumFunctionalTestCase(SeleniumTestCaseBase):
if checkbox.is_selected():
checkbox.click()
self.wait_until_clickable('#create-project-button')
self.driver.find_element(By.ID, "create-project-button").click()
element = self.wait_until_visible('#project-created-notification', poll=3)
@@ -200,11 +202,17 @@ class SeleniumFunctionalTestCase(SeleniumTestCaseBase):
data = req.json()
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
self.assertTrue(re.search(
release_title,
self.driver.find_element(By.XPATH,
if release_title is not None:
self.assertTrue(re.search(
release_title,
self.driver.find_element(By.XPATH,
"//span[@id='project-release-title']"
).text),
'The project release is not defined')
'The project release is not defined')
return project_id

View File

@@ -24,7 +24,7 @@ class TestCreateNewProject(SeleniumFunctionalTestCase):
release = '3'
release_title = 'Yocto Project master'
project_name = 'projectmaster'
self._create_test_new_project(
self.create_new_project(
project_name,
release,
release_title,
@@ -40,7 +40,7 @@ class TestCreateNewProject(SeleniumFunctionalTestCase):
release = '1'
release_title = 'Yocto Project 5.0 "Scarthgap"'
project_name = 'projectscarthgap'
self._create_test_new_project(
self.create_new_project(
project_name,
release,
release_title,
@@ -56,7 +56,7 @@ class TestCreateNewProject(SeleniumFunctionalTestCase):
release = '5'
release_title = 'Yocto Project 4.0 "Kirkstone"'
project_name = 'projectkirkstone'
self._create_test_new_project(
self.create_new_project(
project_name,
release,
release_title,
@@ -72,7 +72,7 @@ class TestCreateNewProject(SeleniumFunctionalTestCase):
release = '2'
release_title = 'Local Yocto Project'
project_name = 'projectlocal'
self._create_test_new_project(
self.create_new_project(
project_name,
release,
release_title,