diff --git a/testing/ouia/test_alert_ouia.py b/testing/ouia/test_alert_ouia.py deleted file mode 100644 index 13fb3a9c..00000000 --- a/testing/ouia/test_alert_ouia.py +++ /dev/null @@ -1,29 +0,0 @@ -import pytest -from widgetastic.widget import View - -from widgetastic_patternfly4.ouia import Alert - -TESTING_PAGE_URL = "https://patternfly-docs-ouia.netlify.app/documentation/react/components/alert" - -ALERT_TYPES = ["success", "danger", "warning", "info"] - -pytestmark = pytest.mark.skip("No OUIA IDs provided on Patternfly testing page") - - -@pytest.fixture(params=ALERT_TYPES) -def alert(browser, request): - class TestView(View): - ROOT = ".//div[@id='ws-react-c-alert-ouia']" - alert = Alert(request.param) - - view = TestView(browser) - return view.alert - - -def test_alert_is_displayed(alert): - assert alert.is_displayed - - -def test_alert_title(alert): - alert_type = alert.type if alert.type != "error" else "danger" - assert alert.title == f"{alert_type.capitalize()} alert title" diff --git a/testing/ouia/test_breadcrumb_ouia.py b/testing/ouia/test_breadcrumb_ouia.py deleted file mode 100644 index 39e3b469..00000000 --- a/testing/ouia/test_breadcrumb_ouia.py +++ /dev/null @@ -1,46 +0,0 @@ -import re - -import pytest -from widgetastic.exceptions import WidgetOperationFailed -from widgetastic.widget import View - -from widgetastic_patternfly4.ouia import BreadCrumb - -TESTING_PAGE_URL = ( - "https://patternfly-docs-ouia.netlify.app/documentation/react/components/breadcrumb" # noqa -) - -pytestmark = pytest.mark.skip("No OUIA IDs provided on Patternfly testing page") - - -def test_breadcrumb(browser): - class TestView(View): - ROOT = ".//div[@id='ws-react-c-breadcrumb-ouia']" - breadcrumb = BreadCrumb("basic") - - view = TestView(browser) - assert view.breadcrumb.is_displayed - assert len(view.breadcrumb.locations) == 4 - assert view.breadcrumb.locations[0].lower() == "section home" - assert view.breadcrumb.read().lower() == "section landing" - view.breadcrumb.click_location(view.breadcrumb.locations[0]) - view.breadcrumb.click_location("title", partial=True) - - failing_location = "definitely not in the example page" - - # exception + message on full match - exception_match = re.escape( - f'Breadcrumb location "{failing_location}" ' - f"not found within locations: {view.breadcrumb.locations}" - ) - with pytest.raises(WidgetOperationFailed, match=exception_match): - view.breadcrumb.click_location(failing_location) - - # exception + message on partial match - exception_match = re.escape( - f'Breadcrumb location "{failing_location}" ' - "not found with partial match " - f"within locations: {view.breadcrumb.locations}" - ) - with pytest.raises(WidgetOperationFailed, match=exception_match): - view.breadcrumb.click_location(failing_location, partial=True) diff --git a/testing/ouia/test_button_ouia.py b/testing/ouia/test_button_ouia.py deleted file mode 100644 index e6fe1f06..00000000 --- a/testing/ouia/test_button_ouia.py +++ /dev/null @@ -1,23 +0,0 @@ -import pytest -from widgetastic.widget import View - -from widgetastic_patternfly4.ouia import Button - -TESTING_PAGE_URL = "https://patternfly-docs-ouia.netlify.app/documentation/react/components/button" - -pytestmark = pytest.mark.skip("No OUIA IDs provided on Patternfly testing page") - - -@pytest.fixture -def view(browser): - class TestView(View): - ROOT = ".//div[@id='ws-react-c-button-ouia']" - button = Button("Primary") - - return TestView(browser) - - -def test_button_click(view): - view.button.__repr__() - assert view.button.is_displayed - view.button.click() diff --git a/testing/ouia/test_card_ouia.py b/testing/ouia/test_card_ouia.py deleted file mode 100644 index a27eb056..00000000 --- a/testing/ouia/test_card_ouia.py +++ /dev/null @@ -1,21 +0,0 @@ -import pytest -from widgetastic.widget import View - -from widgetastic_patternfly4.ouia import Card - -TESTING_PAGE_URL = "https://patternfly-docs-ouia.netlify.app/documentation/react/components/card" - -pytestmark = pytest.mark.skip("No OUIA IDs provided on Patternfly testing page") - - -@pytest.fixture -def view(browser): - class TestView(View): - ROOT = ".//div[@id='ws-react-c-card-basic']" - card = Card("352") - - return TestView(browser) - - -def test_card_displayed(view): - assert view.card.is_displayed diff --git a/testing/ouia/test_contextselector_ouia.py b/testing/ouia/test_contextselector_ouia.py deleted file mode 100644 index 053d59ef..00000000 --- a/testing/ouia/test_contextselector_ouia.py +++ /dev/null @@ -1,55 +0,0 @@ -import pytest -from widgetastic.widget import View - -from widgetastic_patternfly4 import SelectItemNotFound -from widgetastic_patternfly4.ouia import ContextSelector - -TESTING_PAGE_URL = "https://patternfly-docs-ouia.netlify.app/documentation/react/components/contextselector" # noqa - -pytestmark = pytest.mark.skip("No OUIA IDs provided on Patternfly testing page") - - -@pytest.fixture -def view(browser): - class TestView(View): - ROOT = ".//div[@id='ws-react-c-contextselector-ouia']" - contextselector = ContextSelector("Basic") - - return TestView(browser) - - -def test_contextselector_is_displayed(view): - assert view.contextselector.is_displayed - - -def test_contextselector_items(view): - assert set(view.contextselector.items) == { - "My Project", - "OpenShift Cluster", - "Production Ansible", - "AWS", - "Azure", - "My Project 2", - "Production Ansible 2", - "AWS 2", - "Azure 2", - } - assert view.contextselector.has_item("AWS") - assert not view.contextselector.has_item("Non existing item") - - -def test_contextselector_open(view): - assert not view.contextselector.is_open - view.contextselector.open() - assert view.contextselector.is_open - view.contextselector.close() - assert not view.contextselector.is_open - - -def test_contextselector_item_select(view): - view.contextselector.fill("AWS") - assert view.contextselector.read() == "AWS" - assert not view.contextselector.is_open - with pytest.raises(SelectItemNotFound): - view.contextselector.fill("Non existing item") - assert not view.contextselector.is_open diff --git a/testing/ouia/test_dropdown_ouia.py b/testing/ouia/test_dropdown_ouia.py deleted file mode 100644 index ac08dca3..00000000 --- a/testing/ouia/test_dropdown_ouia.py +++ /dev/null @@ -1,63 +0,0 @@ -import pytest -from widgetastic.widget import View - -from widgetastic_patternfly4 import DropdownItemDisabled -from widgetastic_patternfly4 import DropdownItemNotFound -from widgetastic_patternfly4.ouia import Dropdown - -TESTING_PAGE_URL = ( - "https://patternfly-docs-ouia.netlify.app/documentation/react/components/dropdown" # noqa -) - -pytestmark = pytest.mark.skip("No OUIA IDs provided on Patternfly testing page") - - -@pytest.fixture -def dropdown(browser): - class TestView(View): - ROOT = ".//div[@id='ws-react-c-dropdown-ouia']" - dropdown = Dropdown("Dropdown") - - view = TestView(browser) - return view.dropdown - - -def test_dropdown_is_displayed(dropdown): - assert dropdown.is_displayed - - -def test_enabled_dropdown(dropdown): - assert dropdown.is_enabled - - -def test_dropdown_items(dropdown): - assert dropdown.items == [ - "Link", - "Action", - "Disabled Link", - "Disabled Action", - "", - "Separated Link", - "Separated Action", - ] - assert dropdown.has_item("Action") - assert not dropdown.has_item("Non existing items") - assert dropdown.item_enabled("Action") - assert not dropdown.item_enabled("Disabled Link") - - -def test_dropdown_open(dropdown): - assert not dropdown.is_open - dropdown.open() - assert dropdown.is_open - dropdown.close() - assert not dropdown.is_open - - -def test_dropdown_item_select(dropdown): - dropdown.item_select("Action") - assert not dropdown.is_open - with pytest.raises(DropdownItemDisabled): - dropdown.item_select("Disabled Link") - with pytest.raises(DropdownItemNotFound): - dropdown.item_select("Non existing items") diff --git a/testing/ouia/test_formselect_ouia.py b/testing/ouia/test_formselect_ouia.py deleted file mode 100644 index af7bc484..00000000 --- a/testing/ouia/test_formselect_ouia.py +++ /dev/null @@ -1,52 +0,0 @@ -import pytest -from widgetastic.widget import View - -from widgetastic_patternfly4 import FormSelectOptionNotFound -from widgetastic_patternfly4.ouia import FormSelect - -TESTING_PAGE_URL = ( - "https://patternfly-docs-ouia.netlify.app/documentation/react/components/formselect" # noqa -) - -pytestmark = pytest.mark.skip("No OUIA IDs provided on Patternfly testing page") - - -@pytest.fixture -def view(browser): - class FormSelectTestView(View): - ROOT = ".//div[@id='ws-react-c-formselect-ouia']" - input = FormSelect("FormSelect Input") - - return FormSelectTestView(browser) - - -def test_formselect_visibility(view): - assert view.input.is_displayed - - -def test_formselect_enablement(view): - assert view.input.is_enabled - - -def test_formselect_validity(view): - assert view.input.is_valid - - -def test_formselect_value(view): - assert len(view.input.all_options) == 7 - assert len(view.input.all_enabled_options) == 6 - assert "Mrs" in view.input.all_options - view.input.fill("Mrs") - assert view.input.read() == "Mrs" - - -def test_formselect_option_enablement(view): - expected_enabled_options = {"Mr", "Miss", "Mrs", "Ms", "Dr", "Other"} - expected_disabled_options = {"Please Choose"} - assert set(view.input.all_enabled_options) == expected_enabled_options - assert expected_disabled_options not in set(view.input.all_enabled_options) - - -def test_formselect_fill_nonexistent_option(view): - with pytest.raises(FormSelectOptionNotFound): - view.input.fill("foo") diff --git a/testing/ouia/test_modal_ouia.py b/testing/ouia/test_modal_ouia.py deleted file mode 100644 index 6cdcf6ea..00000000 --- a/testing/ouia/test_modal_ouia.py +++ /dev/null @@ -1,75 +0,0 @@ -import pytest -from widgetastic.widget import Text -from widgetastic.widget import View - -from widgetastic_patternfly4.modal import ModalItemNotFound -from widgetastic_patternfly4.ouia import Button -from widgetastic_patternfly4.ouia import Modal - -TESTING_PAGE_URL = "https://patternfly-docs-ouia.netlify.app/documentation/react/components/modal" - -pytestmark = pytest.mark.skip("No OUIA IDs provided on Patternfly testing page") - - -@pytest.fixture() -def modal(browser): - class ModalTestView(View): - ROOT = ".//div[@id='ws-react-c-modal-ouia']" - show_modal = Button("Show Modal") - - modal = Modal(browser, "Simple modal") - - view = ModalTestView(browser) - view.show_modal.click() - yield modal - if modal.is_displayed: - modal.close() - - -class CustomModal(Modal): - """Model use as view and enhance with widgets""" - - custom_body = Text(".//div[contains(@class, 'pf-c-modal-box__body')]") - - -def test_title(modal): - assert modal.title - - -def test_body(modal): - body = modal.body - assert body.text.startswith("Lorem") - - -def test_close(modal): - modal.close() - assert not modal.is_displayed - - -def test_footer_items(modal): - items = modal.footer_items - assert len(items) == 2 - assert "Cancel" in items - assert "Confirm" in items - - -def test_footer_item(modal): - item = modal.footer_item("Confirm") - assert item.text == "Confirm" - item.click() - assert not modal.is_displayed - - -def test_footer_item_invalid(modal): - try: - modal.footer_item("INVALID") - except ModalItemNotFound: - assert True - else: - pytest.fail("ModalItemNotFound exception expected.") - - -def test_modal_as_view(browser, modal): - view = CustomModal(browser, "Simple modal") - assert view.is_displayed - assert view.custom_body.text == modal.body.text diff --git a/testing/ouia/test_nav_ouia.py b/testing/ouia/test_nav_ouia.py deleted file mode 100644 index 60ac5354..00000000 --- a/testing/ouia/test_nav_ouia.py +++ /dev/null @@ -1,22 +0,0 @@ -import pytest -from widgetastic.widget import View - -from widgetastic_patternfly4.ouia import Navigation - -TESTING_PAGE_URL = "https://patternfly-docs-ouia.netlify.app/documentation/react/components/nav" - -pytestmark = pytest.mark.skip("No OUIA IDs provided on Patternfly testing page") - - -@pytest.fixture -def view(browser): - class TestView(View): - ROOT = ".//div[@id='ws-react-c-nav-ouia']" - nav = Navigation("Nav Default") - - return TestView(browser) - - -def test_navigation(browser, view): - assert view.nav.currently_selected == ["Link 1"] - assert view.nav.nav_item_tree() == ["Link 1", "Link 2", "Link 3", "Link 4"] diff --git a/testing/ouia/test_optionsmenu_ouia.py b/testing/ouia/test_optionsmenu_ouia.py deleted file mode 100644 index a9ac99cb..00000000 --- a/testing/ouia/test_optionsmenu_ouia.py +++ /dev/null @@ -1,51 +0,0 @@ -import pytest -from widgetastic.widget import View - -from widgetastic_patternfly4 import DropdownItemNotFound -from widgetastic_patternfly4.ouia import OptionsMenu - -TESTING_PAGE_URL = ( - "https://patternfly-docs-ouia.netlify.app/documentation/react/components/optionsmenu" # noqa -) - -pytestmark = pytest.mark.skip("No OUIA IDs provided on Patternfly testing page") - - -@pytest.fixture -def options_menu(browser): - class TestView(View): - ROOT = ".//div[@id='ws-react-c-optionsmenu-ouia']" - options_menu = OptionsMenu("Simple Options Menu") - - return TestView(browser).options_menu - - -def test_options_menu_is_displayed(options_menu): - assert options_menu.is_displayed - - -def test_enabled_options_menu(options_menu): - assert options_menu.is_enabled - - -def test_options_menu_items(options_menu): - assert options_menu.items == ["Option 1", "Option 2", "Option 3"] - assert options_menu.has_item("Option 2") - assert not options_menu.has_item("Non existing items") - assert options_menu.item_enabled("Option 1") - - -def test_options_menu_open(options_menu): - assert not options_menu.is_open - options_menu.open() - assert options_menu.is_open - options_menu.close() - assert not options_menu.is_open - - -def test_options_menu_item_select(options_menu): - options_menu.item_select("Option 2") - assert options_menu.selected_items[0] == "Option 2" - assert not options_menu.is_open - with pytest.raises(DropdownItemNotFound): - options_menu.item_select("Non existing items") diff --git a/testing/ouia/test_pagination_ouia.py b/testing/ouia/test_pagination_ouia.py deleted file mode 100644 index bd8f4803..00000000 --- a/testing/ouia/test_pagination_ouia.py +++ /dev/null @@ -1,126 +0,0 @@ -import pytest -from wait_for import wait_for -from widgetastic.widget import View - -from widgetastic_patternfly4 import PaginationNavDisabled -from widgetastic_patternfly4.ouia import Pagination - -TESTING_PAGE_URL = ( - "https://patternfly-docs-ouia.netlify.app/documentation/react/components/pagination" # noqa -) - -pytestmark = pytest.mark.skip("No OUIA IDs provided on Patternfly testing page") - - -@pytest.fixture -def paginator(browser, request): - class TestView(View): - ROOT = ".//div[@id='ws-react-c-pagination-ouia']" - paginator = Pagination("pagination-options-menu-top") - - paginator = TestView(browser).paginator - wait_for(lambda: paginator.is_displayed, num_sec=10) - yield paginator - try: - paginator.first_page() - except PaginationNavDisabled: - # We are already at the first page... - pass - - -def test_first_page(paginator): - paginator.last_page() - assert paginator.current_page == 27 - paginator.first_page() - assert paginator.is_first_disabled - assert paginator.is_previous_disabled - assert not paginator.is_next_disabled - assert not paginator.is_last_disabled - assert paginator.current_page == 1 - assert paginator.total_pages == 27 - assert paginator.displayed_items == (1, 20) - assert paginator.total_items == 523 - - -def test_previous_page(paginator): - paginator.next_page() - assert paginator.current_page == 2 - paginator.previous_page() - assert not paginator.is_next_disabled - assert not paginator.is_last_disabled - assert paginator.current_page == 1 - assert paginator.total_pages == 27 - assert paginator.displayed_items == (1, 20) - assert paginator.total_items == 523 - - -def test_next_page(paginator): - paginator.next_page() - assert not paginator.is_first_disabled - assert not paginator.is_previous_disabled - assert not paginator.is_next_disabled - assert not paginator.is_last_disabled - assert paginator.current_page == 2 - assert paginator.total_pages == 27 - assert paginator.displayed_items == (21, 40) - assert paginator.total_items == 523 - - -def test_last_page(paginator): - paginator.last_page() - assert not paginator.is_first_disabled - assert not paginator.is_previous_disabled - assert paginator.is_next_disabled - assert paginator.is_last_disabled - assert paginator.current_page == 27 - assert paginator.total_pages == 27 - assert paginator.displayed_items == (521, 523) - assert paginator.total_items == 523 - - -def test_per_page_options(paginator): - assert paginator.per_page_options == [ - "10 per page", - "20 per page", - "50 per page", - "100 per page", - ] - - -@pytest.mark.parametrize("items_per_page", [50, 100]) -def test_iteration(paginator, items_per_page): - assert paginator.is_first_disabled - paginator.set_per_page(items_per_page) - assert paginator.current_per_page == items_per_page - - # Ensure we're always using an int for the math calculations - items_per_page_int = int(str(items_per_page).split()[0]) - - expected_total_pages = 523 // items_per_page_int + 1 - assert paginator.is_previous_disabled - with paginator.cache_per_page_value(): - for page in paginator: - assert paginator.current_page == page - assert paginator.total_pages == expected_total_pages - if items_per_page_int * page > paginator.total_items: - right_number = paginator.total_items - else: - right_number = items_per_page_int * page - assert paginator.displayed_items == (1 + items_per_page_int * (page - 1), right_number) - assert paginator.total_items == 523 - assert paginator.is_next_disabled - assert paginator.is_last_disabled - - -def test_bad_paginator_page_value(paginator): - with pytest.raises(ValueError): - paginator.set_per_page(9999999) - with pytest.raises(ValueError): - paginator.set_per_page("999999") - - -def test_custom_page(paginator): - disp_items = paginator.displayed_items - paginator.go_to_page(2) - assert paginator.current_page == 2 - assert disp_items != paginator.displayed_items diff --git a/testing/ouia/test_select_ouia.py b/testing/ouia/test_select_ouia.py deleted file mode 100644 index 88d45176..00000000 --- a/testing/ouia/test_select_ouia.py +++ /dev/null @@ -1,47 +0,0 @@ -import pytest -from widgetastic.widget import View - -from widgetastic_patternfly4 import SelectItemNotFound -from widgetastic_patternfly4.ouia import Select - -TESTING_PAGE_URL = "https://patternfly-docs-ouia.netlify.app/documentation/react/components/select" - -pytestmark = pytest.mark.skip("No OUIA IDs provided on Patternfly testing page") - - -@pytest.fixture -def select(browser): - class TestView(View): - ROOT = ".//div[@id='ws-react-c-select-ouia']" - select = Select("Single") - - return TestView(browser).select - - -def test_select_is_displayed(select): - assert select.is_displayed - - -@pytest.mark.xfail -def test_select_items(select): - assert set(select.items) == {"Choose...", "Mr", "Miss", "Mrs", "Ms", "Dr", "Other"} - assert select.has_item("Mr") - assert not select.has_item("Non existing item") - assert select.item_enabled("Miss") - - -def test_select_open(select): - assert not select.is_open - select.open() - assert select.is_open - select.close() - assert not select.is_open - - -def test_select_item_select(select): - select.fill("Mr") - assert select.read() == "Mr" - assert not select.is_open - with pytest.raises(SelectItemNotFound): - select.fill("Non existing item") - assert not select.is_open diff --git a/testing/ouia/test_switch_ouia.py b/testing/ouia/test_switch_ouia.py deleted file mode 100644 index 2daf7fc7..00000000 --- a/testing/ouia/test_switch_ouia.py +++ /dev/null @@ -1,47 +0,0 @@ -import pytest -from widgetastic.widget import View - -from widgetastic_patternfly4.ouia import Switch - -TESTING_PAGE_URL = "https://patternfly-docs-ouia.netlify.app/documentation/react/components/switch" - -pytestmark = pytest.mark.skip("No OUIA IDs provided on Patternfly testing page") - - -@pytest.fixture -def view(browser): - class TestView(View): - ROOT = ".//div[@id='ws-react-c-switch-ouia']" - switch = Switch("Simple Switch") - - return TestView(browser) - - -def test_switch_is_displayed(view): - assert view.switch.is_displayed - - -def test_switch_is_enabled(view): - assert view.switch.is_enabled - - -def test_switch_label(view): - assert view.switch.label == "Message when on" - - -def test_switch_selected(view): - assert view.switch.read() - - -def test_switch_fill(view): - assert view.switch.selected - assert view.switch.label == "Message when on" - assert not view.switch.fill(True) - assert view.switch.selected - assert view.switch.label == "Message when on" - assert view.switch.fill(False) - assert not view.switch.selected - assert view.switch.label == "Message when off" - assert view.switch.fill(True) - assert view.switch.selected - assert view.switch.label == "Message when on" diff --git a/testing/ouia/test_table_ouia.py b/testing/ouia/test_table_ouia.py deleted file mode 100644 index d43e2df2..00000000 --- a/testing/ouia/test_table_ouia.py +++ /dev/null @@ -1,29 +0,0 @@ -import pytest -from widgetastic.widget import View - -from widgetastic_patternfly4.ouia import PatternflyTable - -TESTING_PAGE_URL = "https://patternfly-docs-ouia.netlify.app/documentation/react/components/table" - -pytestmark = pytest.mark.skip("No OUIA IDs provided on Patternfly testing page") - -SORT = [ - ("Repositories", "ascending", ["a", "one", "p"]), - ("Repositories", "descending", ["p", "one", "a"]), - ("Pull requests", "ascending", ["a", "b", "k"]), - ("Pull requests", "descending", ["k", "b", "a"]), -] - - -@pytest.mark.parametrize("sample", SORT, ids=lambda sample: "{}-{}".format(sample[0], sample[1])) -def test_sortable_table(browser, sample): - header, order, expected_result = sample - - class TestView(View): - ROOT = ".//div[@id='ws-react-c-table-ouia']" - table = PatternflyTable("Sortable Table") - - view = TestView(browser) - view.table.sort_by(header, order) - column = [row[header] for row in view.table.read()] - assert column == expected_result diff --git a/testing/test_alert.py b/testing/test_alert.py index b0c15506..0d11e1d1 100644 --- a/testing/test_alert.py +++ b/testing/test_alert.py @@ -3,14 +3,14 @@ from widgetastic_patternfly4 import Alert -TESTING_PAGE_URL = "https://patternfly-react.surge.sh/components/alert" +TESTING_PAGE_URL = "https://patternfly-react-main.surge.sh/components/alert" ALERT_TYPES = ["success", "danger", "warning", "info"] @pytest.fixture(params=ALERT_TYPES) def alert(browser, request): class TestView(View): - ROOT = ".//div[@id='ws-react-c-alert-types']" + ROOT = ".//div[@id='ws-react-c-alert-variant-examples']" alert = Alert(locator=f".//div[@class='pf-c-alert pf-m-{request.param}'][1]") return TestView(browser).alert diff --git a/testing/test_breadcrumb.py b/testing/test_breadcrumb.py index b7a9824f..a029690e 100644 --- a/testing/test_breadcrumb.py +++ b/testing/test_breadcrumb.py @@ -6,7 +6,7 @@ from widgetastic_patternfly4 import BreadCrumb -TESTING_PAGE_URL = "https://patternfly-react.surge.sh/components/breadcrumb" +TESTING_PAGE_URL = "https://patternfly-react-main.surge.sh/components/breadcrumb" def test_breadcrumb(browser): diff --git a/testing/test_button.py b/testing/test_button.py index d2b61143..aa464354 100644 --- a/testing/test_button.py +++ b/testing/test_button.py @@ -3,13 +3,13 @@ from widgetastic_patternfly4 import Button -TESTING_PAGE_URL = "https://patternfly-react.surge.sh/components/button" +TESTING_PAGE_URL = "https://patternfly-react-main.surge.sh/components/button" @pytest.fixture def variations_view(browser): class TestView(View): - ROOT = ".//div[@id='ws-react-c-button-variations']" + ROOT = ".//div[@id='ws-react-c-button-variant-examples']" any_button = Button() button1 = Button("Primary") @@ -19,7 +19,7 @@ class TestView(View): @pytest.fixture def disabled_view(browser): class TestView(View): - ROOT = ".//div[@id='ws-react-c-button-disabled']" + ROOT = ".//div[@id='ws-react-c-button-disabled-buttons']" button = Button("Primary disabled") return TestView(browser) diff --git a/testing/test_cardview.py b/testing/test_cardview.py index 9a7e0d79..e789c701 100644 --- a/testing/test_cardview.py +++ b/testing/test_cardview.py @@ -8,7 +8,7 @@ from widgetastic_patternfly4 import CardGroup from widgetastic_patternfly4 import Dropdown -TESTING_PAGE_URL = "https://patternfly-react.surge.sh/demos/card-view/react-demos/card-view/" +TESTING_PAGE_URL = "https://patternfly-react-main.surge.sh/demos/card-view/react-demos/card-view/" class PageCard(CardForCardGroup): diff --git a/testing/test_chartbullet.py b/testing/test_chartbullet.py index c498764e..0bec41d1 100644 --- a/testing/test_chartbullet.py +++ b/testing/test_chartbullet.py @@ -6,7 +6,7 @@ from widgetastic_patternfly4 import BulletChart from widgetastic_patternfly4.bulletchart import DataPoint -TESTING_PAGE_URL = "https://patternfly-react.surge.sh/charts/bullet-chart" +TESTING_PAGE_URL = "https://patternfly-react-main.surge.sh/charts/bullet-chart" Legend = namedtuple("Legend", ["label", "value"]) diff --git a/testing/test_chartdonut.py b/testing/test_chartdonut.py index dc5e9763..39f8b8b0 100644 --- a/testing/test_chartdonut.py +++ b/testing/test_chartdonut.py @@ -3,7 +3,7 @@ from widgetastic_patternfly4 import DonutChart -TESTING_PAGE_URL = "https://patternfly-react.surge.sh/charts/donut-chart" +TESTING_PAGE_URL = "https://patternfly-react-main.surge.sh/charts/donut-chart" @pytest.fixture diff --git a/testing/test_chartline.py b/testing/test_chartline.py index da1c3299..52c8916e 100644 --- a/testing/test_chartline.py +++ b/testing/test_chartline.py @@ -1,12 +1,9 @@ -from time import sleep - import pytest +from widgetastic.widget import View from widgetastic_patternfly4 import LineChart -TESTING_PAGE_URL = ( - "https://www.patternfly.org/v4/charts/line-chart/react/green-with-bottom-aligned-legend/" -) +TESTING_PAGE_URL = "https://patternfly-react-main.surge.sh/charts/line-chart" TEST_DATA = { "2015": {"Cats": "1", "Dogs": "2", "Birds": "3", "Mice": "3"}, @@ -16,27 +13,32 @@ } -@pytest.fixture() -def chart(browser): - sleep(3) # Stabilized graph data on testing page; specially for firefox. - return LineChart(browser, id="ws-react-c-line-chart-green-with-bottom-aligned-legend") +@pytest.fixture +def view(browser): + class TestView(View): + ROOT = ".//div[@id='ws-react-c-line-chart-green-with-bottom-aligned-legend']" + chart = LineChart(locator=".//div[@class='pf-c-chart']") + + return TestView(browser) -def test_line_chart(chart): +def test_line_chart(view): """Test LineChart widget.""" - assert chart.is_displayed + legend_names = view.chart.legend_names + assert view.chart.is_displayed + expected_legends = list(TEST_DATA.values())[0].keys() - for leg, expected_leg in zip(chart.legends, expected_legends): + for leg, expected_leg in zip(view.chart.legends, expected_legends): assert leg.label == expected_leg - assert set(chart.legend_names) == set(expected_legends) + assert set(legend_names) == set(expected_legends) # get data point and check values - birds_legend = chart.get_legend("Birds") + birds_legend = view.chart.get_legend("Birds") assert birds_legend.label == "Birds" assert birds_legend.color == "rgb(35, 81, 30)" # read graph - assert chart.read() == TEST_DATA + assert view.chart.read() == TEST_DATA diff --git a/testing/test_chartpie.py b/testing/test_chartpie.py index c5e9de9b..c572cb90 100644 --- a/testing/test_chartpie.py +++ b/testing/test_chartpie.py @@ -6,7 +6,7 @@ from widgetastic_patternfly4 import PieChart from widgetastic_patternfly4.bulletchart import DataPoint -TESTING_PAGE_URL = "https://patternfly-react.surge.sh/charts/pie-chart" +TESTING_PAGE_URL = "https://patternfly-react-main.surge.sh/charts/pie-chart" Legend = namedtuple("Legend", ["label", "value"]) DATA = {"Cats": 35, "Dogs": 55, "Birds": 10} diff --git a/testing/test_chipgroup.py b/testing/test_chipgroup.py index e76db788..749b18d0 100644 --- a/testing/test_chipgroup.py +++ b/testing/test_chipgroup.py @@ -1,43 +1,27 @@ import pytest -from widgetastic.widget import ParametrizedView from widgetastic.widget import View from widgetastic_patternfly4 import CategoryChipGroup -from widgetastic_patternfly4 import Chip from widgetastic_patternfly4 import ChipGroup -from widgetastic_patternfly4 import ChipReadOnlyError -TESTING_PAGE_URL = "https://patternfly-react.surge.sh/components/chip-group" - - -@pytest.fixture(scope="module") -def chips_view(browser): - class TestView(View): - ROOT = ".//div[@id='ws-react-c-chip-group-single']" - chips = ParametrizedView.nested(Chip) - - return TestView(browser) +TESTING_PAGE_URL = "https://patternfly-react-main.surge.sh/components/chip-group" @pytest.fixture(scope="module") def chip_group_view(browser): class TestView(View): - ROOT = ".//div[@id='ws-react-c-chip-group-simple-inline-chip-group']" + ROOT = ".//div[@id='ws-react-c-chip-group-simple-inline']" non_existent_chip_group = ChipGroup(locator="foobar-locator") chip_group = ChipGroup() - # Firefox fails the test if the chart is not fully visible therefore we click here on anchor - # in order to properly scroll down - anchor = browser.element("//a[@href='#simple-inline-chip-group']") - browser.click(anchor) return TestView(browser) @pytest.fixture(scope="module") def category_chip_group_view(browser): class TestView(View): - ROOT = ".//div[@id='ws-react-c-chip-group-chip-groups-with-categories-removable']" + ROOT = ".//div[@id='ws-react-c-chip-group-with-removable-categories']" category_one = CategoryChipGroup(label="Category one") category_two = CategoryChipGroup(label="Category two has a very long name") @@ -48,47 +32,6 @@ def test_non_existent_chips(chip_group_view): assert not chip_group_view.non_existent_chip_group.is_displayed -def test_chipgroup_chips(chips_view): - view = chips_view - plain_chip = view.chips("Chip 1") - long_chip = view.chips("Really long chip that goes on and on") - chip_with_badge = view.chips("Chip") - read_only_chip = view.chips("Read-only chip") - - assert plain_chip.text == "Chip 1" - assert not plain_chip.badge - assert plain_chip.is_displayed - assert not plain_chip.read_only - assert plain_chip.read() == "Chip 1" - plain_chip.remove() - assert not plain_chip.is_displayed - - assert long_chip.text == "Really long chip that goes on and on" - assert not long_chip.badge - assert long_chip.is_displayed - assert not long_chip.read_only - assert long_chip.read() == "Really long chip that goes on and on" - long_chip.remove() - assert not long_chip.is_displayed - - assert chip_with_badge.text == "Chip" - assert chip_with_badge.badge == "7" - assert chip_with_badge.is_displayed - assert not chip_with_badge.read_only - assert chip_with_badge.read() == "Chip" - chip_with_badge.remove() - assert not chip_with_badge.is_displayed - - assert read_only_chip.text == "Read-only chip" - assert not read_only_chip.badge - assert not read_only_chip.button.is_displayed - assert read_only_chip.is_displayed - assert read_only_chip.read_only - assert read_only_chip.read() == "Read-only chip" - with pytest.raises(ChipReadOnlyError): - read_only_chip.remove() - - def test_chipgroup_simple(chip_group_view): assert chip_group_view.is_displayed assert chip_group_view.chip_group.is_displayed diff --git a/testing/test_contextselector.py b/testing/test_contextselector.py index ca2ca489..f6f24b39 100644 --- a/testing/test_contextselector.py +++ b/testing/test_contextselector.py @@ -4,7 +4,7 @@ from widgetastic_patternfly4 import ContextSelector from widgetastic_patternfly4 import SelectItemNotFound -TESTING_PAGE_URL = "https://patternfly-react.surge.sh/components/context-selector" +TESTING_PAGE_URL = "https://patternfly-react-main.surge.sh/components/context-selector" @pytest.fixture @@ -24,12 +24,17 @@ def test_contextselector_is_displayed(view): def test_contextselector_items(view): assert set(view.contextselector.items) == { + "Link", + "Action", + "Disabled link", + "Disabled action", "My project", "OpenShift cluster", "Production Ansible", "AWS", "Azure", "My project 2", + "OpenShift cluster", "Production Ansible 2", "AWS 2", "Azure 2", diff --git a/testing/test_dropdown.py b/testing/test_dropdown.py index 4888dcfe..b15961bf 100644 --- a/testing/test_dropdown.py +++ b/testing/test_dropdown.py @@ -7,13 +7,13 @@ from widgetastic_patternfly4 import GroupDropdown from widgetastic_patternfly4 import SplitButtonDropdown -TESTING_PAGE_URL = "https://patternfly-react.surge.sh/components/dropdown" +TESTING_PAGE_URL = "https://patternfly-react-main.surge.sh/components/dropdown" @pytest.fixture def view(browser): class TestView(View): - ROOT = "(.//div[@id='ws-react-c-dropdown-basic'])[1]" + ROOT = ".//div[@id='ws-react-c-dropdown-basic-dropdowns']" dropdown_txt_locator = Dropdown("Dropdown") dropdown_custom_locator = Dropdown(locator=".//div[contains(@class, 'pf-c-dropdown')]") dropdown_default_locator = Dropdown() @@ -33,14 +33,17 @@ def group_dropdown(browser): return GroupDropdown( browser, locator=( - ".//div[@id='ws-react-c-dropdown-with-groups']" + ".//div[@id='ws-react-c-dropdown-with-groups-of-items']" "/div[contains(@class, 'pf-c-dropdown')]" ), ) @pytest.fixture( - params=["ws-react-c-dropdown-split-button", "ws-react-c-dropdown-split-button-with-text"], + params=[ + "ws-react-c-dropdown-split-button-checkbox", + "ws-react-c-dropdown-split-button-checkbox-with-toggle-text", + ], ids=["without_text", "with_text"], ) def split_button_dropdown(request, browser): @@ -107,10 +110,10 @@ def test_group_dropdown(group_dropdown): assert group_dropdown.has_item("Group 2 link") assert group_dropdown.item_enabled("Group 3 action") assert group_dropdown.groups == ["Group 2", "Group 3"] - group_dropdown.item_select("Link") - group_dropdown.item_select("Group 3 link", group_name="Group 3") + group_dropdown.item_select("Group 3 action", group_name="Group 3") with pytest.raises(DropdownItemNotFound): - group_dropdown.item_select("Group 3 link", group_name="Group 2") + group_dropdown.item_select("Group 3 action", group_name="Group 2") + group_dropdown.item_select("Link") def test_split_button_dropdown(split_button_dropdown): @@ -121,7 +124,7 @@ def test_split_button_dropdown(split_button_dropdown): dropdown.item_select("Action") assert dropdown.check() assert dropdown.selected - expected_text = "10 selected" if "with-text" in dropdown_type else "" + expected_text = "10 selected" if "with-toggle-text" in dropdown_type else "" assert dropdown.read() == expected_text assert dropdown.uncheck() diff --git a/testing/test_duallistselector.py b/testing/test_duallistselector.py index a591a867..7472dd31 100644 --- a/testing/test_duallistselector.py +++ b/testing/test_duallistselector.py @@ -4,7 +4,7 @@ from widgetastic_patternfly4 import DualListSelector from widgetastic_patternfly4 import SearchDualListSelector -TESTING_PAGE_URL = "https://patternfly-react.surge.sh/components/dual-list-selector" +TESTING_PAGE_URL = "https://patternfly-react-main.surge.sh/components/dual-list-selector" @pytest.fixture diff --git a/testing/test_formselect.py b/testing/test_formselect.py index 1e456f3a..d9fe3436 100644 --- a/testing/test_formselect.py +++ b/testing/test_formselect.py @@ -6,7 +6,7 @@ from widgetastic_patternfly4 import FormSelectOptionDisabled from widgetastic_patternfly4 import FormSelectOptionNotFound -TESTING_PAGE_URL = "https://patternfly-react.surge.sh/components/form-select" +TESTING_PAGE_URL = "https://patternfly-react-main.surge.sh/components/form-select" class FormSelectTestView(View): @@ -14,7 +14,6 @@ class FormSelectTestView(View): input = FormSelect(locator=".//div[@id='ws-react-c-form-select-basic']/select") input_grouping = FormSelect(locator=".//div[@id='ws-react-c-form-select-grouped']/select") - input_invalid = FormSelect(locator=".//div[@id='ws-react-c-form-select-invalid']/select") input_disabled = FormSelect(locator=".//div[@id='ws-react-c-form-select-disabled']/select") @@ -26,14 +25,12 @@ def view(browser): def test_formselect_visibility(view): assert view.input.is_displayed assert view.input_grouping.is_displayed - assert view.input_invalid.is_displayed assert view.input_disabled.is_displayed def test_formselect_enablement(view): assert view.input.is_enabled assert view.input_grouping.is_enabled - assert view.input_invalid.is_enabled assert not view.input_disabled.is_enabled @@ -41,11 +38,6 @@ def test_formselect_validity(view): assert view.input.is_valid assert view.input_grouping.is_valid assert view.input_disabled.is_valid - assert view.input_invalid.is_valid - view.input_invalid.fill("One") - assert view.input_invalid.is_valid - view.input_invalid.fill("Select a number") - assert not view.input_invalid.is_valid def test_formselect_value(view): diff --git a/testing/test_menu.py b/testing/test_menu.py index 550abb96..3034fa2a 100644 --- a/testing/test_menu.py +++ b/testing/test_menu.py @@ -4,13 +4,13 @@ from widgetastic_patternfly4 import Menu from widgetastic_patternfly4 import MenuItemNotFound -TESTING_PAGE_URL = "https://patternfly-react.surge.sh/components/menu" +TESTING_PAGE_URL = "https://patternfly-react-main.surge.sh/components/menu" @pytest.fixture def menu(browser): class TestView(View): - ROOT = ".//div[@id='ws-react-c-menu-option-single-select']" + ROOT = ".//div[@id='ws-react-c-menu-option-single-select-menu']" menu = Menu(locator=".//div[contains(@class, 'pf-c-menu')]") return TestView(browser).menu @@ -19,7 +19,7 @@ class TestView(View): @pytest.fixture def multi_select_menu(browser): class TestView(View): - ROOT = ".//div[@id='ws-react-c-menu-option-multi-select']" + ROOT = ".//div[@id='ws-react-c-menu-option-multi-select-menu']" menu = Menu(locator=".//div[contains(@class, 'pf-c-menu')]") return TestView(browser).menu diff --git a/testing/test_modal.py b/testing/test_modal.py index 1ab94398..bf3d28bf 100644 --- a/testing/test_modal.py +++ b/testing/test_modal.py @@ -5,12 +5,12 @@ from widgetastic_patternfly4.modal import Modal from widgetastic_patternfly4.modal import ModalItemNotFound -TESTING_PAGE_URL = "https://patternfly-react.surge.sh/components/modal" +TESTING_PAGE_URL = "https://patternfly-react-main.surge.sh/components/modal" @pytest.fixture() def modal(browser): - show_modal = Button(browser, "Show modal") + show_modal = Button(browser, "Show basic modal") show_modal.click() modal = Modal(browser) yield modal diff --git a/testing/test_nav.py b/testing/test_nav.py index 5b6275c5..920f4ab2 100644 --- a/testing/test_nav.py +++ b/testing/test_nav.py @@ -4,30 +4,35 @@ from widgetastic_patternfly4 import Navigation from widgetastic_patternfly4 import NavSelectionNotFound -TESTING_PAGE_URL = "https://patternfly-react.surge.sh/components/navigation" +TESTING_PAGE_URL = "https://patternfly-react-main.surge.sh/components/navigation" NAVS = [ ( ".//div[@id='ws-react-c-navigation-default']", - ["Link 1", "Link 2", "Link 3", "Link 4"], - ["Link 1"], + ["Default Link 1", "Default Link 2", "Default Link 3", "Default Link 4"], + ["Default Link 1"], "default", ), ( ".//div[@id='ws-react-c-navigation-expandable']", { - "Link 1": ["Subnav Link 1", "Subnav Link 2", "Subnav Link 3"], - "Link 2": ["Custom onClick", "Subnav Link 1", "Subnav Link 2", "Subnav Link 3"], + "Expandable Group 1": ["Subnav 1 Link 1", "Subnav 1 Link 2", "Subnav 1 Link 3"], + "Expandable Group 2": [ + "Custom onClick Link", + "Subnav 2 Link 1", + "Subnav 2 Link 2", + "Subnav 2 Link 3", + ], }, - ["Link 1", "Subnav Link 1"], + ["Expandable Group 1", "Subnav 1 Link 1"], "expandable", ), ( ".//div[@id='ws-react-c-navigation-mixed']", { "Link 1 (not expandable)": None, - "Link 2 - expandable": ["Link 1", "Link 2", "Link 3"], - "Link 3 - expandable": ["Link 1", "Link 2", "Link 3"], + "Expandable section title 1": ["Mixed Link 1", "Mixed Link 2", "Mixed Link 3"], + "Expandable section title 2": ["Mixed 2 Link 1", "Mixed 2 Link 2", "Mixed 2 Link 3"], }, ["Link 1 (not expandable)"], "mixed", @@ -59,8 +64,8 @@ class TestView(View): nav = Navigation(locator="./nav") nav = TestView(browser).nav - nav.select("Link 3 - expandable", "Link 2") - assert nav.currently_selected == ["Link 3 - expandable", "Link 2"] + nav.select("Expandable section title 2", "Mixed 2 Link 2") + assert nav.currently_selected == ["Expandable section title 2", "Mixed 2 Link 2"] nav.select("Link 1 (not expandable)") assert nav.currently_selected == ["Link 1 (not expandable)"] diff --git a/testing/test_optionsmenu.py b/testing/test_optionsmenu.py index 22ab21e1..87aaf106 100644 --- a/testing/test_optionsmenu.py +++ b/testing/test_optionsmenu.py @@ -4,7 +4,7 @@ from widgetastic_patternfly4 import DropdownItemNotFound from widgetastic_patternfly4 import OptionsMenu -TESTING_PAGE_URL = "https://patternfly-react.surge.sh/components/options-menu" +TESTING_PAGE_URL = "https://patternfly-react-main.surge.sh/components/options-menu" @pytest.fixture diff --git a/testing/test_pagination.py b/testing/test_pagination.py index bf0b7530..eaa47b82 100644 --- a/testing/test_pagination.py +++ b/testing/test_pagination.py @@ -8,7 +8,7 @@ from widgetastic_patternfly4 import Pagination from widgetastic_patternfly4 import PaginationNavDisabled -TESTING_PAGE_URL = "https://patternfly-react.surge.sh/components/pagination" +TESTING_PAGE_URL = "https://patternfly-react-main.surge.sh/components/pagination" @contextlib.contextmanager diff --git a/testing/test_popover.py b/testing/test_popover.py index 2a78fcdf..1bfb701b 100644 --- a/testing/test_popover.py +++ b/testing/test_popover.py @@ -4,7 +4,7 @@ from widgetastic_patternfly4 import Popover from widgetastic_patternfly4.button import Button -TESTING_PAGE_URL = "https://patternfly-react.surge.sh/components/popover" +TESTING_PAGE_URL = "https://patternfly-react-main.surge.sh/components/popover" PF4_EXAMPLE_POPOVER_TEXT_TITLE = "Popover header" PF4_EXAMPLE_POPOVER_TEXT_BODY = "Popovers are triggered by click rather than hover." PF4_EXAMPLE_POPOVER_TEXT_FOOTER = "Popover footer" diff --git a/testing/test_progress.py b/testing/test_progress.py index d7aaf815..3c0ef7d6 100644 --- a/testing/test_progress.py +++ b/testing/test_progress.py @@ -3,7 +3,7 @@ from widgetastic_patternfly4 import Progress -TESTING_PAGE_URL = "https://patternfly-react.surge.sh/components/progress" +TESTING_PAGE_URL = "https://patternfly-react-main.surge.sh/components/progress" PROGRESS_STATUS_TYPES_WITH_CURRENT_PROGRESS = { "success": "100", "danger": "33", diff --git a/testing/test_radio.py b/testing/test_radio.py index 30f61f1f..bdaf22f4 100644 --- a/testing/test_radio.py +++ b/testing/test_radio.py @@ -4,7 +4,7 @@ from widgetastic_patternfly4 import Radio -TESTING_PAGE_URL = "https://patternfly-react.surge.sh/components/radio" +TESTING_PAGE_URL = "https://patternfly-react-main.surge.sh/components/radio" class RadioTestView(View): @@ -18,7 +18,7 @@ class RadioTestView(View): @pytest.mark.parametrize( "test_widget", [ - ("controlled_id", dict(radio=False, label="Controlled radio")), + ("controlled_id", dict(radio=False, label="Controlled Radio")), ("uncontrolled_label", dict(radio=False, label="Uncontrolled radio example")), ( "description_body", diff --git a/testing/test_select.py b/testing/test_select.py index 57cfd256..2dd2f0fe 100644 --- a/testing/test_select.py +++ b/testing/test_select.py @@ -5,7 +5,7 @@ from widgetastic_patternfly4 import Select from widgetastic_patternfly4 import SelectItemNotFound -TESTING_PAGE_URL = "https://patternfly-react.surge.sh/components/select" +TESTING_PAGE_URL = "https://patternfly-react-main.surge.sh/components/select" @pytest.fixture diff --git a/testing/test_slider.py b/testing/test_slider.py index 214e4bbf..ca5bf9e2 100644 --- a/testing/test_slider.py +++ b/testing/test_slider.py @@ -5,7 +5,7 @@ from widgetastic_patternfly4 import InputSlider from widgetastic_patternfly4 import Slider -TESTING_PAGE_URL = "https://patternfly-react.surge.sh/components/slider/" +TESTING_PAGE_URL = "https://patternfly-react-main.surge.sh/components/slider/" TEST_DATA = { "discrete": {"steps": [-25, -15, -5, 5, 15, 25, 35, 45, 55, 65, 75], "labels": [-25, 75]}, "value": {"steps": [0, 25, 50, 75, 100], "labels": ["0%", "50%", "100%"]}, diff --git a/testing/test_switch.py b/testing/test_switch.py index cf080a05..3a5f30c9 100644 --- a/testing/test_switch.py +++ b/testing/test_switch.py @@ -4,7 +4,7 @@ from widgetastic_patternfly4 import Switch from widgetastic_patternfly4 import SwitchDisabled -TESTING_PAGE_URL = "https://patternfly-react.surge.sh/components/switch" +TESTING_PAGE_URL = "https://patternfly-react-main.surge.sh/components/switch" @pytest.fixture @@ -68,7 +68,6 @@ def test_switch_fill(view): assert not view.switch.selected assert view.switch.label == "Message when off" assert view.switch.fill(True) - assert view.switch.selected assert view.switch.label == "Message when on" diff --git a/testing/test_table.py b/testing/test_table.py index 5faf1c3c..c614b237 100644 --- a/testing/test_table.py +++ b/testing/test_table.py @@ -8,26 +8,26 @@ from widgetastic_patternfly4 import PatternflyTable from widgetastic_patternfly4 import RowNotExpandable -TESTING_PAGE_URL = "https://patternfly-react.surge.sh/components/table" +TESTING_PAGE_URL = "https://patternfly-react-main.surge.sh/components/table" SORT = [ ( - "This is a really long table header that goes on for a long time 1.", + "Repositories table header that goes on for a long time.", "ascending", ["a", "one", "p"], ), ( - "This is a really long table header that goes on for a long time 1.", + "Repositories table header that goes on for a long time.", "descending", ["p", "one", "a"], ), ( - "This is a really long table header that goes on for a long time 3.", + "Pull requests table header that goes on for a long time.", "ascending", ["a", "b", "k"], ), ( - "This is a really long table header that goes on for a long time 3.", + "Pull requests table header that goes on for a long time.", "descending", ["k", "b", "a"], ), @@ -39,7 +39,7 @@ def test_sortable_table(browser, sample): header, order, expected_result = sample table = PatternflyTable( browser, - ".//div[@id='ws-react-composable-c-table-composable-sortable--wrapping-headers']/table", + ".//div[@id='ws-react-c-table-composable-sortable--wrapping-headers']/table", ) table.sort_by(header, order) column = [row[header] for row in table.read()] @@ -53,7 +53,7 @@ def test_selectable_table(browser, sample): method, expected_result = sample table = PatternflyTable( browser, - ".//div[@id='ws-react-composable-c-table-composable-selectable-with-checkbox']//table", + ".//div[@id='ws-react-c-table-composable-selectable-with-checkbox']//table", column_widgets={0: Checkbox(locator=".//input")}, ) getattr(table, method)() @@ -116,12 +116,10 @@ def test_expandable_table(browser): ] row1_expected_content = "single cell" - row2_expected_content = "single cell - fullWidth" + row2_expected_content = "Lorem ipsum sit dolor." row3_expected_content = "single cell - noPadding" - table = ExpandableTable( - browser, ".//div[@id='ws-react-composable-c-table-composable-expandable']/table" - ) + table = ExpandableTable(browser, ".//div[@id='ws-react-c-table-composable-expandable']/table") assert table.read() == expected_read @@ -146,7 +144,7 @@ def test_expandable_table(browser): parent2_row.expand() assert parent2_row.is_expanded assert parent2_row.content.is_displayed - assert parent2_row.content.read() == row2_expected_content + assert row2_expected_content in parent2_row.content.read() parent3_row.expand() assert parent3_row.is_expanded @@ -167,118 +165,18 @@ def test_compound_expandable_table(browser, use_different_widgets): "Pull requests": "4", "Workspaces": "4", "Last commit": "20 minutes", - 5: "Open in Github", + 5: "Open in GitHub", }, { - "Repositories": "siemur/test-space", + "Repositories": "siemur/test-space-2", "Branches": "3", "Pull requests": "4", - "Workspaces": "2", - "Last commit": "10 minutes", - 5: "Open in Github", + "Workspaces": "4", + "Last commit": "20 minutes", + 5: "Open in GitHub", }, ] - row0_branches_read = { - "table": [ - { - "Repositories": "parent-0", - "Branches": "compound-1", - "Pull requests": "three", - "Workspaces": "four", - "Last Commit": "five", - }, - { - "Repositories": "a", - "Branches": "two", - "Pull requests": "k", - "Workspaces": "four", - "Last Commit": "five", - }, - { - "Repositories": "p", - "Branches": "two", - "Pull requests": "b", - "Workspaces": "four", - "Last Commit": "five", - }, - ] - } - row0_pull_requests_read = { - "table": [ - { - "Repositories": "parent-0", - "Branches": "compound-2", - "Pull requests": "three", - "Workspaces": "four", - "Last Commit": "five", - }, - { - "Repositories": "a", - "Branches": "two", - "Pull requests": "k", - "Workspaces": "four", - "Last Commit": "five", - }, - { - "Repositories": "p", - "Branches": "two", - "Pull requests": "b", - "Workspaces": "four", - "Last Commit": "five", - }, - ] - } - row0_workspaces_read = { - "table": [ - { - "Repositories": "parent-0", - "Branches": "compound-3", - "Pull requests": "three", - "Workspaces": "four", - "Last Commit": "five", - }, - { - "Repositories": "a", - "Branches": "two", - "Pull requests": "k", - "Workspaces": "four", - "Last Commit": "five", - }, - { - "Repositories": "p", - "Branches": "two", - "Pull requests": "b", - "Workspaces": "four", - "Last Commit": "five", - }, - ] - } - row1_branches_read = { - "table": [ - { - "Repositories": "parent-1", - "Branches": "compound-1", - "Pull requests": "three", - "Workspaces": "four", - "Last Commit": "five", - }, - { - "Repositories": "a", - "Branches": "two", - "Pull requests": "k", - "Workspaces": "four", - "Last Commit": "five", - }, - { - "Repositories": "p", - "Branches": "two", - "Pull requests": "b", - "Workspaces": "four", - "Last Commit": "five", - }, - ] - } if use_different_widgets: # for the example table all the expanded tables are the same, besides the different id # that we use in the locator @@ -325,19 +223,16 @@ class _ContentView(View): row0 = table[0] row0.branches.expand() assert row0.branches.is_expanded - assert row0.branches.content.read() == row0_branches_read row0.branches.collapse() assert not row0.branches.is_expanded row0.pull_requests.expand() assert row0.pull_requests.is_expanded - assert row0.pull_requests.content.read() == row0_pull_requests_read row0.pull_requests.collapse() assert not row0.pull_requests.is_expanded row0.workspaces.expand() assert row0.workspaces.is_expanded - assert row0.workspaces.content.read() == row0_workspaces_read row0.workspaces.collapse() assert not row0.workspaces.is_expanded @@ -345,6 +240,5 @@ class _ContentView(View): row1 = table[1] row1.branches.expand() assert row1.branches.is_expanded - assert row1.branches.content.read() == row1_branches_read row1.branches.collapse() assert not row1.branches.is_expanded diff --git a/testing/test_tabs.py b/testing/test_tabs.py index 88b392e9..35d16e94 100644 --- a/testing/test_tabs.py +++ b/testing/test_tabs.py @@ -3,7 +3,7 @@ from widgetastic_patternfly4 import Tab -TESTING_PAGE_URL = "https://patternfly-react.surge.sh/components/tabs" +TESTING_PAGE_URL = "https://patternfly-react-main.surge.sh/components/tabs" class TabsTestView(View): diff --git a/testing/test_title.py b/testing/test_title.py index 2eeaddde..0c2d7fbc 100644 --- a/testing/test_title.py +++ b/testing/test_title.py @@ -3,16 +3,16 @@ from widgetastic_patternfly4 import Title -TESTING_PAGE_URL = "https://patternfly-react.surge.sh/components/title" +TESTING_PAGE_URL = "https://patternfly-react-main.surge.sh/components/title" class TitleTestView(View): - h1 = Title("4xl Title") - h2 = Title("3xl Title") - h3 = Title("2xl Title") - h4 = Title("xl Title") - h5 = Title("lg Title") - h6 = Title("md Title") + h1 = Title("h1 defaults to 2xl") + h2 = Title("h2 defaults to xl") + h3 = Title("h3 defaults to lg") + h4 = Title("h4 defaults to md") + h5 = Title("h5 defaults to md") + h6 = Title("h6 defaults to md") def test_location_and_size(browser):