Files
odoo_source/static
Romain Derie adc41c0ed2 [FIX] webite_sale_coupon: adapt test with new checkout
Since commit 006ce9c887 set the `Promo Code` view active (customize_show),
the `shop_sale_coupon` JS tour should not be working anymore.
But it was working since this change introduced a race condition that was
luckily making the test to succeed (most of the time).
(This bug appeared weeks ago on nightly build)

Basically, the tour flow was:
1. Activating `Promo Code` in customize option -> Cause a page refresh
2. Waiting for the DOM to contains the promo code input (shown after page
   refresh performed by step 1.)
3. Typing a promo code and submitting it
4. Waiting for the discount line to appear (after page load performed by
   step 3 form submit.)

This test was working fine as the promo code customize option was disabled.
Thus, the promo code input would only be visible after the refresh of step 1.
It would always wait for the refresh to occur before continuing.
No race condition possible.

Since the change of 006ce9c887 that activated that view by default:
  - The promo code input would already be on the DOM when the tour was executed
  - Clicking on the customize option would actually disable it.

Then, since the input was already in the DOM, the step 2 would instantly
continue without waiting for the refresh of step 1 and step 3 would be
performed while step 1 would still be refreshing the page.
You would then land sometimes on the refresh of step 1, sometimes on the
refresh of step 3, depending of the test speed (and so the runbot).
In case you landed on refresh of step 1, step 4 would never find the discount
line.

---- SOLUTION ----

Click on the customize option only if not already enabled.
(The customize step could have simply been removed as it is now activated by
default. But this is better to prevent the test to fail in case we change that
customize active state in the future or to simply run the test more than once)
2018-08-14 22:09:27 +02:00
..