diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-10-18 22:31:53 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-10-24 11:24:03 +0100 |
commit | 210417d0f434966c75eb2f03985471c504fb42f9 (patch) | |
tree | 0918d2ec2286c7f1e3e39fe0a8d65375ca724515 /bitbake/lib/toaster | |
parent | fa56ea47b17a9416c3d0a4fe95594d16e5f3130b (diff) | |
download | poky-210417d0f434966c75eb2f03985471c504fb42f9.tar.gz |
bitbake: toaster/tests/functiona/project_page: Improve waits and drop polling
These changes:
* Drop the poll parameters
* Add waits where needed or make them more specific
* Add calls to close notification boxes since they can obscure
other page elements
* In one case wait for a "Loading" message to be replaced
(Bitbake rev: 2bde969486a4761fa0e6f9590c9fa08d385666b1)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster')
-rw-r--r-- | bitbake/lib/toaster/tests/functional/test_project_page.py | 53 |
1 files changed, 40 insertions, 13 deletions
diff --git a/bitbake/lib/toaster/tests/functional/test_project_page.py b/bitbake/lib/toaster/tests/functional/test_project_page.py index 7e73cac438..f34ccf5e8e 100644 --- a/bitbake/lib/toaster/tests/functional/test_project_page.py +++ b/bitbake/lib/toaster/tests/functional/test_project_page.py | |||
@@ -8,6 +8,7 @@ | |||
8 | 8 | ||
9 | import os | 9 | import os |
10 | import string | 10 | import string |
11 | import time | ||
11 | from unittest import skip | 12 | from unittest import skip |
12 | import pytest | 13 | import pytest |
13 | from django.urls import reverse | 14 | from django.urls import reverse |
@@ -150,7 +151,7 @@ class TestProjectPageBase(SeleniumFunctionalTestCase): | |||
150 | def test_show_rows(row_to_show, show_row_link): | 151 | def test_show_rows(row_to_show, show_row_link): |
151 | # Check that we can show rows == row_to_show | 152 | # Check that we can show rows == row_to_show |
152 | show_row_link.select_by_value(str(row_to_show)) | 153 | show_row_link.select_by_value(str(row_to_show)) |
153 | self.wait_until_visible(f'#{table_selector} tbody tr', poll=3) | 154 | self.wait_until_visible(f'#{table_selector} tbody tr') |
154 | # check at least some rows are visible | 155 | # check at least some rows are visible |
155 | self.assertTrue( | 156 | self.assertTrue( |
156 | len(self.find_all(f'#{table_selector} tbody tr')) > 0 | 157 | len(self.find_all(f'#{table_selector} tbody tr')) > 0 |
@@ -359,11 +360,15 @@ class TestProjectPage(TestProjectPageBase): | |||
359 | search_box.send_keys('core-image-minimal') | 360 | search_box.send_keys('core-image-minimal') |
360 | self.find('#build-button').click() | 361 | self.find('#build-button').click() |
361 | self.wait_until_visible('#latest-builds') | 362 | self.wait_until_visible('#latest-builds') |
362 | lastest_builds = self.driver.find_elements( | 363 | buildtext = "Loading" |
363 | By.XPATH, | 364 | while "Loading" in buildtext: |
364 | '//div[@id="latest-builds"]', | 365 | time.sleep(1) |
365 | ) | 366 | lastest_builds = self.driver.find_elements( |
366 | last_build = lastest_builds[0] | 367 | By.XPATH, |
368 | '//div[@id="latest-builds"]', | ||
369 | ) | ||
370 | last_build = lastest_builds[0] | ||
371 | buildtext = last_build.text | ||
367 | self.assertIn( | 372 | self.assertIn( |
368 | 'core-image-minimal', str(last_build.text) | 373 | 'core-image-minimal', str(last_build.text) |
369 | ) | 374 | ) |
@@ -471,7 +476,8 @@ class TestProjectPage(TestProjectPageBase): | |||
471 | searchBtn_selector='search-submit-machinestable', | 476 | searchBtn_selector='search-submit-machinestable', |
472 | table_selector='machinestable' | 477 | table_selector='machinestable' |
473 | ) | 478 | ) |
474 | self.wait_until_visible('#machinestable tbody tr', poll=3) | 479 | |
480 | self.wait_until_visible('#machinestable tbody tr') | ||
475 | rows = self.find_all('#machinestable tbody tr') | 481 | rows = self.find_all('#machinestable tbody tr') |
476 | machine_to_add = rows[0] | 482 | machine_to_add = rows[0] |
477 | add_btn = machine_to_add.find_element(By.XPATH, '//td[@class="add-del-layers"]') | 483 | add_btn = machine_to_add.find_element(By.XPATH, '//td[@class="add-del-layers"]') |
@@ -481,6 +487,11 @@ class TestProjectPage(TestProjectPageBase): | |||
481 | self.assertIn( | 487 | self.assertIn( |
482 | f'You have added 1 layer to your project', str(change_notification.text) | 488 | f'You have added 1 layer to your project', str(change_notification.text) |
483 | ) | 489 | ) |
490 | |||
491 | hide_button = self.find('#hide-alert') | ||
492 | hide_button.click() | ||
493 | self.wait_until_not_visible('#change-notification') | ||
494 | |||
484 | # check Machine table feature(show/hide column, pagination) | 495 | # check Machine table feature(show/hide column, pagination) |
485 | self._navigate_to_config_nav('machinestable', 5) | 496 | self._navigate_to_config_nav('machinestable', 5) |
486 | column_list = [ | 497 | column_list = [ |
@@ -521,7 +532,7 @@ class TestProjectPage(TestProjectPageBase): | |||
521 | table_selector='layerstable' | 532 | table_selector='layerstable' |
522 | ) | 533 | ) |
523 | # check "Add layer" button works | 534 | # check "Add layer" button works |
524 | self.wait_until_visible('#layerstable tbody tr', poll=3) | 535 | self.wait_until_visible('#layerstable tbody tr') |
525 | rows = self.find_all('#layerstable tbody tr') | 536 | rows = self.find_all('#layerstable tbody tr') |
526 | layer_to_add = rows[0] | 537 | layer_to_add = rows[0] |
527 | add_btn = layer_to_add.find_element( | 538 | add_btn = layer_to_add.find_element( |
@@ -530,7 +541,7 @@ class TestProjectPage(TestProjectPageBase): | |||
530 | ) | 541 | ) |
531 | add_btn.click() | 542 | add_btn.click() |
532 | # check modal is displayed | 543 | # check modal is displayed |
533 | self.wait_until_visible('#dependencies-modal', poll=3) | 544 | self.wait_until_visible('#dependencies-modal') |
534 | list_dependencies = self.find_all('#dependencies-list li') | 545 | list_dependencies = self.find_all('#dependencies-list li') |
535 | # click on add-layers button | 546 | # click on add-layers button |
536 | add_layers_btn = self.driver.find_element( | 547 | add_layers_btn = self.driver.find_element( |
@@ -543,8 +554,13 @@ class TestProjectPage(TestProjectPageBase): | |||
543 | self.assertIn( | 554 | self.assertIn( |
544 | f'You have added {len(list_dependencies)+1} layers to your project: {input_text} and its dependencies', str(change_notification.text) | 555 | f'You have added {len(list_dependencies)+1} layers to your project: {input_text} and its dependencies', str(change_notification.text) |
545 | ) | 556 | ) |
557 | |||
558 | hide_button = self.find('#hide-alert') | ||
559 | hide_button.click() | ||
560 | self.wait_until_not_visible('#change-notification') | ||
561 | |||
546 | # check "Remove layer" button works | 562 | # check "Remove layer" button works |
547 | self.wait_until_visible('#layerstable tbody tr', poll=3) | 563 | self.wait_until_visible('#layerstable tbody tr') |
548 | rows = self.find_all('#layerstable tbody tr') | 564 | rows = self.find_all('#layerstable tbody tr') |
549 | layer_to_remove = rows[0] | 565 | layer_to_remove = rows[0] |
550 | remove_btn = layer_to_remove.find_element( | 566 | remove_btn = layer_to_remove.find_element( |
@@ -552,11 +568,16 @@ class TestProjectPage(TestProjectPageBase): | |||
552 | '//td[@class="add-del-layers"]' | 568 | '//td[@class="add-del-layers"]' |
553 | ) | 569 | ) |
554 | remove_btn.click() | 570 | remove_btn.click() |
555 | self.wait_until_visible('#change-notification', poll=2) | 571 | self.wait_until_visible('#change-notification') |
556 | change_notification = self.find('#change-notification') | 572 | change_notification = self.find('#change-notification') |
557 | self.assertIn( | 573 | self.assertIn( |
558 | f'You have removed 1 layer from your project: {input_text}', str(change_notification.text) | 574 | f'You have removed 1 layer from your project: {input_text}', str(change_notification.text) |
559 | ) | 575 | ) |
576 | |||
577 | hide_button = self.find('#hide-alert') | ||
578 | hide_button.click() | ||
579 | self.wait_until_not_visible('#change-notification') | ||
580 | |||
560 | # check layers table feature(show/hide column, pagination) | 581 | # check layers table feature(show/hide column, pagination) |
561 | self._navigate_to_config_nav('layerstable', 6) | 582 | self._navigate_to_config_nav('layerstable', 6) |
562 | column_list = [ | 583 | column_list = [ |
@@ -604,7 +625,7 @@ class TestProjectPage(TestProjectPageBase): | |||
604 | '//td[@class="add-del-layers"]//a[1]' | 625 | '//td[@class="add-del-layers"]//a[1]' |
605 | ) | 626 | ) |
606 | add_btn.click() | 627 | add_btn.click() |
607 | self.wait_until_visible('#change-notification', poll=2) | 628 | self.wait_until_visible('#change-notification') |
608 | change_notification = self.find('#change-notification') | 629 | change_notification = self.find('#change-notification') |
609 | self.assertIn( | 630 | self.assertIn( |
610 | f'You have changed the distro to: {input_text}', str(change_notification.text) | 631 | f'You have changed the distro to: {input_text}', str(change_notification.text) |
@@ -649,12 +670,15 @@ class TestProjectPage(TestProjectPageBase): | |||
649 | # check remove layer button works | 670 | # check remove layer button works |
650 | remove_layer_btn = self.find('#add-remove-layer-btn') | 671 | remove_layer_btn = self.find('#add-remove-layer-btn') |
651 | remove_layer_btn.click() | 672 | remove_layer_btn.click() |
652 | self.wait_until_visible('#change-notification', poll=2) | 673 | self.wait_until_visible('#change-notification') |
653 | change_notification = self.find('#change-notification') | 674 | change_notification = self.find('#change-notification') |
654 | self.assertIn( | 675 | self.assertIn( |
655 | f'You have removed 1 layer from your project', str(change_notification.text) | 676 | f'You have removed 1 layer from your project', str(change_notification.text) |
656 | ) | 677 | ) |
678 | hide_button = self.find('#hide-alert') | ||
679 | hide_button.click() | ||
657 | # check add layer button works | 680 | # check add layer button works |
681 | self.wait_until_not_visible('#change-notification') | ||
658 | add_layer_btn = self.find('#add-remove-layer-btn') | 682 | add_layer_btn = self.find('#add-remove-layer-btn') |
659 | add_layer_btn.click() | 683 | add_layer_btn.click() |
660 | self.wait_until_visible('#change-notification') | 684 | self.wait_until_visible('#change-notification') |
@@ -662,6 +686,9 @@ class TestProjectPage(TestProjectPageBase): | |||
662 | self.assertIn( | 686 | self.assertIn( |
663 | f'You have added 1 layer to your project', str(change_notification.text) | 687 | f'You have added 1 layer to your project', str(change_notification.text) |
664 | ) | 688 | ) |
689 | hide_button = self.find('#hide-alert') | ||
690 | hide_button.click() | ||
691 | self.wait_until_not_visible('#change-notification') | ||
665 | # check tabs(layers, recipes, machines) are displayed | 692 | # check tabs(layers, recipes, machines) are displayed |
666 | tabs = self.find_all('.nav-tabs li') | 693 | tabs = self.find_all('.nav-tabs li') |
667 | self.assertEqual(len(tabs), 3) | 694 | self.assertEqual(len(tabs), 3) |