discourse/app/assets/javascripts/admin/addon
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
..
adapters FEATURE: Add Filter for Webhook Events by Status (#27332) 2024-06-07 10:26:00 -05:00
components FIX: flaky flags specs when moving up or down (#28272) 2024-08-08 09:50:28 +08:00
controllers FIX: Badge image uploader (#28188) 2024-08-01 15:36:17 +02:00
helpers DEV: replace registerUnbound usage with default exports (#23802) 2023-10-19 14:28:25 +01:00
lib DEV: Rename I18n imports to discourse-i18n (#23915) 2023-10-18 11:07:09 +01:00
mixins DEV: Remove object-property-decorators from admin mixins (#28172) 2024-07-31 17:37:15 +01:00
models DEV: Add stacked line chart mode (#28203) 2024-08-02 09:40:27 -07:00
routes DEV: Move config area site setting fetch into new controller (#28136) 2024-07-30 15:41:28 +10:00
services FIX: More header dropdown admin sidebar fixes (#27241) 2024-05-30 12:55:25 +10:00
templates UX: link edit text to search in badges form (#28248) 2024-08-06 16:01:20 +02:00