Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fix project index specs with new switch selectors

Oliver Günther8fc254b7d5c9
diff --git a/frontend/src/app/spot/components/switch/switch.component.html b/frontend/src/app/spot/components/switch/switch.component.html
index 6f6b0128da3..637a1c81a4f 100644
--- a/frontend/src/app/spot/components/switch/switch.component.html
+++ b/frontend/src/app/spot/components/switch/switch.component.html
@@ -8,4 +8,8 @@
(ngModelChange)="onToggle($event)"
#input
/>
-<span class="spot-switch--fake"></span>
+<span
+ class="spot-switch--fake"
+ data-qa-selector="spot-switch-handle"
+ [attr.data-qa-active]="checked || undefined"
+></span>
diff --git a/spec/support/pages/projects/index.rb b/spec/support/pages/projects/index.rb
index 492449e319c..210db8b1527 100644
--- a/spec/support/pages/projects/index.rb
+++ b/spec/support/pages/projects/index.rb
@@ -83,16 +83,16 @@ module Pages
def set_toggle_filter(values)
should_active = values.first == 'yes'
- is_active = page.has_selector? '.slide-toggle.-active'
+ is_active = page.has_selector? '[data-qa-selector="spot-switch-handle"][data-qa-active]'
if should_active != is_active
- page.find('.slide-toggle .slider').click
+ page.find('[data-qa-selector="spot-switch-handle"]').click
end
if should_active
- expect(page).to have_selector('.slide-toggle.-active')
+ expect(page).to have_selector('[data-qa-selector="spot-switch-handle"][data-qa-active]')
else
- expect(page).to have_selector('.slide-toggle:not(.-active)')
+ expect(page).to have_selector('[data-qa-selector="spot-switch-handle"]:not([data-qa-active])')
end
end