discourse/spec/system/page_objects
Krzysztof Kotlarek db4395d70c
FIX: flaky flags specs when moving up or down (#28272)
Those are the steps to move the flag:
1. open menu;
2. click move up - `saving` CSS class is added;
3. request to backend;
4. `saving` CSS class is removed.

To check if the action was finished we are using this method:
```
def move_up(key)
  open_flag_menu(key)
  find(".admin-flag-item__move-up").click
  has_saved_flag?(key)
  self
end

def has_saved_flag?(key)
  has_css?(".admin-flag-item.#{key}.saving")
  has_no_css?(".admin-flag-item.#{key}.saving")
end
```

However, sometimes specs were failing with `expected to find CSS ".admin-flag-item.spam.saving" but there were no matches`

I think that the problem is with those 2 lines:
```
  find(".admin-flag-item__move-up").click
  has_closed_flag_menu?
```
If the save action is very fast, then the `saving` class is removed before the first check.

Therefore, to determine that the move action is finished, I am checking if the menu is closed.
2024-08-08 09:50:28 +08:00
..
components DEV: Add site age and site activities section to the redesigned about page (#28214) 2024-08-07 11:11:41 +03:00
modals UX: move admin flag form to form-kit (#28187) 2024-08-05 11:01:25 +10:00
pages FIX: flaky flags specs when moving up or down (#28272) 2024-08-08 09:50:28 +08:00
admin_badges.rb FIX: Badge image uploader (#28188) 2024-08-01 15:36:17 +02:00
admin_user_badges.rb DEV: lint against Layout/EmptyLineBetweenDefs (#24914) 2023-12-15 23:46:04 +08:00
cdp.rb DEV: Try until success for clipboard copies (#27986) 2024-07-19 19:44:10 +08:00