RedHatQE / widgetastic.patternfly

Library of Patternfly widgets for Widgetastic.
Other
13 stars 29 forks source link

Modal in unit test does not pass is_displayed #126

Open mshriver opened 4 years ago

mshriver commented 4 years ago
______________________________ test_generic_modal ______________________________
browser = <testing.conftest.CustomBrowser object at 0x7f5c3316c7f0>
    def test_generic_modal(browser):
        class TestView(View):
            """ Dummy page matching testing_page.html elements"""
            button = Button('Launch demo modal')
            modal = SpecificModal(id=modal_id)

        view = TestView(browser)
        assert not view.modal.is_displayed
        # Open the modal
        assert not view.button.disabled
        view.button.click()
        wait_for(lambda: view.modal.is_displayed,

>                delay=0.5, num_sec=MODAL_INTERACTION_TIMEOUT)
E       wait_for.TimedOutError: Could not do 'lambda defined as `wait_for(lambda: view.modal.is_displayed,
E                    delay=0.5, num_sec=MODAL_INTERACTION_TIMEOUT)`' at /home/travis/build/RedHatQE/widgetastic.patternfly/testing/test_modal.py:50 in time

The id is passed for the modal, and the if id block is evaluated in the modal constructor, but the ROOT locator does not appear to be correctly updated.

(Pdb) view.modal.__locator__()
Locator(by='xpath', locator='.//div[contains(@class, "modal") and contains(@class, "fade") and @role="dialog"]')

The modal, though displayed, is not reading the 'in' class that is included in the modal div when the modal is opened.

(Pdb) view.modal.browser.classes(view.modal)
{'modal', 'fade'}