Commit dfbf56cc authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch '263233-follow-up-from-add-a-clear-button-on-the-search-filter' into 'master'

Update the tests to use a testid instead of a class

See merge request gitlab-org/gitlab!46334
parents 7611ca15 37854191
......@@ -17,10 +17,10 @@
= dropdown_content
= dropdown_loading
.dropdown.project-filter.form-group.mb-lg-0.mx-lg-1
.dropdown.form-group.mb-lg-0.mx-lg-1{ data: { testid: "project-filter" } }
%label.d-block{ for: "dashboard_search_project" }
= _("Project")
%button.dropdown-menu-toggle.gl-display-inline-flex.js-search-project-dropdown.gl-mt-0{ type: "button", id: "dashboard_search_project", data: { toggle: "dropdown", target: '.project-filter' } }
%button.dropdown-menu-toggle.gl-display-inline-flex.js-search-project-dropdown.gl-mt-0{ type: "button", id: "dashboard_search_project", data: { toggle: "dropdown" } }
%span.dropdown-toggle-text.gl-flex-grow-1.str-truncated-100
= @project&.full_name || _("Any")
- if @project.present?
......
......@@ -28,10 +28,7 @@ RSpec.describe 'User searches for code' do
before do
visit(search_path)
find('.js-search-project-dropdown').click
page.within('.project-filter') do
click_link(project.full_name)
end
find('[data-testid="project-filter"]').click_link(project.full_name)
end
include_examples 'top right search form'
......
......@@ -86,10 +86,7 @@ RSpec.describe 'User searches for issues', :js do
context 'when on a project page' do
it 'finds an issue' do
find('.js-search-project-dropdown').click
page.within('.project-filter') do
click_link(project.full_name)
end
find('[data-testid="project-filter"]').click_link(project.full_name)
search_for_issue(issue1.title)
......
......@@ -31,10 +31,7 @@ RSpec.describe 'User searches for merge requests', :js do
context 'when on a project page' do
it 'finds a merge request' do
find('.js-search-project-dropdown').click
page.within('.project-filter') do
click_link(project.full_name)
end
find('[data-testid="project-filter"]').click_link(project.full_name)
fill_in('dashboard_search', with: merge_request1.title)
find('.btn-search').click
......
......@@ -31,10 +31,7 @@ RSpec.describe 'User searches for milestones', :js do
context 'when on a project page' do
it 'finds a milestone' do
find('.js-search-project-dropdown').click
page.within('.project-filter') do
click_link(project.full_name)
end
find('[data-testid="project-filter"]').click_link(project.full_name)
fill_in('dashboard_search', with: milestone1.title)
find('.btn-search').click
......
......@@ -19,10 +19,7 @@ RSpec.describe 'User searches for wiki pages', :js do
shared_examples 'search wiki blobs' do
it 'finds a page' do
find('.js-search-project-dropdown').click
page.within('.project-filter') do
click_link(project.full_name)
end
find('[data-testid="project-filter"]').click_link(project.full_name)
fill_in('dashboard_search', with: search_term)
find('.btn-search').click
......
......@@ -28,7 +28,7 @@ RSpec.describe 'User uses search filters', :js do
expect(find('.js-search-group-dropdown')).to have_content(group.name)
page.within('.project-filter') do
page.within('[data-testid="project-filter"]') do
find('.js-search-project-dropdown').click
wait_for_requests
......@@ -57,7 +57,7 @@ RSpec.describe 'User uses search filters', :js do
it 'shows a project' do
visit search_path
page.within('.project-filter') do
page.within('[data-testid="project-filter"]') do
find('.js-search-project-dropdown').click
wait_for_requests
......@@ -77,7 +77,7 @@ RSpec.describe 'User uses search filters', :js do
describe 'clear filter button' do
it 'removes Project filters' do
link = find('.project-filter .js-search-clear')
link = find('[data-testid="project-filter"] .js-search-clear')
params = CGI.parse(URI.parse(link[:href]).query)
expect(params).not_to include(:project_id)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment