diff options
| -rw-r--r-- | bitbake/lib/toaster/tests/functional/test_project_page_tab_config.py | 132 | ||||
| -rw-r--r-- | bitbake/lib/toaster/toastergui/templates/mrb_section.html | 2 |
2 files changed, 133 insertions, 1 deletions
diff --git a/bitbake/lib/toaster/tests/functional/test_project_page_tab_config.py b/bitbake/lib/toaster/tests/functional/test_project_page_tab_config.py index f0c6aacfc8..ca3b88d2a6 100644 --- a/bitbake/lib/toaster/tests/functional/test_project_page_tab_config.py +++ b/bitbake/lib/toaster/tests/functional/test_project_page_tab_config.py | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | from time import sleep | 9 | from time import sleep |
| 10 | import pytest | 10 | import pytest |
| 11 | from django.urls import reverse | 11 | from django.urls import reverse |
| 12 | from selenium.webdriver import Keys | ||
| 12 | from selenium.webdriver.support.select import Select | 13 | from selenium.webdriver.support.select import Select |
| 13 | from selenium.common.exceptions import NoSuchElementException | 14 | from selenium.common.exceptions import NoSuchElementException |
| 14 | from tests.functional.functional_helpers import SeleniumFunctionalTestCase | 15 | from tests.functional.functional_helpers import SeleniumFunctionalTestCase |
| @@ -174,3 +175,134 @@ class TestProjectConfigTab(SeleniumFunctionalTestCase): | |||
| 174 | if item.get_attribute('class') != 'active': | 175 | if item.get_attribute('class') != 'active': |
| 175 | item.click() | 176 | item.click() |
| 176 | check_config_nav_item(index, item_name, url) | 177 | check_config_nav_item(index, item_name, url) |
| 178 | |||
| 179 | def test_project_config_tab_right_section(self): | ||
| 180 | """ Test project config tab right section contains five blocks: | ||
| 181 | - Machine: | ||
| 182 | - check 'Machine' is displayed | ||
| 183 | - check can change Machine | ||
| 184 | - Distro: | ||
| 185 | - check 'Distro' is displayed | ||
| 186 | - check can change Distro | ||
| 187 | - Most built recipes: | ||
| 188 | - check 'Most built recipes' is displayed | ||
| 189 | - check can select a recipe and build it | ||
| 190 | - Project release: | ||
| 191 | - check 'Project release' is displayed | ||
| 192 | - check project has right release displayed | ||
| 193 | - Layers: | ||
| 194 | - check can add a layer if exists | ||
| 195 | - check at least three layers are displayed | ||
| 196 | - openembedded-core | ||
| 197 | - meta-poky | ||
| 198 | - meta-yocto-bsp | ||
| 199 | """ | ||
| 200 | # navigate to the project page | ||
| 201 | url = reverse("project", args=(1,)) | ||
| 202 | self.get(url) | ||
| 203 | |||
| 204 | # check if the menu is displayed | ||
| 205 | self.wait_until_visible('#project-page') | ||
| 206 | block_l = self.driver.find_element( | ||
| 207 | By.XPATH, '//*[@id="project-page"]/div[2]') | ||
| 208 | machine = self.find('#machine-section') | ||
| 209 | distro = self.find('#distro-section') | ||
| 210 | most_built_recipes = self.driver.find_element( | ||
| 211 | By.XPATH, '//*[@id="project-page"]/div[1]/div[3]') | ||
| 212 | project_release = self.driver.find_element( | ||
| 213 | By.XPATH, '//*[@id="project-page"]/div[1]/div[4]') | ||
| 214 | layers = block_l.find_element(By.ID, 'layer-container') | ||
| 215 | |||
| 216 | def check_machine_distro(self, item_name, new_item_name, block): | ||
| 217 | title = block.find_element(By.TAG_NAME, 'h3') | ||
| 218 | self.assertTrue(item_name.capitalize() in title.text) | ||
| 219 | edit_btn = block.find_element(By.ID, f'change-{item_name}-toggle') | ||
| 220 | edit_btn.click() | ||
| 221 | sleep(1) | ||
| 222 | name_input = block.find_element(By.ID, f'{item_name}-change-input') | ||
| 223 | name_input.clear() | ||
| 224 | name_input.send_keys(new_item_name) | ||
| 225 | change_btn = block.find_element(By.ID, f'{item_name}-change-btn') | ||
| 226 | change_btn.click() | ||
| 227 | sleep(1) | ||
| 228 | project_name = block.find_element(By.ID, f'project-{item_name}-name') | ||
| 229 | self.assertTrue(new_item_name in project_name.text) | ||
| 230 | # check change notificaiton is displayed | ||
| 231 | change_notification = self.find('#change-notification') | ||
| 232 | self.assertTrue( | ||
| 233 | f'You have changed the {item_name} to: {new_item_name}' in change_notification.text | ||
| 234 | ) | ||
| 235 | |||
| 236 | # Machine | ||
| 237 | check_machine_distro(self, 'machine', 'qemux86-64', machine) | ||
| 238 | # Distro | ||
| 239 | check_machine_distro(self, 'distro', 'poky-altcfg', distro) | ||
| 240 | |||
| 241 | # Project release | ||
| 242 | title = project_release.find_element(By.TAG_NAME, 'h3') | ||
| 243 | self.assertTrue("Project release" in title.text) | ||
| 244 | self.assertTrue( | ||
| 245 | "Yocto Project master" in self.find('#project-release-title').text | ||
| 246 | ) | ||
| 247 | |||
| 248 | # Layers | ||
| 249 | title = layers.find_element(By.TAG_NAME, 'h3') | ||
| 250 | self.assertTrue("Layers" in title.text) | ||
| 251 | # check at least three layers are displayed | ||
| 252 | # openembedded-core | ||
| 253 | # meta-poky | ||
| 254 | # meta-yocto-bsp | ||
| 255 | layers_list = layers.find_element(By.ID, 'layers-in-project-list') | ||
| 256 | layers_list_items = layers_list.find_elements(By.TAG_NAME, 'li') | ||
| 257 | self.assertTrue(len(layers_list_items) == 3) | ||
| 258 | # check can add a layer if exists | ||
| 259 | add_layer_input = layers.find_element(By.ID, 'layer-add-input') | ||
| 260 | add_layer_input.send_keys('meta-oe') | ||
| 261 | self.wait_until_visible('#layer-container > form > div > span > div') | ||
| 262 | dropdown_item = self.driver.find_element( | ||
| 263 | By.XPATH, | ||
| 264 | '//*[@id="layer-container"]/form/div/span/div' | ||
| 265 | ) | ||
| 266 | dropdown_item.click() | ||
| 267 | add_layer_btn = layers.find_element(By.ID, 'add-layer-btn') | ||
| 268 | add_layer_btn.click() | ||
| 269 | sleep(1) | ||
| 270 | # check layer is added | ||
| 271 | layers_list_items = layers_list.find_elements(By.TAG_NAME, 'li') | ||
| 272 | self.assertTrue(len(layers_list_items) == 4) | ||
| 273 | |||
| 274 | # Most built recipes | ||
| 275 | title = most_built_recipes.find_element(By.TAG_NAME, 'h3') | ||
| 276 | self.assertTrue("Most built recipes" in title.text) | ||
| 277 | # Create a new builds 5 | ||
| 278 | self._create_builds() | ||
| 279 | |||
| 280 | # Refresh the page | ||
| 281 | self.get(url) | ||
| 282 | |||
| 283 | sleep(1) # wait for page to load | ||
| 284 | self.wait_until_visible('#project-page') | ||
| 285 | # check can select a recipe and build it | ||
| 286 | most_built_recipes = self.driver.find_element( | ||
| 287 | By.XPATH, '//*[@id="project-page"]/div[1]/div[3]') | ||
| 288 | recipe_list = most_built_recipes.find_element(By.ID, 'freq-build-list') | ||
| 289 | recipe_list_items = recipe_list.find_elements(By.TAG_NAME, 'li') | ||
| 290 | self.assertTrue(len(recipe_list_items) > 0) | ||
| 291 | checkbox = recipe_list_items[0].find_element(By.TAG_NAME, 'input') | ||
| 292 | checkbox.click() | ||
| 293 | build_btn = self.find('#freq-build-btn') | ||
| 294 | build_btn.click() | ||
| 295 | sleep(1) # wait for page to load | ||
| 296 | self.wait_until_visible('#latest-builds') | ||
| 297 | self._wait_until_build('parsing starting cloning queueing') | ||
| 298 | lastest_builds = self.driver.find_elements( | ||
| 299 | By.XPATH, | ||
| 300 | '//div[@id="latest-builds"]/div' | ||
| 301 | ) | ||
| 302 | last_build = lastest_builds[0] | ||
| 303 | cancel_button = last_build.find_element( | ||
| 304 | By.XPATH, | ||
| 305 | '//span[@class="cancel-build-btn pull-right alert-link"]', | ||
| 306 | ) | ||
| 307 | cancel_button.click() | ||
| 308 | self.assertTrue(len(lastest_builds) == 2) | ||
diff --git a/bitbake/lib/toaster/toastergui/templates/mrb_section.html b/bitbake/lib/toaster/toastergui/templates/mrb_section.html index 98d9fac822..9fc7dfaee4 100644 --- a/bitbake/lib/toaster/toastergui/templates/mrb_section.html +++ b/bitbake/lib/toaster/toastergui/templates/mrb_section.html | |||
| @@ -63,7 +63,7 @@ | |||
| 63 | <%/if%> | 63 | <%/if%> |
| 64 | </div> | 64 | </div> |
| 65 | 65 | ||
| 66 | <div data-build-state="<%:state%>"> | 66 | <div class="build-state" data-build-state="<%:state%>"> |
| 67 | <%if state == 'Cloning'%> | 67 | <%if state == 'Cloning'%> |
| 68 | <%include tmpl='#cloning-repos-build-template'/%> | 68 | <%include tmpl='#cloning-repos-build-template'/%> |
| 69 | <%else state == 'Parsing'%> | 69 | <%else state == 'Parsing'%> |
