Open filipefurtad0 opened 3 months ago
Still occurring. The only thing I can think of is adding a sleep(2)
before the failing assertion, to make sure we bypass the Updating...
warning...
Any other ideas?
Edit: sleeping this does not fix it either. The failing scenario looks like this:
1) The change is made
2) The Save button is clicked (it displays a slightly different color)
3) The message does not change to Updating...
nor to Your order cycle has been updated.
I've tried to reproduce this locally and on staging, but was not successful. Chrome throws out some warnings on this regard, but these seem unrelated to me:
@filipefurtad0
I tried adding sleep(2)
just before the save button is clicked and it seems to work fine for me. (Tested 50 plus times consecutively without failure).
Not sure if it's worth it but mentioning in case.
Here the diff
diff --git a/spec/system/admin/order_cycles/edit_spec.rb b/spec/system/admin/order_cycles/edit_spec.rb
index c3899aa35e..337e9bdf46 100644
--- a/spec/system/admin/order_cycles/edit_spec.rb
+++ b/spec/system/admin/order_cycles/edit_spec.rb
@@ -83,6 +83,7 @@ RSpec.describe '
find("button", text: "Close").click
end
expect(page).to have_content('You have unsaved changes')
+ sleep(2)
click_button('Save')
expect(page).to have_field 'order_cycle_orders_close_at', with: '2024-03-30 00:00'
@@ -155,6 +156,7 @@ RSpec.describe '
find("button", text: "Close").click
end
expect(page).to have_content('You have unsaved changes')
+ sleep(2)
click_button('Save')
expect(page).to have_content('Your order cycle has been updated.')
Thanks so much @wandji20,
Did you push this change to master? The thing is I can't make it fail locally (I've ran several variations, 50x each and no failures on my local env.) but if you observe the test to master on CI, then I guess it could be an alternative to my PR here.
What do you think is best?
Did you push this change to master?
No, I was only testing locally. This one can be annoying as it can't be consistently reproduced.
What do you think is best?
How about we try both, may be my suggestion with rerty first
How about we try both, may be my suggestion with rerty first
Great idea :raised_hands: I mean, both approaches are a workaround but I'd say we need to get this one green asap. I'll add the two seconds sleep on the PR. Thanks!
This has not been occurring since #12800; I've added an entry in https://github.com/openfoodfoundation/openfoodnetwork/issues/12086, so I think we can close here.
It just came up again, despite retry:
What we should change and why (this is tech debt)
./spec/system/admin/order_cycles/edit_spec.rb:65
Context
https://github.com/openfoodfoundation/openfoodnetwork/actions/runs/10426143065/job/28921607320?pr=12785
Impact and timeline