aboutsummaryrefslogtreecommitdiffstats
path: root/lib/toaster/tests/functional/test_functional_basic.py
diff options
context:
space:
mode:
authorAlassane Yattara <alassane.yattara@savoirfairelinux.com>2023-12-29 16:10:21 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-01-01 23:12:42 +0000
commit1edb97f741a48481b1b9f26c5cb31acd9059f07f (patch)
treebc4cc0156e9834952c36f902d391d9ad61801184 /lib/toaster/tests/functional/test_functional_basic.py
parentc6666f6cfafd55e1c980239a7c5ff908f1a69196 (diff)
downloadbitbake-1edb97f741a48481b1b9f26c5cb31acd9059f07f.tar.gz
toaster/tests: bug-fix An element matching "#projectstable" should be visible
Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/toaster/tests/functional/test_functional_basic.py')
-rw-r--r--lib/toaster/tests/functional/test_functional_basic.py87
1 files changed, 44 insertions, 43 deletions
diff --git a/lib/toaster/tests/functional/test_functional_basic.py b/lib/toaster/tests/functional/test_functional_basic.py
index 47f7452e8..e4070fbb8 100644
--- a/lib/toaster/tests/functional/test_functional_basic.py
+++ b/lib/toaster/tests/functional/test_functional_basic.py
@@ -14,15 +14,27 @@ from tests.functional.functional_helpers import SeleniumFunctionalTestCase
from orm.models import Project
from selenium.webdriver.common.by import By
+from tests.functional.utils import get_projectId_from_url
+
+@pytest.mark.django_db
@pytest.mark.order("second_to_last")
class FuntionalTestBasic(SeleniumFunctionalTestCase):
+ """Basic functional tests for Toaster"""
+ project_id = None
+
+ def setUp(self):
+ super(FuntionalTestBasic, self).setUp()
+ if not FuntionalTestBasic.project_id:
+ self._create_slenium_project()
+ current_url = self.driver.current_url
+ FuntionalTestBasic.project_id = get_projectId_from_url(current_url)
# testcase (1514)
- @pytest.mark.django_db
- def test_create_slenium_project(self):
+ def _create_slenium_project(self):
project_name = 'selenium-project'
self.get(reverse('newproject'))
+ self.wait_until_visible('#new-project-name', poll=3)
self.driver.find_element(By.ID, "new-project-name").send_keys(project_name)
self.driver.find_element(By.ID, 'projectversion').click()
self.driver.find_element(By.ID, "create-project-button").click()
@@ -32,69 +44,68 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
"New project name not in new project notification")
self.assertTrue(Project.objects.filter(name=project_name).count(),
"New project not found in database")
+ return Project.objects.last().id
# testcase (1515)
def test_verify_left_bar_menu(self):
self.get(reverse('all-projects'))
- self.wait_until_visible('#projectstable', poll=10)
+ self.wait_until_present('#projectstable', poll=10)
self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
- self.wait_until_visible('#config-nav', poll=10)
+ self.wait_until_present('#config-nav', poll=10)
self.assertTrue(self.element_exists('#config-nav'),'Configuration Tab does not exist')
project_URL=self.get_URL()
self.driver.find_element(By.XPATH, '//a[@href="'+project_URL+'"]').click()
- self.wait_until_visible('#config-nav', poll=10)
+ self.wait_until_present('#config-nav', poll=10)
try:
self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'customimages/"'+"]").click()
- self.wait_until_visible('#config-nav', poll=10)
+ self.wait_until_present('#config-nav', poll=10)
self.assertTrue(re.search("Custom images",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'Custom images information is not loading properly')
except:
self.fail(msg='No Custom images tab available')
try:
self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'images/"'+"]").click()
- self.wait_until_visible('#config-nav', poll=10)
+ self.wait_until_present('#config-nav', poll=10)
self.assertTrue(re.search("Compatible image recipes",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Compatible image recipes information is not loading properly')
except:
self.fail(msg='No Compatible image tab available')
try:
self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'softwarerecipes/"'+"]").click()
- self.wait_until_visible('#config-nav', poll=10)
+ self.wait_until_present('#config-nav', poll=10)
self.assertTrue(re.search("Compatible software recipes",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Compatible software recipe information is not loading properly')
except:
self.fail(msg='No Compatible software recipe tab available')
try:
self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'machines/"'+"]").click()
- self.wait_until_visible('#config-nav', poll=10)
+ self.wait_until_present('#config-nav', poll=10)
self.assertTrue(re.search("Compatible machines",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Compatible machine information is not loading properly')
except:
self.fail(msg='No Compatible machines tab available')
try:
self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'layers/"'+"]").click()
- self.wait_until_visible('#config-nav', poll=10)
+ self.wait_until_present('#config-nav', poll=10)
self.assertTrue(re.search("Compatible layers",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Compatible layer information is not loading properly')
except:
self.fail(msg='No Compatible layers tab available')
try:
self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'configuration"'+"]").click()
- self.wait_until_visible('#config-nav', poll=10)
+ self.wait_until_present('#config-nav', poll=10)
self.assertTrue(re.search("Bitbake variables",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Bitbake variables information is not loading properly')
except:
self.fail(msg='No Bitbake variables tab available')
# testcase (1516)
def test_review_configuration_information(self):
- self.get('')
- self.wait_until_visible('#global-nav', poll=10)
- self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click()
- self.wait_until_visible('#projectstable', poll=10)
+ self.get(reverse('all-projects'))
+ self.wait_until_present('#projectstable', poll=10)
self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
project_URL=self.get_URL()
- self.wait_until_visible('#config-nav', poll=10)
+ self.wait_until_present('#config-nav', poll=10)
try:
self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist')
self.assertTrue(re.search("qemux86-64",self.driver.find_element(By.XPATH, "//span[@id='project-machine-name']").text),'The machine type is not assigned')
@@ -134,12 +145,10 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
# testcase (1517)
def test_verify_machine_information(self):
- self.get('')
- self.wait_until_visible('#global-nav', poll=10)
- self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click()
- self.wait_until_visible('#projectstable', poll=10)
+ self.get(reverse('all-projects'))
+ self.wait_until_present('#projectstable', poll=10)
self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
- self.wait_until_visible('#config-nav', poll=10)
+ self.wait_until_present('#config-nav', poll=10)
try:
self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist')
@@ -153,29 +162,25 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
# testcase (1518)
def test_verify_most_built_recipes_information(self):
- self.get('')
- self.wait_until_visible('#global-nav', poll=10)
- self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click()
- self.wait_until_visible('#projectstable', poll=10)
+ self.get(reverse('all-projects'))
+ self.wait_until_present('#projectstable', poll=10)
self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
- self.wait_until_visible('#config-nav', poll=10)
+ self.wait_until_present('#config-nav', poll=10)
project_URL=self.get_URL()
try:
self.assertTrue(re.search("You haven't built any recipes yet",self.driver.find_element(By.ID, "no-most-built").text),'Default message of no builds is not present')
self.driver.find_element(By.XPATH, "//div[@id='no-most-built']/p/a[@href="+'"'+project_URL+'images/"'+"]").click()
- self.wait_until_visible('#config-nav', poll=10)
+ self.wait_until_present('#config-nav', poll=10)
self.assertTrue(re.search("Compatible image recipes",self.driver.find_element(By.XPATH, "//div[@class='col-md-10']").text),'The Choose a recipe to build link is not working properly')
except:
self.fail(msg='No Most built information in project detail page')
# testcase (1519)
def test_verify_project_release_information(self):
- self.get('')
- self.wait_until_visible('#global-nav', poll=10)
- self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click()
- self.wait_until_visible('#projectstable', poll=10)
+ self.get(reverse('all-projects'))
+ self.wait_until_present('#projectstable', poll=10)
self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
- self.wait_until_visible('#config-nav', poll=10)
+ self.wait_until_present('#config-nav', poll=10)
try:
self.assertTrue(re.search("Yocto Project master",self.driver.find_element(By.ID, "project-release-title").text),'The project release is not defined')
@@ -184,12 +189,10 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
# testcase (1520)
def test_verify_layer_information(self):
- self.get('')
- self.wait_until_visible('#global-nav', poll=10)
- self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click()
- self.wait_until_visible('#projectstable', poll=10)
+ self.get(reverse('all-projects'))
+ self.wait_until_present('#projectstable', poll=10)
self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
- self.wait_until_visible('#config-nav', poll=10)
+ self.wait_until_present('#config-nav', poll=10)
project_URL=self.get_URL()
try:
self.driver.find_element(By.XPATH, "//div[@id='layer-container']")
@@ -216,15 +219,13 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase):
# testcase (1521)
def test_verify_project_detail_links(self):
- self.get('')
- self.wait_until_visible('#global-nav', poll=10)
- self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click()
- self.wait_until_visible('#projectstable', poll=10)
+ self.get(reverse('all-projects'))
+ self.wait_until_present('#projectstable', poll=10)
self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click()
- self.wait_until_visible('#config-nav', poll=10)
+ self.wait_until_present('#config-nav', poll=10)
project_URL=self.get_URL()
self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li[@id='topbar-configuration-tab']/a[@href="+'"'+project_URL+'"'+"]").click()
- self.wait_until_visible('#config-nav', poll=10)
+ self.wait_until_present('#config-nav', poll=10)
self.assertTrue(re.search("Configuration",self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li[@id='topbar-configuration-tab']/a[@href="+'"'+project_URL+'"'+"]").text), 'Configuration tab in project topbar is misspelled')
try: