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

Lint: Use `have_css` in place of `have_selector`

Aaron Contrerasbbecc931c0c8
diff --git a/spec/support/pages/work_packages/abstract_work_package.rb b/spec/support/pages/work_packages/abstract_work_package.rb
index 393d299cb3e..76f2a8734b6 100644
--- a/spec/support/pages/work_packages/abstract_work_package.rb
+++ b/spec/support/pages/work_packages/abstract_work_package.rb
@@ -46,7 +46,7 @@ module Pages
end
def expect_tab(tab)
- expect(page).to have_selector('.op-tab-row--link_selected', text: tab.to_s.upcase)
+ expect(page).to have_css('.op-tab-row--link_selected', text: tab.to_s.upcase)
end
def edit_field(attribute)
@@ -93,7 +93,7 @@ module Pages
def ensure_page_loaded
expect_angular_frontend_initialized
- expect(page).to have_selector('.op-user-activity--user-name',
+ expect(page).to have_css('.op-user-activity--user-name',
text: work_package.journals.last.user.name,
minimum: 1,
wait: 10)
@@ -106,21 +106,21 @@ module Pages
end
def expect_group(name, &)
- expect(page).to have_selector('.attributes-group--header-text', text: name.upcase)
+ expect(page).to have_css('.attributes-group--header-text', text: name.upcase)
if block_given?
page.within(".attributes-group[data-group-name='#{name}']", &)
end
end
def expect_no_group(name)
- expect(page).not_to have_selector('.attributes-group--header-text', text: name.upcase)
+ expect(page).not_to have_css('.attributes-group--header-text', text: name.upcase)
end
def expect_attributes(attribute_expectations)
attribute_expectations.each do |label_name, value|
label = label_name.to_s
if label == 'status'
- expect(page).to have_selector("[data-test-selector='op-wp-status-button'] .button", text: value)
+ expect(page).to have_css("[data-test-selector='op-wp-status-button'] .button", text: value)
else
expect(page).to have_selector(".inline-edit--container.#{label.camelize(:lower)}", text: value)
end
@@ -140,41 +140,41 @@ module Pages
end
def expect_activity_message(message)
- expect(page).to have_selector('.work-package-details-activities-messages .message',
+ expect(page).to have_css('.work-package-details-activities-messages .message',
text: message)
end
def expect_no_parent
visit_tab!('relations')
- expect(page).not_to have_selector('[data-test-selector="op-wp-breadcrumb-parent"]')
+ expect(page).not_to have_css('[data-test-selector="op-wp-breadcrumb-parent"]')
end
def expect_zen_mode
- expect(page).to have_selector('.zen-mode')
- expect(page).to have_selector('#main-menu', visible: false)
- expect(page).to have_selector('.op-app-header', visible: false)
+ expect(page).to have_css('.zen-mode')
+ expect(page).to have_css('#main-menu', visible: false)
+ expect(page).to have_css('.op-app-header', visible: false)
end
def expect_no_zen_mode
- expect(page).not_to have_selector('.zen-mode')
- expect(page).to have_selector('#main-menu', visible: true)
- expect(page).to have_selector('.op-app-header', visible: true)
+ expect(page).not_to have_css('.zen-mode')
+ expect(page).to have_css('#main-menu', visible: true)
+ expect(page).to have_css('.op-app-header', visible: true)
end
def expect_custom_action(name)
expect(page)
- .to have_selector('.custom-action', text: name)
+ .to have_css('.custom-action', text: name)
end
def expect_custom_action_disabled(name)
expect(page)
- .to have_selector('.custom-action [disabled]', text: name)
+ .to have_css('.custom-action [disabled]', text: name)
end
def expect_no_custom_action(name)
expect(page)
- .not_to have_selector('.custom-action', text: name)
+ .not_to have_css('.custom-action', text: name)
end
def expect_custom_action_order(*names)
@@ -294,7 +294,7 @@ module Pages
end
def subject_field
- expect(page).to have_selector('.inline-edit--container.subject input', wait: 10)
+ expect(page).to have_css('.inline-edit--container.subject input', wait: 10)
find('.inline-edit--container.subject input')
end