Wunderbyte-GmbH / moodle-local_shopping_cart

Other
4 stars 5 forks source link

Testing: Local Behat failures (Firefox only) #42

Closed semteacher closed 9 months ago

semteacher commented 1 year ago

Branch: "USI" 3 Behat tests have failed on local dev env but under FireFox browser only (all is OK under Chrome):

001 Scenario: Cashier buys item and gives refund                                              # /var/www/html/local/shopping_cart/tests/behat/shopping_cart_cashier.feature:130
      Then I should see "8" in the "ul.cashier-history-items span.credit_total" "css_element" # /var/www/html/local/shopping_cart/tests/behat/shopping_cart_cashier.feature:154
        Css_element matching locator "ul.cashier-history-items span.credit_total" not found. (Behat\Mink\Exception\ElementNotFoundException)

002 Scenario: Cashier buys discounted item and gives refund # /var/www/html/local/shopping_cart/tests/behat/shopping_cart_cashier.feature:161
      And I press "Save changes"                            # /var/www/html/local/shopping_cart/tests/behat/shopping_cart_cashier.feature:192
        Dismissed user prompt dialog: To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier. (Facebook\WebDriver\Exception\UnexpectedAlertOpenException)

003 Scenario: Cashier buys three items and cancel purchase when consumption enabled # /var/www/html/local/shopping_cart/tests/behat/shopping_cart_cashier_consumption.feature:45
      And I press "Save changes"                                                    # /var/www/html/local/shopping_cart/tests/behat/shopping_cart_cashier_consumption.feature:83
        Dismissed user prompt dialog: To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier. (Facebook\WebDriver\Exception\UnexpectedAlertOpenException)

Visual representation: image All errors refers to reloading of page with form element initiated by JS code window.location.reload(); Discussions: https://developer.mozilla.org/en-US/docs/Web/API/Location/reload https://stackoverflow.com/questions/9871705/to-display-this-page-firefox-must-send-information-that-will-repeat-any-action Solutions: Recipes like window.location=window.location works but a) produces JS compilation warning b) reload page without selected user (set cashier page back to "select user" step). Not sure it is OK c) not to reload page at all - update "order history" sideblock via JS... But it will need a lots of work