Skip to content

Commit ee556e0

Browse files
authored
add extra apply filters button to search page (#8320)
1 parent b47023e commit ee556e0

File tree

6 files changed

+37
-21
lines changed

6 files changed

+37
-21
lines changed

app/components/filters_component/filters_component.html.slim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@
2020
.filters-component__groups
2121
- groups.each do |group|
2222
= group
23+
24+
= submit_button

spec/system/jobseekers/jobseekers_can_search_for_jobs_spec.rb

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,6 @@
8282
let!(:expired_job) { create(:vacancy, :expired, job_roles: ["teacher"], job_title: "Maths Teacher", subjects: [], organisations: [school]) }
8383
let(:per_page) { 2 }
8484

85-
context "when searching using the mobile search fields" do
86-
before do
87-
stub_const("Pagy::DEFAULT", Pagy::DEFAULT.merge(items: per_page))
88-
visit jobs_path
89-
fill_in "Keyword", with: keyword
90-
click_on I18n.t("buttons.search")
91-
end
92-
93-
it_behaves_like "a successful search"
94-
end
95-
9685
context "when searching using the desktop search field" do
9786
before do
9887
stub_const("Pagy::DEFAULT", Pagy::DEFAULT.merge(items: per_page))
@@ -409,7 +398,10 @@
409398
visit jobs_path
410399
find('span[title="Teaching & leadership"]').click
411400
check "Teacher"
412-
click_on I18n.t("buttons.apply_filters")
401+
# Apply filters
402+
within ".filters-component" do
403+
first("button").click
404+
end
413405

414406
expect_page_to_show_jobs([job1, job2, job3, job4, maths_job1, maths_job2])
415407
expect_page_not_to_show_jobs([headteacher, deputy_head, senior_leader, teaching_assistant, sendco, it_support, pastoral, other])
@@ -418,7 +410,10 @@
418410
check "IT support"
419411
check "Head of year or phase"
420412
uncheck "Teacher"
421-
click_on I18n.t("buttons.apply_filters")
413+
# Apply filters
414+
within ".filters-component" do
415+
first("button").click
416+
end
422417

423418
expect_page_to_show_jobs([senior_leader, it_support])
424419
expect_page_not_to_show_jobs([job1, job2, job3, job4, maths_job1, maths_job2, headteacher, deputy_head, teaching_assistant, sendco, pastoral, other])

spec/system/jobseekers/jobseekers_can_search_for_schools_spec.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@
6969
it "allows filtering by schools with vacancies" do
7070
expect(page).to have_link no_vacancies.name
7171
check I18n.t("organisations.filters.job_availability.options.true")
72-
click_on I18n.t("buttons.apply_filters")
72+
73+
# Apply filters
74+
within ".govuk-grid-column-one-third-at-desktop" do
75+
first("button").click
76+
end
7377
expect(page).not_to have_link no_vacancies.name
7478
end
7579
end

spec/system/publishers/publishers_can_filter_vacancies_in_their_dashboard_spec.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@
4242

4343
scenario "it shows filtered published vacancies" do
4444
check "Happy Rainbows School (1)"
45-
click_on I18n.t("buttons.apply_filters")
45+
# Apply filters
46+
within ".filters-component" do
47+
first("button").click
48+
end
4649

4750
expect(page).to have_css(".filters-component__remove-tags__tag", count: 1)
4851

spec/system/publishers/publishers_can_search_for_jobseeker_profiles_spec.rb

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@
9595
check I18n.t("publishers.jobseeker_profiles.filters.working_pattern_options.part_time")
9696
end
9797

98+
# Apply filters
9899
within ".filters-component" do
99-
click_on I18n.t("buttons.apply_filters")
100+
first("button").click
100101
end
101102

102103
expect(page).to have_link(href: publishers_jobseeker_profile_path(part_time_jobseeker_profile))
@@ -111,8 +112,9 @@
111112
check I18n.t("publishers.jobseeker_profiles.filters.right_to_work_in_uk_options.true")
112113
end
113114

115+
# Apply filters
114116
within ".filters-component" do
115-
click_on I18n.t("buttons.apply_filters")
117+
first("button").click
116118
end
117119

118120
expect(page).to_not have_link(href: publishers_jobseeker_profile_path(part_time_jobseeker_profile))
@@ -159,7 +161,8 @@
159161
find('span[title="Support"]').click
160162
check "Catering, cleaning and site management"
161163
check "HLTA (higher level teaching assistant)"
162-
click_on I18n.t("buttons.apply_filters")
164+
# Apply filters
165+
first("button").click
163166
end
164167

165168
expect(page).not_to have_link(href: publishers_jobseeker_profile_path(part_time_jobseeker_profile))
@@ -175,7 +178,8 @@
175178
within ".filters-component" do
176179
find('span[title="Teaching & leadership"]').click
177180
check "Teacher"
178-
click_on I18n.t("buttons.apply_filters")
181+
# Apply filters
182+
first("button").click
179183
end
180184

181185
expect(page).to have_link(href: publishers_jobseeker_profile_path(part_time_jobseeker_profile))
@@ -214,7 +218,10 @@
214218
context "when 1 location is selected in the filters" do
215219
it "shows text explaining that the candidates are willing travel to the selected location" do
216220
check "Oxford"
217-
click_button "Apply filters"
221+
# Apply filters
222+
within ".filters-component" do
223+
first("button").click
224+
end
218225
expect(page).to have_selector("p", text: "These candidates are willing to travel to your selected school location.")
219226
end
220227
end
@@ -223,7 +230,10 @@
223230
it "shows text explaining that the candidates are willing travel to at least one of the selected locations" do
224231
check "Oxford"
225232
check "Cambridge"
226-
click_button "Apply filters"
233+
# Apply filters
234+
within ".filters-component" do
235+
first("button").click
236+
end
227237
expect(page).to have_selector("p", text: "These candidates are willing to travel to at least one of your selected school locations.")
228238
end
229239
end

spec/system/publishers/publishers_can_view_candidate_messages_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
context "when on the inbox tab" do
2727
before do
2828
visit publishers_candidate_messages_path
29+
# wait for page load
30+
find("nav.tabs-component")
2931
end
3032

3133
it "passes accessibility checks", :a11y do

0 commit comments

Comments
 (0)