diff options
16 files changed, 156 insertions, 118 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index f9fcf9e4fb..0d503a5142 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py | |||
@@ -1733,7 +1733,7 @@ class CustomImageRecipe(Recipe): | |||
1733 | packages_conf += "\"" | 1733 | packages_conf += "\"" |
1734 | 1734 | ||
1735 | base_recipe_path = self.get_base_recipe_file() | 1735 | base_recipe_path = self.get_base_recipe_file() |
1736 | if base_recipe_path: | 1736 | if base_recipe_path and os.path.isfile(base_recipe_path): |
1737 | base_recipe = open(base_recipe_path, 'r').read() | 1737 | base_recipe = open(base_recipe_path, 'r').read() |
1738 | else: | 1738 | else: |
1739 | # Pass back None to trigger error message to user | 1739 | # Pass back None to trigger error message to user |
diff --git a/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py b/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py index 644d45fe58..9a4e27a3bc 100644 --- a/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py +++ b/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py | |||
@@ -21,6 +21,7 @@ import unittest | |||
21 | 21 | ||
22 | from selenium import webdriver | 22 | from selenium import webdriver |
23 | from selenium.webdriver.support.ui import WebDriverWait | 23 | from selenium.webdriver.support.ui import WebDriverWait |
24 | from selenium.webdriver.common.by import By | ||
24 | from selenium.webdriver.common.desired_capabilities import DesiredCapabilities | 25 | from selenium.webdriver.common.desired_capabilities import DesiredCapabilities |
25 | from selenium.common.exceptions import NoSuchElementException, \ | 26 | from selenium.common.exceptions import NoSuchElementException, \ |
26 | StaleElementReferenceException, TimeoutException | 27 | StaleElementReferenceException, TimeoutException |
@@ -32,9 +33,7 @@ def create_selenium_driver(cls,browser='chrome'): | |||
32 | browser = env_browser | 33 | browser = env_browser |
33 | 34 | ||
34 | if browser == 'chrome': | 35 | if browser == 'chrome': |
35 | return webdriver.Chrome( | 36 | return webdriver.Chrome() |
36 | service_args=["--verbose", "--log-path=selenium.log"] | ||
37 | ) | ||
38 | elif browser == 'firefox': | 37 | elif browser == 'firefox': |
39 | return webdriver.Firefox() | 38 | return webdriver.Firefox() |
40 | elif browser == 'marionette': | 39 | elif browser == 'marionette': |
@@ -153,11 +152,11 @@ class SeleniumTestCaseBase(unittest.TestCase): | |||
153 | 152 | ||
154 | def find(self, selector): | 153 | def find(self, selector): |
155 | """ Find single element by CSS selector """ | 154 | """ Find single element by CSS selector """ |
156 | return self.driver.find_element_by_css_selector(selector) | 155 | return self.driver.find_element(By.CSS_SELECTOR, selector) |
157 | 156 | ||
158 | def find_all(self, selector): | 157 | def find_all(self, selector): |
159 | """ Find all elements matching CSS selector """ | 158 | """ Find all elements matching CSS selector """ |
160 | return self.driver.find_elements_by_css_selector(selector) | 159 | return self.driver.find_elements(By.CSS_SELECTOR, selector) |
161 | 160 | ||
162 | def element_exists(self, selector): | 161 | def element_exists(self, selector): |
163 | """ | 162 | """ |
diff --git a/bitbake/lib/toaster/tests/browser/test_all_builds_page.py b/bitbake/lib/toaster/tests/browser/test_all_builds_page.py index 8423d3dab2..d4312bb35b 100644 --- a/bitbake/lib/toaster/tests/browser/test_all_builds_page.py +++ b/bitbake/lib/toaster/tests/browser/test_all_builds_page.py | |||
@@ -7,7 +7,7 @@ | |||
7 | # SPDX-License-Identifier: GPL-2.0-only | 7 | # SPDX-License-Identifier: GPL-2.0-only |
8 | # | 8 | # |
9 | 9 | ||
10 | import re | 10 | import re, time |
11 | 11 | ||
12 | from django.urls import reverse | 12 | from django.urls import reverse |
13 | from django.utils import timezone | 13 | from django.utils import timezone |
@@ -15,6 +15,8 @@ from tests.browser.selenium_helpers import SeleniumTestCase | |||
15 | 15 | ||
16 | from orm.models import BitbakeVersion, Release, Project, Build, Target | 16 | from orm.models import BitbakeVersion, Release, Project, Build, Target |
17 | 17 | ||
18 | from selenium.webdriver.common.by import By | ||
19 | |||
18 | 20 | ||
19 | class TestAllBuildsPage(SeleniumTestCase): | 21 | class TestAllBuildsPage(SeleniumTestCase): |
20 | """ Tests for all builds page /builds/ """ | 22 | """ Tests for all builds page /builds/ """ |
@@ -91,7 +93,7 @@ class TestAllBuildsPage(SeleniumTestCase): | |||
91 | found_row = None | 93 | found_row = None |
92 | for row in rows: | 94 | for row in rows: |
93 | 95 | ||
94 | outcome_links = row.find_elements_by_css_selector(selector) | 96 | outcome_links = row.find_elements(By.CSS_SELECTOR, selector) |
95 | if len(outcome_links) == 1: | 97 | if len(outcome_links) == 1: |
96 | found_row = row | 98 | found_row = row |
97 | break | 99 | break |
@@ -131,17 +133,19 @@ class TestAllBuildsPage(SeleniumTestCase): | |||
131 | url = reverse('all-builds') | 133 | url = reverse('all-builds') |
132 | self.get(url) | 134 | self.get(url) |
133 | 135 | ||
136 | # should see a rebuild button for non-command-line builds | ||
137 | selector = 'div[data-latest-build-result="%s"] .rebuild-btn' % build1.id | ||
138 | time.sleep(2) | ||
139 | run_again_button = self.find_all(selector) | ||
140 | self.assertEqual(len(run_again_button), 1, | ||
141 | 'should see a rebuild button for non-cli builds') | ||
142 | |||
134 | # shouldn't see a rebuild button for command-line builds | 143 | # shouldn't see a rebuild button for command-line builds |
135 | selector = 'div[data-latest-build-result="%s"] .rebuild-btn' % default_build.id | 144 | selector = 'div[data-latest-build-result="%s"] .rebuild-btn' % default_build.id |
136 | run_again_button = self.find_all(selector) | 145 | run_again_button = self.find_all(selector) |
137 | self.assertEqual(len(run_again_button), 0, | 146 | self.assertEqual(len(run_again_button), 0, |
138 | 'should not see a rebuild button for cli builds') | 147 | 'should not see a rebuild button for cli builds') |
139 | 148 | ||
140 | # should see a rebuild button for non-command-line builds | ||
141 | selector = 'div[data-latest-build-result="%s"] .rebuild-btn' % build1.id | ||
142 | run_again_button = self.find_all(selector) | ||
143 | self.assertEqual(len(run_again_button), 1, | ||
144 | 'should see a rebuild button for non-cli builds') | ||
145 | 149 | ||
146 | def test_tooltips_on_project_name(self): | 150 | def test_tooltips_on_project_name(self): |
147 | """ | 151 | """ |
@@ -198,24 +202,24 @@ class TestAllBuildsPage(SeleniumTestCase): | |||
198 | 202 | ||
199 | # test recent builds area for successful build | 203 | # test recent builds area for successful build |
200 | element = self._get_build_time_element(build1) | 204 | element = self._get_build_time_element(build1) |
201 | links = element.find_elements_by_css_selector('a') | 205 | links = element.find_elements(By.CSS_SELECTOR, 'a') |
202 | msg = 'should be a link on the build time for a successful recent build' | 206 | msg = 'should be a link on the build time for a successful recent build' |
203 | self.assertEquals(len(links), 1, msg) | 207 | self.assertEquals(len(links), 1, msg) |
204 | 208 | ||
205 | # test recent builds area for failed build | 209 | # test recent builds area for failed build |
206 | element = self._get_build_time_element(build2) | 210 | element = self._get_build_time_element(build2) |
207 | links = element.find_elements_by_css_selector('a') | 211 | links = element.find_elements(By.CSS_SELECTOR, 'a') |
208 | msg = 'should not be a link on the build time for a failed recent build' | 212 | msg = 'should not be a link on the build time for a failed recent build' |
209 | self.assertEquals(len(links), 0, msg) | 213 | self.assertEquals(len(links), 0, msg) |
210 | 214 | ||
211 | # test the time column for successful build | 215 | # test the time column for successful build |
212 | build1_row = self._get_row_for_build(build1) | 216 | build1_row = self._get_row_for_build(build1) |
213 | links = build1_row.find_elements_by_css_selector('td.time a') | 217 | links = build1_row.find_elements(By.CSS_SELECTOR, 'td.time a') |
214 | msg = 'should be a link on the build time for a successful build' | 218 | msg = 'should be a link on the build time for a successful build' |
215 | self.assertEquals(len(links), 1, msg) | 219 | self.assertEquals(len(links), 1, msg) |
216 | 220 | ||
217 | # test the time column for failed build | 221 | # test the time column for failed build |
218 | build2_row = self._get_row_for_build(build2) | 222 | build2_row = self._get_row_for_build(build2) |
219 | links = build2_row.find_elements_by_css_selector('td.time a') | 223 | links = build2_row.find_elements(By.CSS_SELECTOR, 'td.time a') |
220 | msg = 'should not be a link on the build time for a failed build' | 224 | msg = 'should not be a link on the build time for a failed build' |
221 | self.assertEquals(len(links), 0, msg) | 225 | self.assertEquals(len(links), 0, msg) |
diff --git a/bitbake/lib/toaster/tests/browser/test_all_projects_page.py b/bitbake/lib/toaster/tests/browser/test_all_projects_page.py index 15b03400f9..3389d32366 100644 --- a/bitbake/lib/toaster/tests/browser/test_all_projects_page.py +++ b/bitbake/lib/toaster/tests/browser/test_all_projects_page.py | |||
@@ -16,6 +16,8 @@ from tests.browser.selenium_helpers import SeleniumTestCase | |||
16 | from orm.models import BitbakeVersion, Release, Project, Build | 16 | from orm.models import BitbakeVersion, Release, Project, Build |
17 | from orm.models import ProjectVariable | 17 | from orm.models import ProjectVariable |
18 | 18 | ||
19 | from selenium.webdriver.common.by import By | ||
20 | |||
19 | class TestAllProjectsPage(SeleniumTestCase): | 21 | class TestAllProjectsPage(SeleniumTestCase): |
20 | """ Browser tests for projects page /projects/ """ | 22 | """ Browser tests for projects page /projects/ """ |
21 | 23 | ||
@@ -117,7 +119,7 @@ class TestAllProjectsPage(SeleniumTestCase): | |||
117 | 119 | ||
118 | # check the release text for the default project | 120 | # check the release text for the default project |
119 | selector = 'span[data-project-field="release"] span.text-muted' | 121 | selector = 'span[data-project-field="release"] span.text-muted' |
120 | element = default_project_row.find_element_by_css_selector(selector) | 122 | element = default_project_row.find_element(By.CSS_SELECTOR, selector) |
121 | text = element.text.strip() | 123 | text = element.text.strip() |
122 | self.assertEqual(text, 'Not applicable', | 124 | self.assertEqual(text, 'Not applicable', |
123 | 'release should be "not applicable" for default project') | 125 | 'release should be "not applicable" for default project') |
@@ -127,7 +129,7 @@ class TestAllProjectsPage(SeleniumTestCase): | |||
127 | 129 | ||
128 | # check the link in the release cell for the other project | 130 | # check the link in the release cell for the other project |
129 | selector = 'span[data-project-field="release"]' | 131 | selector = 'span[data-project-field="release"]' |
130 | element = other_project_row.find_element_by_css_selector(selector) | 132 | element = other_project_row.find_element(By.CSS_SELECTOR, selector) |
131 | text = element.text.strip() | 133 | text = element.text.strip() |
132 | self.assertEqual(text, self.release.name, | 134 | self.assertEqual(text, self.release.name, |
133 | 'release name should be shown for non-default project') | 135 | 'release name should be shown for non-default project') |
@@ -152,7 +154,7 @@ class TestAllProjectsPage(SeleniumTestCase): | |||
152 | 154 | ||
153 | # check the machine cell for the default project | 155 | # check the machine cell for the default project |
154 | selector = 'span[data-project-field="machine"] span.text-muted' | 156 | selector = 'span[data-project-field="machine"] span.text-muted' |
155 | element = default_project_row.find_element_by_css_selector(selector) | 157 | element = default_project_row.find_element(By.CSS_SELECTOR, selector) |
156 | text = element.text.strip() | 158 | text = element.text.strip() |
157 | self.assertEqual(text, 'Not applicable', | 159 | self.assertEqual(text, 'Not applicable', |
158 | 'machine should be not applicable for default project') | 160 | 'machine should be not applicable for default project') |
@@ -162,7 +164,7 @@ class TestAllProjectsPage(SeleniumTestCase): | |||
162 | 164 | ||
163 | # check the link in the machine cell for the other project | 165 | # check the link in the machine cell for the other project |
164 | selector = 'span[data-project-field="machine"]' | 166 | selector = 'span[data-project-field="machine"]' |
165 | element = other_project_row.find_element_by_css_selector(selector) | 167 | element = other_project_row.find_element(By.CSS_SELECTOR, selector) |
166 | text = element.text.strip() | 168 | text = element.text.strip() |
167 | self.assertEqual(text, self.MACHINE_NAME, | 169 | self.assertEqual(text, self.MACHINE_NAME, |
168 | 'machine name should be shown for non-default project') | 170 | 'machine name should be shown for non-default project') |
@@ -187,7 +189,7 @@ class TestAllProjectsPage(SeleniumTestCase): | |||
187 | 189 | ||
188 | # check the link on the name field | 190 | # check the link on the name field |
189 | selector = 'span[data-project-field="name"] a' | 191 | selector = 'span[data-project-field="name"] a' |
190 | element = default_project_row.find_element_by_css_selector(selector) | 192 | element = default_project_row.find_element(By.CSS_SELECTOR, selector) |
191 | link_url = element.get_attribute('href').strip() | 193 | link_url = element.get_attribute('href').strip() |
192 | expected_url = reverse('projectbuilds', args=(self.default_project.id,)) | 194 | expected_url = reverse('projectbuilds', args=(self.default_project.id,)) |
193 | msg = 'link on default project name should point to builds but was %s' % link_url | 195 | msg = 'link on default project name should point to builds but was %s' % link_url |
@@ -198,7 +200,7 @@ class TestAllProjectsPage(SeleniumTestCase): | |||
198 | 200 | ||
199 | # check the link for the other project | 201 | # check the link for the other project |
200 | selector = 'span[data-project-field="name"] a' | 202 | selector = 'span[data-project-field="name"] a' |
201 | element = other_project_row.find_element_by_css_selector(selector) | 203 | element = other_project_row.find_element(By.CSS_SELECTOR, selector) |
202 | link_url = element.get_attribute('href').strip() | 204 | link_url = element.get_attribute('href').strip() |
203 | expected_url = reverse('project', args=(self.project.id,)) | 205 | expected_url = reverse('project', args=(self.project.id,)) |
204 | msg = 'link on project name should point to configuration but was %s' % link_url | 206 | msg = 'link on project name should point to configuration but was %s' % link_url |
diff --git a/bitbake/lib/toaster/tests/browser/test_builddashboard_page.py b/bitbake/lib/toaster/tests/browser/test_builddashboard_page.py index efcd89b346..1afa4a4d32 100644 --- a/bitbake/lib/toaster/tests/browser/test_builddashboard_page.py +++ b/bitbake/lib/toaster/tests/browser/test_builddashboard_page.py | |||
@@ -15,6 +15,8 @@ from tests.browser.selenium_helpers import SeleniumTestCase | |||
15 | from orm.models import Project, Release, BitbakeVersion, Build, LogMessage | 15 | from orm.models import Project, Release, BitbakeVersion, Build, LogMessage |
16 | from orm.models import Layer, Layer_Version, Recipe, CustomImageRecipe, Variable | 16 | from orm.models import Layer, Layer_Version, Recipe, CustomImageRecipe, Variable |
17 | 17 | ||
18 | from selenium.webdriver.common.by import By | ||
19 | |||
18 | class TestBuildDashboardPage(SeleniumTestCase): | 20 | class TestBuildDashboardPage(SeleniumTestCase): |
19 | """ Tests for the build dashboard /build/X """ | 21 | """ Tests for the build dashboard /build/X """ |
20 | 22 | ||
@@ -183,7 +185,7 @@ class TestBuildDashboardPage(SeleniumTestCase): | |||
183 | 185 | ||
184 | found = False | 186 | found = False |
185 | for element in message_elements: | 187 | for element in message_elements: |
186 | log_message_text = element.find_element_by_tag_name('pre').text.strip() | 188 | log_message_text = element.find_element(By.TAG_NAME, 'pre').text.strip() |
187 | text_matches = (log_message_text == expected_text) | 189 | text_matches = (log_message_text == expected_text) |
188 | 190 | ||
189 | log_message_pk = element.get_attribute('data-log-message-id') | 191 | log_message_pk = element.get_attribute('data-log-message-id') |
@@ -213,7 +215,7 @@ class TestBuildDashboardPage(SeleniumTestCase): | |||
213 | the WebElement modal match the list of text values in expected | 215 | the WebElement modal match the list of text values in expected |
214 | """ | 216 | """ |
215 | # labels containing the radio buttons we're testing for | 217 | # labels containing the radio buttons we're testing for |
216 | labels = modal.find_elements_by_css_selector(".radio") | 218 | labels = modal.find_elements(By.CSS_SELECTOR,".radio") |
217 | 219 | ||
218 | labels_text = [lab.text for lab in labels] | 220 | labels_text = [lab.text for lab in labels] |
219 | self.assertEqual(len(labels_text), len(expected)) | 221 | self.assertEqual(len(labels_text), len(expected)) |
@@ -248,7 +250,7 @@ class TestBuildDashboardPage(SeleniumTestCase): | |||
248 | selector = '[data-role="edit-custom-image-trigger"]' | 250 | selector = '[data-role="edit-custom-image-trigger"]' |
249 | self.click(selector) | 251 | self.click(selector) |
250 | 252 | ||
251 | modal = self.driver.find_element_by_id('edit-custom-image-modal') | 253 | modal = self.driver.find_element(By.ID, 'edit-custom-image-modal') |
252 | self.wait_until_visible("#edit-custom-image-modal") | 254 | self.wait_until_visible("#edit-custom-image-modal") |
253 | 255 | ||
254 | # recipes we expect to see in the edit custom image modal | 256 | # recipes we expect to see in the edit custom image modal |
@@ -270,7 +272,7 @@ class TestBuildDashboardPage(SeleniumTestCase): | |||
270 | selector = '[data-role="new-custom-image-trigger"]' | 272 | selector = '[data-role="new-custom-image-trigger"]' |
271 | self.click(selector) | 273 | self.click(selector) |
272 | 274 | ||
273 | modal = self.driver.find_element_by_id('new-custom-image-modal') | 275 | modal = self.driver.find_element(By.ID,'new-custom-image-modal') |
274 | self.wait_until_visible("#new-custom-image-modal") | 276 | self.wait_until_visible("#new-custom-image-modal") |
275 | 277 | ||
276 | # recipes we expect to see in the new custom image modal | 278 | # recipes we expect to see in the new custom image modal |
diff --git a/bitbake/lib/toaster/tests/browser/test_most_recent_builds_states.py b/bitbake/lib/toaster/tests/browser/test_most_recent_builds_states.py index 7844aaa395..a34a092884 100644 --- a/bitbake/lib/toaster/tests/browser/test_most_recent_builds_states.py +++ b/bitbake/lib/toaster/tests/browser/test_most_recent_builds_states.py | |||
@@ -6,7 +6,7 @@ | |||
6 | # | 6 | # |
7 | # Copyright (C) 2013-2016 Intel Corporation | 7 | # Copyright (C) 2013-2016 Intel Corporation |
8 | # | 8 | # |
9 | 9 | import time | |
10 | from django.urls import reverse | 10 | from django.urls import reverse |
11 | from django.utils import timezone | 11 | from django.utils import timezone |
12 | from tests.browser.selenium_helpers import SeleniumTestCase | 12 | from tests.browser.selenium_helpers import SeleniumTestCase |
@@ -14,6 +14,8 @@ from tests.browser.selenium_helpers_base import Wait | |||
14 | from orm.models import Project, Build, Task, Recipe, Layer, Layer_Version | 14 | from orm.models import Project, Build, Task, Recipe, Layer, Layer_Version |
15 | from bldcontrol.models import BuildRequest | 15 | from bldcontrol.models import BuildRequest |
16 | 16 | ||
17 | from selenium.webdriver.common.by import By | ||
18 | |||
17 | class TestMostRecentBuildsStates(SeleniumTestCase): | 19 | class TestMostRecentBuildsStates(SeleniumTestCase): |
18 | """ Test states update correctly in most recent builds area """ | 20 | """ Test states update correctly in most recent builds area """ |
19 | 21 | ||
@@ -62,7 +64,7 @@ class TestMostRecentBuildsStates(SeleniumTestCase): | |||
62 | element = self.wait_until_visible(selector) | 64 | element = self.wait_until_visible(selector) |
63 | 65 | ||
64 | bar_selector = '#recipes-parsed-percentage-bar-%s' % build.id | 66 | bar_selector = '#recipes-parsed-percentage-bar-%s' % build.id |
65 | bar_element = element.find_element_by_css_selector(bar_selector) | 67 | bar_element = element.find_element(By.CSS_SELECTOR, bar_selector) |
66 | self.assertEqual(bar_element.value_of_css_property('width'), '0px', | 68 | self.assertEqual(bar_element.value_of_css_property('width'), '0px', |
67 | 'recipe parse progress should be at 0') | 69 | 'recipe parse progress should be at 0') |
68 | 70 | ||
@@ -73,7 +75,7 @@ class TestMostRecentBuildsStates(SeleniumTestCase): | |||
73 | self.get(url) | 75 | self.get(url) |
74 | 76 | ||
75 | element = self.wait_until_visible(selector) | 77 | element = self.wait_until_visible(selector) |
76 | bar_element = element.find_element_by_css_selector(bar_selector) | 78 | bar_element = element.find_element(By.CSS_SELECTOR, bar_selector) |
77 | recipe_bar_updated = lambda driver: \ | 79 | recipe_bar_updated = lambda driver: \ |
78 | bar_element.get_attribute('style') == 'width: 50%;' | 80 | bar_element.get_attribute('style') == 'width: 50%;' |
79 | msg = 'recipe parse progress bar should update to 50%' | 81 | msg = 'recipe parse progress bar should update to 50%' |
@@ -107,7 +109,7 @@ class TestMostRecentBuildsStates(SeleniumTestCase): | |||
107 | element = self.wait_until_visible(selector) | 109 | element = self.wait_until_visible(selector) |
108 | 110 | ||
109 | bar_selector = '#build-pc-done-bar-%s' % build.id | 111 | bar_selector = '#build-pc-done-bar-%s' % build.id |
110 | bar_element = element.find_element_by_css_selector(bar_selector) | 112 | bar_element = element.find_element(By.CSS_SELECTOR, bar_selector) |
111 | 113 | ||
112 | task_bar_updated = lambda driver: \ | 114 | task_bar_updated = lambda driver: \ |
113 | bar_element.get_attribute('style') == 'width: 50%;' | 115 | bar_element.get_attribute('style') == 'width: 50%;' |
@@ -121,7 +123,7 @@ class TestMostRecentBuildsStates(SeleniumTestCase): | |||
121 | self.get(url) | 123 | self.get(url) |
122 | 124 | ||
123 | element = self.wait_until_visible(selector) | 125 | element = self.wait_until_visible(selector) |
124 | bar_element = element.find_element_by_css_selector(bar_selector) | 126 | bar_element = element.find_element(By.CSS_SELECTOR, bar_selector) |
125 | task_bar_updated = lambda driver: \ | 127 | task_bar_updated = lambda driver: \ |
126 | bar_element.get_attribute('style') == 'width: 100%;' | 128 | bar_element.get_attribute('style') == 'width: 100%;' |
127 | msg = 'tasks progress bar should update to 100%' | 129 | msg = 'tasks progress bar should update to 100%' |
diff --git a/bitbake/lib/toaster/tests/browser/test_new_custom_image_page.py b/bitbake/lib/toaster/tests/browser/test_new_custom_image_page.py index 9906ae42a9..6361f40347 100644 --- a/bitbake/lib/toaster/tests/browser/test_new_custom_image_page.py +++ b/bitbake/lib/toaster/tests/browser/test_new_custom_image_page.py | |||
@@ -6,6 +6,7 @@ | |||
6 | # | 6 | # |
7 | # SPDX-License-Identifier: GPL-2.0-only | 7 | # SPDX-License-Identifier: GPL-2.0-only |
8 | # | 8 | # |
9 | from bldcontrol.models import BuildEnvironment | ||
9 | 10 | ||
10 | from django.urls import reverse | 11 | from django.urls import reverse |
11 | from tests.browser.selenium_helpers import SeleniumTestCase | 12 | from tests.browser.selenium_helpers import SeleniumTestCase |
@@ -18,6 +19,9 @@ class TestNewCustomImagePage(SeleniumTestCase): | |||
18 | CUSTOM_IMAGE_NAME = 'roopa-doopa' | 19 | CUSTOM_IMAGE_NAME = 'roopa-doopa' |
19 | 20 | ||
20 | def setUp(self): | 21 | def setUp(self): |
22 | BuildEnvironment.objects.get_or_create( | ||
23 | betype=BuildEnvironment.TYPE_LOCAL, | ||
24 | ) | ||
21 | release = Release.objects.create( | 25 | release = Release.objects.create( |
22 | name='baz', | 26 | name='baz', |
23 | bitbake_version=BitbakeVersion.objects.create(name='v1') | 27 | bitbake_version=BitbakeVersion.objects.create(name='v1') |
diff --git a/bitbake/lib/toaster/tests/browser/test_new_project_page.py b/bitbake/lib/toaster/tests/browser/test_new_project_page.py index e20a1f686e..f4b2708f77 100644 --- a/bitbake/lib/toaster/tests/browser/test_new_project_page.py +++ b/bitbake/lib/toaster/tests/browser/test_new_project_page.py | |||
@@ -6,11 +6,13 @@ | |||
6 | # | 6 | # |
7 | # SPDX-License-Identifier: GPL-2.0-only | 7 | # SPDX-License-Identifier: GPL-2.0-only |
8 | # | 8 | # |
9 | import time | ||
9 | 10 | ||
10 | from django.urls import reverse | 11 | from django.urls import reverse |
11 | from tests.browser.selenium_helpers import SeleniumTestCase | 12 | from tests.browser.selenium_helpers import SeleniumTestCase |
12 | from selenium.webdriver.support.ui import Select | 13 | from selenium.webdriver.support.ui import Select |
13 | from selenium.common.exceptions import InvalidElementStateException | 14 | from selenium.common.exceptions import InvalidElementStateException |
15 | from selenium.webdriver.common.by import By | ||
14 | 16 | ||
15 | from orm.models import Project, Release, BitbakeVersion | 17 | from orm.models import Project, Release, BitbakeVersion |
16 | 18 | ||
@@ -47,13 +49,14 @@ class TestNewProjectPage(SeleniumTestCase): | |||
47 | 49 | ||
48 | url = reverse('newproject') | 50 | url = reverse('newproject') |
49 | self.get(url) | 51 | self.get(url) |
50 | |||
51 | self.enter_text('#new-project-name', project_name) | 52 | self.enter_text('#new-project-name', project_name) |
52 | 53 | ||
53 | select = Select(self.find('#projectversion')) | 54 | select = Select(self.find('#projectversion')) |
54 | select.select_by_value(str(self.release.pk)) | 55 | select.select_by_value(str(self.release.pk)) |
55 | 56 | ||
57 | time.sleep(1) | ||
56 | self.click("#create-project-button") | 58 | self.click("#create-project-button") |
59 | time.sleep(2) | ||
57 | 60 | ||
58 | # We should get redirected to the new project's page with the | 61 | # We should get redirected to the new project's page with the |
59 | # notification at the top | 62 | # notification at the top |
@@ -84,6 +87,12 @@ class TestNewProjectPage(SeleniumTestCase): | |||
84 | select = Select(self.find('#projectversion')) | 87 | select = Select(self.find('#projectversion')) |
85 | select.select_by_value(str(self.release.pk)) | 88 | select.select_by_value(str(self.release.pk)) |
86 | 89 | ||
90 | radio = self.driver.find_element(By.ID, 'type-new') | ||
91 | radio.click() | ||
92 | |||
93 | self.click("#create-project-button") | ||
94 | time.sleep(2) | ||
95 | |||
87 | element = self.wait_until_visible('#hint-error-project-name') | 96 | element = self.wait_until_visible('#hint-error-project-name') |
88 | 97 | ||
89 | self.assertTrue(("Project names must be unique" in element.text), | 98 | self.assertTrue(("Project names must be unique" in element.text), |
@@ -96,6 +105,7 @@ class TestNewProjectPage(SeleniumTestCase): | |||
96 | except InvalidElementStateException: | 105 | except InvalidElementStateException: |
97 | pass | 106 | pass |
98 | 107 | ||
108 | time.sleep(2) | ||
99 | self.assertTrue( | 109 | self.assertTrue( |
100 | (Project.objects.filter(name=project_name).count() == 1), | 110 | (Project.objects.filter(name=project_name).count() == 1), |
101 | "New project not found in database") | 111 | "New project not found in database") |
diff --git a/bitbake/lib/toaster/tests/browser/test_project_config_page.py b/bitbake/lib/toaster/tests/browser/test_project_config_page.py index 944bcb2631..7b21460e83 100644 --- a/bitbake/lib/toaster/tests/browser/test_project_config_page.py +++ b/bitbake/lib/toaster/tests/browser/test_project_config_page.py | |||
@@ -11,6 +11,7 @@ from django.urls import reverse | |||
11 | from tests.browser.selenium_helpers import SeleniumTestCase | 11 | from tests.browser.selenium_helpers import SeleniumTestCase |
12 | 12 | ||
13 | from orm.models import BitbakeVersion, Release, Project, ProjectVariable | 13 | from orm.models import BitbakeVersion, Release, Project, ProjectVariable |
14 | from selenium.webdriver.common.by import By | ||
14 | 15 | ||
15 | class TestProjectConfigsPage(SeleniumTestCase): | 16 | class TestProjectConfigsPage(SeleniumTestCase): |
16 | """ Test data at /project/X/builds is displayed correctly """ | 17 | """ Test data at /project/X/builds is displayed correctly """ |
@@ -66,7 +67,7 @@ class TestProjectConfigsPage(SeleniumTestCase): | |||
66 | 67 | ||
67 | self.enter_text('#new-imagefs_types', imagefs_type) | 68 | self.enter_text('#new-imagefs_types', imagefs_type) |
68 | 69 | ||
69 | checkboxes = self.driver.find_elements_by_xpath("//input[@class='fs-checkbox-fstypes']") | 70 | checkboxes = self.driver.find_elements(By.XPATH, "//input[@class='fs-checkbox-fstypes']") |
70 | 71 | ||
71 | for checkbox in checkboxes: | 72 | for checkbox in checkboxes: |
72 | if checkbox.get_attribute("value") == "btrfs": | 73 | if checkbox.get_attribute("value") == "btrfs": |
@@ -95,7 +96,7 @@ class TestProjectConfigsPage(SeleniumTestCase): | |||
95 | for checkbox in checkboxes: | 96 | for checkbox in checkboxes: |
96 | if checkbox.get_attribute("value") == "cpio": | 97 | if checkbox.get_attribute("value") == "cpio": |
97 | checkbox.click() | 98 | checkbox.click() |
98 | element = self.driver.find_element_by_id('new-imagefs_types') | 99 | element = self.driver.find_element(By.ID, 'new-imagefs_types') |
99 | 100 | ||
100 | self.wait_until_visible('#new-imagefs_types') | 101 | self.wait_until_visible('#new-imagefs_types') |
101 | 102 | ||
@@ -129,7 +130,7 @@ class TestProjectConfigsPage(SeleniumTestCase): | |||
129 | self.assertTrue((self.INVALID_PATH_START_TEXT in element.text), msg) | 130 | self.assertTrue((self.INVALID_PATH_START_TEXT in element.text), msg) |
130 | 131 | ||
131 | # downloads dir path has a space | 132 | # downloads dir path has a space |
132 | self.driver.find_element_by_id('new-dl_dir').clear() | 133 | self.driver.find_element(By.ID, 'new-dl_dir').clear() |
133 | self.enter_text('#new-dl_dir', '/foo/bar a') | 134 | self.enter_text('#new-dl_dir', '/foo/bar a') |
134 | 135 | ||
135 | element = self.wait_until_visible('#hintError-dl_dir') | 136 | element = self.wait_until_visible('#hintError-dl_dir') |
@@ -137,7 +138,7 @@ class TestProjectConfigsPage(SeleniumTestCase): | |||
137 | self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) | 138 | self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) |
138 | 139 | ||
139 | # downloads dir path starts with ${...} but has a space | 140 | # downloads dir path starts with ${...} but has a space |
140 | self.driver.find_element_by_id('new-dl_dir').clear() | 141 | self.driver.find_element(By.ID,'new-dl_dir').clear() |
141 | self.enter_text('#new-dl_dir', '${TOPDIR}/down foo') | 142 | self.enter_text('#new-dl_dir', '${TOPDIR}/down foo') |
142 | 143 | ||
143 | element = self.wait_until_visible('#hintError-dl_dir') | 144 | element = self.wait_until_visible('#hintError-dl_dir') |
@@ -145,18 +146,18 @@ class TestProjectConfigsPage(SeleniumTestCase): | |||
145 | self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) | 146 | self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) |
146 | 147 | ||
147 | # downloads dir path starts with / | 148 | # downloads dir path starts with / |
148 | self.driver.find_element_by_id('new-dl_dir').clear() | 149 | self.driver.find_element(By.ID,'new-dl_dir').clear() |
149 | self.enter_text('#new-dl_dir', '/bar/foo') | 150 | self.enter_text('#new-dl_dir', '/bar/foo') |
150 | 151 | ||
151 | hidden_element = self.driver.find_element_by_id('hintError-dl_dir') | 152 | hidden_element = self.driver.find_element(By.ID,'hintError-dl_dir') |
152 | self.assertEqual(hidden_element.is_displayed(), False, | 153 | self.assertEqual(hidden_element.is_displayed(), False, |
153 | 'downloads directory path valid but treated as invalid') | 154 | 'downloads directory path valid but treated as invalid') |
154 | 155 | ||
155 | # downloads dir path starts with ${...} | 156 | # downloads dir path starts with ${...} |
156 | self.driver.find_element_by_id('new-dl_dir').clear() | 157 | self.driver.find_element(By.ID,'new-dl_dir').clear() |
157 | self.enter_text('#new-dl_dir', '${TOPDIR}/down') | 158 | self.enter_text('#new-dl_dir', '${TOPDIR}/down') |
158 | 159 | ||
159 | hidden_element = self.driver.find_element_by_id('hintError-dl_dir') | 160 | hidden_element = self.driver.find_element(By.ID,'hintError-dl_dir') |
160 | self.assertEqual(hidden_element.is_displayed(), False, | 161 | self.assertEqual(hidden_element.is_displayed(), False, |
161 | 'downloads directory path valid but treated as invalid') | 162 | 'downloads directory path valid but treated as invalid') |
162 | 163 | ||
@@ -184,7 +185,7 @@ class TestProjectConfigsPage(SeleniumTestCase): | |||
184 | self.assertTrue((self.INVALID_PATH_START_TEXT in element.text), msg) | 185 | self.assertTrue((self.INVALID_PATH_START_TEXT in element.text), msg) |
185 | 186 | ||
186 | # path has a space | 187 | # path has a space |
187 | self.driver.find_element_by_id('new-sstate_dir').clear() | 188 | self.driver.find_element(By.ID, 'new-sstate_dir').clear() |
188 | self.enter_text('#new-sstate_dir', '/foo/bar a') | 189 | self.enter_text('#new-sstate_dir', '/foo/bar a') |
189 | 190 | ||
190 | element = self.wait_until_visible('#hintError-sstate_dir') | 191 | element = self.wait_until_visible('#hintError-sstate_dir') |
@@ -192,7 +193,7 @@ class TestProjectConfigsPage(SeleniumTestCase): | |||
192 | self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) | 193 | self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) |
193 | 194 | ||
194 | # path starts with ${...} but has a space | 195 | # path starts with ${...} but has a space |
195 | self.driver.find_element_by_id('new-sstate_dir').clear() | 196 | self.driver.find_element(By.ID,'new-sstate_dir').clear() |
196 | self.enter_text('#new-sstate_dir', '${TOPDIR}/down foo') | 197 | self.enter_text('#new-sstate_dir', '${TOPDIR}/down foo') |
197 | 198 | ||
198 | element = self.wait_until_visible('#hintError-sstate_dir') | 199 | element = self.wait_until_visible('#hintError-sstate_dir') |
@@ -200,18 +201,18 @@ class TestProjectConfigsPage(SeleniumTestCase): | |||
200 | self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) | 201 | self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg) |
201 | 202 | ||
202 | # path starts with / | 203 | # path starts with / |
203 | self.driver.find_element_by_id('new-sstate_dir').clear() | 204 | self.driver.find_element(By.ID,'new-sstate_dir').clear() |
204 | self.enter_text('#new-sstate_dir', '/bar/foo') | 205 | self.enter_text('#new-sstate_dir', '/bar/foo') |
205 | 206 | ||
206 | hidden_element = self.driver.find_element_by_id('hintError-sstate_dir') | 207 | hidden_element = self.driver.find_element(By.ID, 'hintError-sstate_dir') |
207 | self.assertEqual(hidden_element.is_displayed(), False, | 208 | self.assertEqual(hidden_element.is_displayed(), False, |
208 | 'sstate directory path valid but treated as invalid') | 209 | 'sstate directory path valid but treated as invalid') |
209 | 210 | ||
210 | # paths starts with ${...} | 211 | # paths starts with ${...} |
211 | self.driver.find_element_by_id('new-sstate_dir').clear() | 212 | self.driver.find_element(By.ID, 'new-sstate_dir').clear() |
212 | self.enter_text('#new-sstate_dir', '${TOPDIR}/down') | 213 | self.enter_text('#new-sstate_dir', '${TOPDIR}/down') |
213 | 214 | ||
214 | hidden_element = self.driver.find_element_by_id('hintError-sstate_dir') | 215 | hidden_element = self.driver.find_element(By.ID, 'hintError-sstate_dir') |
215 | self.assertEqual(hidden_element.is_displayed(), False, | 216 | self.assertEqual(hidden_element.is_displayed(), False, |
216 | 'sstate directory path valid but treated as invalid') | 217 | 'sstate directory path valid but treated as invalid') |
217 | 218 | ||
diff --git a/bitbake/lib/toaster/tests/browser/test_toastertable_ui.py b/bitbake/lib/toaster/tests/browser/test_toastertable_ui.py index e82d5ec654..e00c30a8a3 100644 --- a/bitbake/lib/toaster/tests/browser/test_toastertable_ui.py +++ b/bitbake/lib/toaster/tests/browser/test_toastertable_ui.py | |||
@@ -13,6 +13,7 @@ from django.urls import reverse | |||
13 | from django.utils import timezone | 13 | from django.utils import timezone |
14 | from tests.browser.selenium_helpers import SeleniumTestCase | 14 | from tests.browser.selenium_helpers import SeleniumTestCase |
15 | from orm.models import BitbakeVersion, Release, Project, Build | 15 | from orm.models import BitbakeVersion, Release, Project, Build |
16 | from selenium.webdriver.common.by import By | ||
16 | 17 | ||
17 | class TestToasterTableUI(SeleniumTestCase): | 18 | class TestToasterTableUI(SeleniumTestCase): |
18 | """ | 19 | """ |
@@ -33,7 +34,7 @@ class TestToasterTableUI(SeleniumTestCase): | |||
33 | table: WebElement for a ToasterTable | 34 | table: WebElement for a ToasterTable |
34 | """ | 35 | """ |
35 | selector = 'thead a.sorted' | 36 | selector = 'thead a.sorted' |
36 | heading = table.find_element_by_css_selector(selector) | 37 | heading = table.find_element(By.CSS_SELECTOR, selector) |
37 | return heading.get_attribute('innerHTML').strip() | 38 | return heading.get_attribute('innerHTML').strip() |
38 | 39 | ||
39 | def _get_datetime_from_cell(self, row, selector): | 40 | def _get_datetime_from_cell(self, row, selector): |
@@ -45,7 +46,7 @@ class TestToasterTableUI(SeleniumTestCase): | |||
45 | selector: CSS selector to use to find the cell containing the date time | 46 | selector: CSS selector to use to find the cell containing the date time |
46 | string | 47 | string |
47 | """ | 48 | """ |
48 | cell = row.find_element_by_css_selector(selector) | 49 | cell = row.find_element(By.CSS_SELECTOR, selector) |
49 | cell_text = cell.get_attribute('innerHTML').strip() | 50 | cell_text = cell.get_attribute('innerHTML').strip() |
50 | return datetime.strptime(cell_text, '%d/%m/%y %H:%M') | 51 | return datetime.strptime(cell_text, '%d/%m/%y %H:%M') |
51 | 52 | ||
@@ -105,7 +106,7 @@ class TestToasterTableUI(SeleniumTestCase): | |||
105 | self.click('#checkbox-started_on') | 106 | self.click('#checkbox-started_on') |
106 | 107 | ||
107 | # sort by started_on column | 108 | # sort by started_on column |
108 | links = table.find_elements_by_css_selector('th.started_on a') | 109 | links = table.find_elements(By.CSS_SELECTOR, 'th.started_on a') |
109 | for link in links: | 110 | for link in links: |
110 | if link.get_attribute('innerHTML').strip() == 'Started on': | 111 | if link.get_attribute('innerHTML').strip() == 'Started on': |
111 | link.click() | 112 | link.click() |
diff --git a/bitbake/lib/toaster/tests/builds/test_core_image_min.py b/bitbake/lib/toaster/tests/builds/test_core_image_min.py index 44b6cbec7b..9cdaa15f98 100644 --- a/bitbake/lib/toaster/tests/builds/test_core_image_min.py +++ b/bitbake/lib/toaster/tests/builds/test_core_image_min.py | |||
@@ -26,6 +26,7 @@ class BuildCoreImageMinimal(BuildTest): | |||
26 | 26 | ||
27 | def setUp(self): | 27 | def setUp(self): |
28 | self.completed_build = self.build("core-image-minimal") | 28 | self.completed_build = self.build("core-image-minimal") |
29 | self.built = self.target_already_built("core-image-minimal") | ||
29 | 30 | ||
30 | # Check if build name is unique - tc_id=795 | 31 | # Check if build name is unique - tc_id=795 |
31 | def test_Build_Unique_Name(self): | 32 | def test_Build_Unique_Name(self): |
diff --git a/bitbake/lib/toaster/tests/functional/functional_helpers.py b/bitbake/lib/toaster/tests/functional/functional_helpers.py index 5c4ea71794..c3191f664a 100644 --- a/bitbake/lib/toaster/tests/functional/functional_helpers.py +++ b/bitbake/lib/toaster/tests/functional/functional_helpers.py | |||
@@ -16,6 +16,9 @@ import re | |||
16 | 16 | ||
17 | from tests.browser.selenium_helpers_base import SeleniumTestCaseBase | 17 | from tests.browser.selenium_helpers_base import SeleniumTestCaseBase |
18 | from tests.builds.buildtest import load_build_environment | 18 | from tests.builds.buildtest import load_build_environment |
19 | from bldcontrol.models import BuildEnvironment | ||
20 | from selenium.webdriver.common.by import By | ||
21 | from selenium.common.exceptions import NoSuchElementException | ||
19 | 22 | ||
20 | logger = logging.getLogger("toaster") | 23 | logger = logging.getLogger("toaster") |
21 | 24 | ||
@@ -30,6 +33,8 @@ class SeleniumFunctionalTestCase(SeleniumTestCaseBase): | |||
30 | raise RuntimeError("Please initialise django with the tests settings: " \ | 33 | raise RuntimeError("Please initialise django with the tests settings: " \ |
31 | "DJANGO_SETTINGS_MODULE='toastermain.settings_test'") | 34 | "DJANGO_SETTINGS_MODULE='toastermain.settings_test'") |
32 | 35 | ||
36 | if BuildEnvironment.objects.count() == 0: | ||
37 | BuildEnvironment.objects.create(betype=BuildEnvironment.TYPE_LOCAL) | ||
33 | load_build_environment() | 38 | load_build_environment() |
34 | 39 | ||
35 | # start toaster | 40 | # start toaster |
@@ -74,8 +79,8 @@ class SeleniumFunctionalTestCase(SeleniumTestCaseBase): | |||
74 | """ | 79 | """ |
75 | try: | 80 | try: |
76 | table_element = self.get_table_element(table_id) | 81 | table_element = self.get_table_element(table_id) |
77 | element = table_element.find_element_by_link_text(link_text) | 82 | element = table_element.find_element(By.LINK_TEXT, link_text) |
78 | except self.NoSuchElementException: | 83 | except NoSuchElementException: |
79 | print('no element found') | 84 | print('no element found') |
80 | raise | 85 | raise |
81 | return element | 86 | return element |
@@ -85,8 +90,8 @@ class SeleniumFunctionalTestCase(SeleniumTestCaseBase): | |||
85 | #return whole-table element | 90 | #return whole-table element |
86 | element_xpath = "//*[@id='" + table_id + "']" | 91 | element_xpath = "//*[@id='" + table_id + "']" |
87 | try: | 92 | try: |
88 | element = self.driver.find_element_by_xpath(element_xpath) | 93 | element = self.driver.find_element(By.XPATH, element_xpath) |
89 | except self.NoSuchElementException: | 94 | except NoSuchElementException: |
90 | raise | 95 | raise |
91 | return element | 96 | return element |
92 | row = coordinate[0] | 97 | row = coordinate[0] |
@@ -95,8 +100,8 @@ class SeleniumFunctionalTestCase(SeleniumTestCaseBase): | |||
95 | #return whole-row element | 100 | #return whole-row element |
96 | element_xpath = "//*[@id='" + table_id + "']/tbody/tr[" + str(row) + "]" | 101 | element_xpath = "//*[@id='" + table_id + "']/tbody/tr[" + str(row) + "]" |
97 | try: | 102 | try: |
98 | element = self.driver.find_element_by_xpath(element_xpath) | 103 | element = self.driver.find_element(By.XPATH, element_xpath) |
99 | except self.NoSuchElementException: | 104 | except NoSuchElementException: |
100 | return False | 105 | return False |
101 | return element | 106 | return element |
102 | #now we are looking for an element with specified X and Y | 107 | #now we are looking for an element with specified X and Y |
@@ -104,7 +109,7 @@ class SeleniumFunctionalTestCase(SeleniumTestCaseBase): | |||
104 | 109 | ||
105 | element_xpath = "//*[@id='" + table_id + "']/tbody/tr[" + str(row) + "]/td[" + str(column) + "]" | 110 | element_xpath = "//*[@id='" + table_id + "']/tbody/tr[" + str(row) + "]/td[" + str(column) + "]" |
106 | try: | 111 | try: |
107 | element = self.driver.find_element_by_xpath(element_xpath) | 112 | element = self.driver.find_element(By.XPATH, element_xpath) |
108 | except self.NoSuchElementException: | 113 | except NoSuchElementException: |
109 | return False | 114 | return False |
110 | return element | 115 | return element |
diff --git a/bitbake/lib/toaster/tests/functional/test_functional_basic.py b/bitbake/lib/toaster/tests/functional/test_functional_basic.py index 5683e3873e..067ad99a9c 100644 --- a/bitbake/lib/toaster/tests/functional/test_functional_basic.py +++ b/bitbake/lib/toaster/tests/functional/test_functional_basic.py | |||
@@ -10,6 +10,7 @@ | |||
10 | import re | 10 | import re |
11 | from tests.functional.functional_helpers import SeleniumFunctionalTestCase | 11 | from tests.functional.functional_helpers import SeleniumFunctionalTestCase |
12 | from orm.models import Project | 12 | from orm.models import Project |
13 | from selenium.webdriver.common.by import By | ||
13 | 14 | ||
14 | class FuntionalTestBasic(SeleniumFunctionalTestCase): | 15 | class FuntionalTestBasic(SeleniumFunctionalTestCase): |
15 | 16 | ||
@@ -17,10 +18,10 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): | |||
17 | def test_create_slenium_project(self): | 18 | def test_create_slenium_project(self): |
18 | project_name = 'selenium-project' | 19 | project_name = 'selenium-project' |
19 | self.get('') | 20 | self.get('') |
20 | self.driver.find_element_by_link_text("To start building, create your first Toaster project").click() | 21 | self.driver.find_element(By.LINK_TEXT, "To start building, create your first Toaster project").click() |
21 | self.driver.find_element_by_id("new-project-name").send_keys(project_name) | 22 | self.driver.find_element(By.ID, "new-project-name").send_keys(project_name) |
22 | self.driver.find_element_by_id('projectversion').click() | 23 | self.driver.find_element(By.ID, 'projectversion').click() |
23 | self.driver.find_element_by_id("create-project-button").click() | 24 | self.driver.find_element(By.ID, "create-project-button").click() |
24 | element = self.wait_until_visible('#project-created-notification') | 25 | element = self.wait_until_visible('#project-created-notification') |
25 | self.assertTrue(self.element_exists('#project-created-notification'),'Project creation notification not shown') | 26 | self.assertTrue(self.element_exists('#project-created-notification'),'Project creation notification not shown') |
26 | self.assertTrue(project_name in element.text, | 27 | self.assertTrue(project_name in element.text, |
@@ -35,77 +36,77 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): | |||
35 | self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() | 36 | self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() |
36 | self.assertTrue(self.element_exists('#config-nav'),'Configuration Tab does not exist') | 37 | self.assertTrue(self.element_exists('#config-nav'),'Configuration Tab does not exist') |
37 | project_URL=self.get_URL() | 38 | project_URL=self.get_URL() |
38 | self.driver.find_element_by_xpath('//a[@href="'+project_URL+'"]').click() | 39 | self.driver.find_element(By.XPATH, '//a[@href="'+project_URL+'"]').click() |
39 | 40 | ||
40 | try: | 41 | try: |
41 | self.driver.find_element_by_xpath("//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'customimages/"'+"]").click() | 42 | self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'customimages/"'+"]").click() |
42 | 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') | 43 | 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') |
43 | except: | 44 | except: |
44 | self.fail(msg='No Custom images tab available') | 45 | self.fail(msg='No Custom images tab available') |
45 | 46 | ||
46 | try: | 47 | try: |
47 | self.driver.find_element_by_xpath("//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'images/"'+"]").click() | 48 | self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'images/"'+"]").click() |
48 | 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') | 49 | 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') |
49 | except: | 50 | except: |
50 | self.fail(msg='No Compatible image tab available') | 51 | self.fail(msg='No Compatible image tab available') |
51 | 52 | ||
52 | try: | 53 | try: |
53 | self.driver.find_element_by_xpath("//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'softwarerecipes/"'+"]").click() | 54 | self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'softwarerecipes/"'+"]").click() |
54 | 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') | 55 | 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') |
55 | except: | 56 | except: |
56 | self.fail(msg='No Compatible software recipe tab available') | 57 | self.fail(msg='No Compatible software recipe tab available') |
57 | 58 | ||
58 | try: | 59 | try: |
59 | self.driver.find_element_by_xpath("//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'machines/"'+"]").click() | 60 | self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'machines/"'+"]").click() |
60 | 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') | 61 | 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') |
61 | except: | 62 | except: |
62 | self.fail(msg='No Compatible machines tab available') | 63 | self.fail(msg='No Compatible machines tab available') |
63 | 64 | ||
64 | try: | 65 | try: |
65 | self.driver.find_element_by_xpath("//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'layers/"'+"]").click() | 66 | self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'layers/"'+"]").click() |
66 | 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') | 67 | 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') |
67 | except: | 68 | except: |
68 | self.fail(msg='No Compatible layers tab available') | 69 | self.fail(msg='No Compatible layers tab available') |
69 | 70 | ||
70 | try: | 71 | try: |
71 | self.driver.find_element_by_xpath("//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'configuration"'+"]").click() | 72 | self.driver.find_element(By.XPATH, "//*[@id='config-nav']/ul/li/a[@href="+'"'+project_URL+'configuration"'+"]").click() |
72 | 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') | 73 | 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') |
73 | except: | 74 | except: |
74 | self.fail(msg='No Bitbake variables tab available') | 75 | self.fail(msg='No Bitbake variables tab available') |
75 | 76 | ||
76 | # testcase (1516) | 77 | # testcase (1516) |
77 | def test_review_configuration_information(self): | 78 | def test_review_configuration_information(self): |
78 | self.get('') | 79 | self.get('') |
79 | self.driver.find_element_by_xpath("//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() | 80 | self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() |
80 | self.wait_until_visible('#projectstable') | 81 | self.wait_until_visible('#projectstable') |
81 | self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() | 82 | self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() |
82 | project_URL=self.get_URL() | 83 | project_URL=self.get_URL() |
83 | 84 | ||
84 | try: | 85 | try: |
85 | self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist') | 86 | self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist') |
86 | self.assertTrue(re.search("qemux86",self.driver.find_element_by_xpath("//span[@id='project-machine-name']").text),'The machine type is not assigned') | 87 | self.assertTrue(re.search("qemux86",self.driver.find_element(By.XPATH, "//span[@id='project-machine-name']").text),'The machine type is not assigned') |
87 | self.driver.find_element_by_xpath("//span[@id='change-machine-toggle']").click() | 88 | self.driver.find_element(By.XPATH, "//span[@id='change-machine-toggle']").click() |
88 | self.wait_until_visible('#select-machine-form') | 89 | self.wait_until_visible('#select-machine-form') |
89 | self.wait_until_visible('#cancel-machine-change') | 90 | self.wait_until_visible('#cancel-machine-change') |
90 | self.driver.find_element_by_xpath("//form[@id='select-machine-form']/a[@id='cancel-machine-change']").click() | 91 | self.driver.find_element(By.XPATH, "//form[@id='select-machine-form']/a[@id='cancel-machine-change']").click() |
91 | except: | 92 | except: |
92 | self.fail(msg='The machine information is wrong in the configuration page') | 93 | self.fail(msg='The machine information is wrong in the configuration page') |
93 | 94 | ||
94 | try: | 95 | try: |
95 | self.driver.find_element_by_id('no-most-built') | 96 | self.driver.find_element(By.ID, 'no-most-built') |
96 | except: | 97 | except: |
97 | self.fail(msg='No Most built information in project detail page') | 98 | self.fail(msg='No Most built information in project detail page') |
98 | 99 | ||
99 | try: | 100 | try: |
100 | self.assertTrue(re.search("Yocto Project master",self.driver.find_element_by_xpath("//span[@id='project-release-title']").text),'The project release is not defined') | 101 | self.assertTrue(re.search("Yocto Project master",self.driver.find_element(By.XPATH, "//span[@id='project-release-title']").text),'The project release is not defined') |
101 | except: | 102 | except: |
102 | self.fail(msg='No project release title information in project detail page') | 103 | self.fail(msg='No project release title information in project detail page') |
103 | 104 | ||
104 | try: | 105 | try: |
105 | self.driver.find_element_by_xpath("//div[@id='layer-container']") | 106 | self.driver.find_element(By.XPATH, "//div[@id='layer-container']") |
106 | self.assertTrue(re.search("3",self.driver.find_element_by_id("project-layers-count").text),'There should be 3 layers listed in the layer count') | 107 | self.assertTrue(re.search("3",self.driver.find_element(By.ID, "project-layers-count").text),'There should be 3 layers listed in the layer count') |
107 | layer_list = self.driver.find_element_by_id("layers-in-project-list") | 108 | layer_list = self.driver.find_element(By.ID, "layers-in-project-list") |
108 | layers = layer_list.find_elements_by_tag_name("li") | 109 | layers = layer_list.find_elements(By.TAG_NAME, "li") |
109 | for layer in layers: | 110 | for layer in layers: |
110 | if re.match ("openembedded-core",layer.text): | 111 | if re.match ("openembedded-core",layer.text): |
111 | print ("openembedded-core layer is a default layer in the project configuration") | 112 | print ("openembedded-core layer is a default layer in the project configuration") |
@@ -121,60 +122,61 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): | |||
121 | # testcase (1517) | 122 | # testcase (1517) |
122 | def test_verify_machine_information(self): | 123 | def test_verify_machine_information(self): |
123 | self.get('') | 124 | self.get('') |
124 | self.driver.find_element_by_xpath("//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() | 125 | self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() |
125 | self.wait_until_visible('#projectstable') | 126 | self.wait_until_visible('#projectstable') |
126 | self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() | 127 | self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() |
127 | 128 | ||
128 | try: | 129 | try: |
129 | self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist') | 130 | self.assertTrue(self.element_exists('#machine-section'),'Machine section for the project configuration page does not exist') |
130 | self.assertTrue(re.search("qemux86",self.driver.find_element_by_id("project-machine-name").text),'The machine type is not assigned') | 131 | self.assertTrue(re.search("qemux86",self.driver.find_element(By.ID, "project-machine-name").text),'The machine type is not assigned') |
131 | self.driver.find_element_by_id("change-machine-toggle").click() | 132 | self.driver.find_element(By.ID, "change-machine-toggle").click() |
132 | self.wait_until_visible('#select-machine-form') | 133 | self.wait_until_visible('#select-machine-form') |
133 | self.wait_until_visible('#cancel-machine-change') | 134 | self.wait_until_visible('#cancel-machine-change') |
134 | self.driver.find_element_by_id("cancel-machine-change").click() | 135 | self.driver.find_element(By.ID, "cancel-machine-change").click() |
135 | except: | 136 | except: |
136 | self.fail(msg='The machine information is wrong in the configuration page') | 137 | self.fail(msg='The machine information is wrong in the configuration page') |
137 | 138 | ||
138 | # testcase (1518) | 139 | # testcase (1518) |
139 | def test_verify_most_built_recipes_information(self): | 140 | def test_verify_most_built_recipes_information(self): |
140 | self.get('') | 141 | self.get('') |
141 | self.driver.find_element_by_xpath("//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() | 142 | self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() |
143 | |||
142 | self.wait_until_visible('#projectstable') | 144 | self.wait_until_visible('#projectstable') |
143 | self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() | 145 | self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() |
144 | project_URL=self.get_URL() | 146 | project_URL=self.get_URL() |
145 | 147 | ||
146 | try: | 148 | try: |
147 | 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') | 149 | 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') |
148 | self.driver.find_element_by_xpath("//div[@id='no-most-built']/p/a[@href="+'"'+project_URL+'images/"'+"]").click() | 150 | self.driver.find_element(By.XPATH, "//div[@id='no-most-built']/p/a[@href="+'"'+project_URL+'images/"'+"]").click() |
149 | 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') | 151 | 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') |
150 | except: | 152 | except: |
151 | self.fail(msg='No Most built information in project detail page') | 153 | self.fail(msg='No Most built information in project detail page') |
152 | 154 | ||
153 | # testcase (1519) | 155 | # testcase (1519) |
154 | def test_verify_project_release_information(self): | 156 | def test_verify_project_release_information(self): |
155 | self.get('') | 157 | self.get('') |
156 | self.driver.find_element_by_xpath("//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() | 158 | self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() |
157 | self.wait_until_visible('#projectstable') | 159 | self.wait_until_visible('#projectstable') |
158 | self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() | 160 | self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() |
159 | 161 | ||
160 | try: | 162 | try: |
161 | self.assertTrue(re.search("Yocto Project master",self.driver.find_element_by_id("project-release-title").text),'The project release is not defined') | 163 | self.assertTrue(re.search("Yocto Project master",self.driver.find_element(By.ID, "project-release-title").text),'The project release is not defined') |
162 | except: | 164 | except: |
163 | self.fail(msg='No project release title information in project detail page') | 165 | self.fail(msg='No project release title information in project detail page') |
164 | 166 | ||
165 | # testcase (1520) | 167 | # testcase (1520) |
166 | def test_verify_layer_information(self): | 168 | def test_verify_layer_information(self): |
167 | self.get('') | 169 | self.get('') |
168 | self.driver.find_element_by_xpath("//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() | 170 | self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() |
169 | self.wait_until_visible('#projectstable') | 171 | self.wait_until_visible('#projectstable') |
170 | self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() | 172 | self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() |
171 | project_URL=self.get_URL() | 173 | project_URL=self.get_URL() |
172 | 174 | ||
173 | try: | 175 | try: |
174 | self.driver.find_element_by_xpath("//div[@id='layer-container']") | 176 | self.driver.find_element(By.XPATH, "//div[@id='layer-container']") |
175 | self.assertTrue(re.search("3",self.driver.find_element_by_id("project-layers-count").text),'There should be 3 layers listed in the layer count') | 177 | self.assertTrue(re.search("3",self.driver.find_element(By.ID, "project-layers-count").text),'There should be 3 layers listed in the layer count') |
176 | layer_list = self.driver.find_element_by_id("layers-in-project-list") | 178 | layer_list = self.driver.find_element(By.ID, "layers-in-project-list") |
177 | layers = layer_list.find_elements_by_tag_name("li") | 179 | layers = layer_list.find_element(By.TAG_NAME, "li") |
178 | 180 | ||
179 | for layer in layers: | 181 | for layer in layers: |
180 | if re.match ("openembedded-core",layer.text): | 182 | if re.match ("openembedded-core",layer.text): |
@@ -186,43 +188,43 @@ class FuntionalTestBasic(SeleniumFunctionalTestCase): | |||
186 | else: | 188 | else: |
187 | self.fail(msg='default layers are missing from the project configuration') | 189 | self.fail(msg='default layers are missing from the project configuration') |
188 | 190 | ||
189 | self.driver.find_element_by_xpath("//input[@id='layer-add-input']") | 191 | self.driver.find_element(By.XPATH, "//input[@id='layer-add-input']") |
190 | self.driver.find_element_by_xpath("//button[@id='add-layer-btn']") | 192 | self.driver.find_element(By.XPATH, "//button[@id='add-layer-btn']") |
191 | self.driver.find_element_by_xpath("//div[@id='layer-container']/form[@class='form-inline']/p/a[@id='view-compatible-layers']") | 193 | self.driver.find_element(By.XPATH, "//div[@id='layer-container']/form[@class='form-inline']/p/a[@id='view-compatible-layers']") |
192 | self.driver.find_element_by_xpath("//div[@id='layer-container']/form[@class='form-inline']/p/a[@href="+'"'+project_URL+'importlayer"'+"]") | 194 | self.driver.find_element(By.XPATH, "//div[@id='layer-container']/form[@class='form-inline']/p/a[@href="+'"'+project_URL+'importlayer"'+"]") |
193 | except: | 195 | except: |
194 | self.fail(msg='No Layer information in project detail page') | 196 | self.fail(msg='No Layer information in project detail page') |
195 | 197 | ||
196 | # testcase (1521) | 198 | # testcase (1521) |
197 | def test_verify_project_detail_links(self): | 199 | def test_verify_project_detail_links(self): |
198 | self.get('') | 200 | self.get('') |
199 | self.driver.find_element_by_xpath("//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() | 201 | self.driver.find_element(By.XPATH, "//div[@id='global-nav']/ul/li/a[@href="+'"'+'/toastergui/projects/'+'"'+"]").click() |
200 | self.wait_until_visible('#projectstable') | 202 | self.wait_until_visible('#projectstable') |
201 | self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() | 203 | self.find_element_by_link_text_in_table('projectstable', 'selenium-project').click() |
202 | project_URL=self.get_URL() | 204 | project_URL=self.get_URL() |
203 | 205 | ||
204 | 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() | 206 | 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() |
205 | 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') | 207 | 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') |
206 | 208 | ||
207 | try: | 209 | try: |
208 | self.driver.find_element_by_xpath("//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'builds/"'+"]").click() | 210 | self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'builds/"'+"]").click() |
209 | self.assertTrue(re.search("Builds",self.driver.find_element_by_xpath("//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'builds/"'+"]").text), 'Builds tab in project topbar is misspelled') | 211 | self.assertTrue(re.search("Builds",self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'builds/"'+"]").text), 'Builds tab in project topbar is misspelled') |
210 | self.driver.find_element_by_xpath("//div[@id='empty-state-projectbuildstable']") | 212 | self.driver.find_element(By.XPATH, "//div[@id='empty-state-projectbuildstable']") |
211 | except: | 213 | except: |
212 | self.fail(msg='Builds tab information is not present') | 214 | self.fail(msg='Builds tab information is not present') |
213 | 215 | ||
214 | try: | 216 | try: |
215 | self.driver.find_element_by_xpath("//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'importlayer"'+"]").click() | 217 | self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'importlayer"'+"]").click() |
216 | self.assertTrue(re.search("Import layer",self.driver.find_element_by_xpath("//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'importlayer"'+"]").text), 'Import layer tab in project topbar is misspelled') | 218 | self.assertTrue(re.search("Import layer",self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'importlayer"'+"]").text), 'Import layer tab in project topbar is misspelled') |
217 | self.driver.find_element_by_xpath("//fieldset[@id='repo-select']") | 219 | self.driver.find_element(By.XPATH, "//fieldset[@id='repo-select']") |
218 | self.driver.find_element_by_xpath("//fieldset[@id='git-repo']") | 220 | self.driver.find_element(By.XPATH, "//fieldset[@id='git-repo']") |
219 | except: | 221 | except: |
220 | self.fail(msg='Import layer tab not loading properly') | 222 | self.fail(msg='Import layer tab not loading properly') |
221 | 223 | ||
222 | try: | 224 | try: |
223 | self.driver.find_element_by_xpath("//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'newcustomimage/"'+"]").click() | 225 | self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'newcustomimage/"'+"]").click() |
224 | self.assertTrue(re.search("New custom image",self.driver.find_element_by_xpath("//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'newcustomimage/"'+"]").text), 'New custom image tab in project topbar is misspelled') | 226 | self.assertTrue(re.search("New custom image",self.driver.find_element(By.XPATH, "//div[@id='project-topbar']/ul[@class='nav nav-tabs']/li/a[@href="+'"'+project_URL+'newcustomimage/"'+"]").text), 'New custom image tab in project topbar is misspelled') |
225 | self.assertTrue(re.search("Select the image recipe you want to customise",self.driver.find_element_by_xpath("//div[@class='col-md-12']/h2").text),'The new custom image tab is not loading correctly') | 227 | self.assertTrue(re.search("Select the image recipe you want to customise",self.driver.find_element(By.XPATH, "//div[@class='col-md-12']/h2").text),'The new custom image tab is not loading correctly') |
226 | except: | 228 | except: |
227 | self.fail(msg='New custom image tab not loading properly') | 229 | self.fail(msg='New custom image tab not loading properly') |
228 | 230 | ||
diff --git a/bitbake/lib/toaster/tests/toaster-tests-requirements.txt b/bitbake/lib/toaster/tests/toaster-tests-requirements.txt index 4f9fcc46d2..f30ac0706c 100644 --- a/bitbake/lib/toaster/tests/toaster-tests-requirements.txt +++ b/bitbake/lib/toaster/tests/toaster-tests-requirements.txt | |||
@@ -1 +1 @@ | |||
selenium==2.49.2 | selenium>=4.13.0 | ||
diff --git a/bitbake/lib/toaster/tests/views/test_views.py b/bitbake/lib/toaster/tests/views/test_views.py index 735d596bcc..f962e76287 100644 --- a/bitbake/lib/toaster/tests/views/test_views.py +++ b/bitbake/lib/toaster/tests/views/test_views.py | |||
@@ -19,6 +19,7 @@ from orm.models import Layer_Version, Recipe | |||
19 | from orm.models import CustomImageRecipe | 19 | from orm.models import CustomImageRecipe |
20 | from orm.models import CustomImagePackage | 20 | from orm.models import CustomImagePackage |
21 | 21 | ||
22 | from bldcontrol.models import BuildEnvironment | ||
22 | import inspect | 23 | import inspect |
23 | import toastergui | 24 | import toastergui |
24 | 25 | ||
@@ -45,6 +46,9 @@ class ViewTests(TestCase): | |||
45 | self.cust_package = CustomImagePackage.objects.first() | 46 | self.cust_package = CustomImagePackage.objects.first() |
46 | self.package = Package.objects.first() | 47 | self.package = Package.objects.first() |
47 | self.lver = Layer_Version.objects.first() | 48 | self.lver = Layer_Version.objects.first() |
49 | if BuildEnvironment.objects.count() == 0: | ||
50 | BuildEnvironment.objects.create(betype=BuildEnvironment.TYPE_LOCAL) | ||
51 | |||
48 | 52 | ||
49 | def test_get_base_call_returns_html(self): | 53 | def test_get_base_call_returns_html(self): |
50 | """Basic test for all-projects view""" | 54 | """Basic test for all-projects view""" |
diff --git a/bitbake/lib/toaster/toastergui/widgets.py b/bitbake/lib/toaster/toastergui/widgets.py index 53696912a4..6e87285c8c 100644 --- a/bitbake/lib/toaster/toastergui/widgets.py +++ b/bitbake/lib/toaster/toastergui/widgets.py | |||
@@ -305,6 +305,7 @@ class ToasterTable(TemplateView): | |||
305 | 305 | ||
306 | self.setup_columns(**kwargs) | 306 | self.setup_columns(**kwargs) |
307 | 307 | ||
308 | self.apply_orderby('pk') | ||
308 | if search: | 309 | if search: |
309 | self.apply_search(search) | 310 | self.apply_search(search) |
310 | if filters: | 311 | if filters: |