summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/tests
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2024-10-17 23:06:39 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-10-24 11:24:03 +0100
commitf599d2c702eae209557c4d2205c64fa994200574 (patch)
tree46ede2ae661727eac45a6f5b521b4ca4d1c8895a /bitbake/lib/toaster/tests
parentd4288a778557ebfc2653bf9e570ae3f131702a14 (diff)
downloadpoky-f599d2c702eae209557c4d2205c64fa994200574.tar.gz
bitbake: toaster/tests/project_config: Reuse common project creation code
Switch this test module to use the common project creation code which contains race fixes. That code requires the database access wrapper be dropped and we no longer have ordering constraints. (Bitbake rev: 653233a1c798d71800b41d3321203a48aa0337d8) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/tests')
-rw-r--r--bitbake/lib/toaster/tests/functional/test_project_config.py50
1 files changed, 4 insertions, 46 deletions
diff --git a/bitbake/lib/toaster/tests/functional/test_project_config.py b/bitbake/lib/toaster/tests/functional/test_project_config.py
index dbee36aa4e..41149e5e55 100644
--- a/bitbake/lib/toaster/tests/functional/test_project_config.py
+++ b/bitbake/lib/toaster/tests/functional/test_project_config.py
@@ -7,7 +7,6 @@
7# 7#
8 8
9import string 9import string
10import random
11import pytest 10import pytest
12from django.urls import reverse 11from django.urls import reverse
13from selenium.webdriver import Keys 12from selenium.webdriver import Keys
@@ -18,9 +17,6 @@ from selenium.webdriver.common.by import By
18 17
19from .utils import get_projectId_from_url 18from .utils import get_projectId_from_url
20 19
21
22@pytest.mark.django_db
23@pytest.mark.order("last")
24class TestProjectConfig(SeleniumFunctionalTestCase): 20class TestProjectConfig(SeleniumFunctionalTestCase):
25 project_id = None 21 project_id = None
26 PROJECT_NAME = 'TestProjectConfig' 22 PROJECT_NAME = 'TestProjectConfig'
@@ -28,42 +24,6 @@ class TestProjectConfig(SeleniumFunctionalTestCase):
28 INVALID_PATH_CHAR_TEXT = 'The directory path cannot include spaces or ' \ 24 INVALID_PATH_CHAR_TEXT = 'The directory path cannot include spaces or ' \
29 'any of these characters' 25 'any of these characters'
30 26
31 def _create_project(self, project_name):
32 """ Create/Test new project using:
33 - Project Name: Any string
34 - Release: Any string
35 - Merge Toaster settings: True or False
36 """
37 self.get(reverse('newproject'))
38 self.wait_until_visible('#new-project-name', poll=2)
39 self.find("#new-project-name").send_keys(project_name)
40 select = Select(self.find("#projectversion"))
41 select.select_by_value('3')
42
43 # check merge toaster settings
44 checkbox = self.find('.checkbox-mergeattr')
45 if not checkbox.is_selected():
46 checkbox.click()
47
48 if self.PROJECT_NAME != 'TestProjectConfig':
49 # Reset project name if it's not the default one
50 self.PROJECT_NAME = 'TestProjectConfig'
51
52 self.find("#create-project-button").click()
53
54 try:
55 self.wait_until_visible('#hint-error-project-name', poll=2)
56 url = reverse('project', args=(TestProjectConfig.project_id, ))
57 self.get(url)
58 self.wait_until_visible('#config-nav', poll=3)
59 except TimeoutException:
60 self.wait_until_visible('#config-nav', poll=3)
61
62 def _random_string(self, length):
63 return ''.join(
64 random.choice(string.ascii_letters) for _ in range(length)
65 )
66
67 def _get_config_nav_item(self, index): 27 def _get_config_nav_item(self, index):
68 config_nav = self.find('#config-nav') 28 config_nav = self.find('#config-nav')
69 return config_nav.find_elements(By.TAG_NAME, 'li')[index] 29 return config_nav.find_elements(By.TAG_NAME, 'li')[index]
@@ -72,12 +32,10 @@ class TestProjectConfig(SeleniumFunctionalTestCase):
72 """ Navigate to project BitBake variables page """ 32 """ Navigate to project BitBake variables page """
73 # check if the menu is displayed 33 # check if the menu is displayed
74 if TestProjectConfig.project_id is None: 34 if TestProjectConfig.project_id is None:
75 self._create_project(project_name=self._random_string(10)) 35 TestProjectConfig.project_id = self.create_new_project(self.PROJECT_NAME, '3', None, True)
76 current_url = self.driver.current_url 36
77 TestProjectConfig.project_id = get_projectId_from_url(current_url) 37 url = reverse('projectconf', args=(TestProjectConfig.project_id,))
78 else: 38 self.get(url)
79 url = reverse('projectconf', args=(TestProjectConfig.project_id,))
80 self.get(url)
81 self.wait_until_visible('#config-nav', poll=3) 39 self.wait_until_visible('#config-nav', poll=3)
82 bbv_page_link = self._get_config_nav_item(9) 40 bbv_page_link = self._get_config_nav_item(9)
83 bbv_page_link.click() 41 bbv_page_link.click()