Skip to content

Commit cba15ae

Browse files
committed
Tweak testing of DfeAnalytics
1 parent 00b05ec commit cba15ae

4 files changed

Lines changed: 11 additions & 12 deletions

File tree

config/initializers/dfe_analytics.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
DfE::Analytics.configure do |config|
22
# only enable analytics in review apps/qa/prod or tests where :dfe_analytics tag is present
3-
config.enable_analytics = proc { !Rails.env.local? || ENV["ENABLE_DFE_ANALYTICS"] == "true" }
3+
config.enable_analytics = -> { !Rails.env.local? || ENV["ENABLE_DFE_ANALYTICS"] == "true" }
44
# Whether to log events instead of sending them to BigQuery.
5-
#
6-
config.log_only = false
5+
6+
config.log_only = -> { Rails.env.local? && ENV["ENABLE_DFE_ANALYTICS"] != "true" }
77

88
config.excluded_paths = ["/check"]
99

1010
# Whether to use ActiveJob or dispatch events immediately.
11-
#
11+
# we have tests that assert 'has been enqueued' so changing this is test/dev is problematic
1212
config.async = true
1313

1414
# Which ActiveJob queue to put events on
@@ -32,7 +32,7 @@
3232
#
3333
config.bigquery_api_json_key = ENV.fetch("BIG_QUERY_API_JSON_KEY", nil)
3434

35-
# Period while DFE Analytics will be set in maintenance mode and the events won'tbe sent to BigQuery.
35+
# Period while DFE Analytics will be set in maintenance mode and the events won't be sent to BigQuery.
3636
# Any event generated during this period will be re-enqueued to be sent later.
3737
#
3838
config.bigquery_maintenance_window = "01-08-2024 18:00..01-08-2024 18:30"

spec/system/publishers/publishers_can_message_multiple_job_candidates_spec.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
end
8585

8686
scenario "updating template", :js do
87+
expect(page).to have_content "Edit template"
8788
click_on "Edit template"
8889
fill_in_trix_editor "message_template_content", with: " "
8990
click_on "Save template"
@@ -96,7 +97,9 @@
9697
end
9798

9899
scenario "creating a new template", :js do
100+
expect(page).to have_content "Create new template"
99101
click_on "Create new template"
102+
expect(page).to have_content "Save template"
100103
click_on "Save template"
101104
expect(page).to have_content "Enter a template name"
102105

spec/system/publishers/publishers_can_preview_a_vacancy_spec.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@
1212
context "when reviewing a draft vacancy" do
1313
before do
1414
visit organisation_job_preview_path(vacancy.id)
15-
# wait for page load
16-
find("span.govuk-caption-l")
17-
find("footer")
1815
end
1916

2017
it "passes a11y", :a11y do
18+
# wait for page load
19+
expect(page).to have_content(vacancy.job_title)
2120
expect(page).to be_axe_clean
2221
end
2322

spec/system/publishers/publishers_can_send_messages_to_applicants_spec.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,15 +201,12 @@
201201
login_publisher(publisher: publisher, organisation: organisation)
202202

203203
visit messages_organisation_job_job_application_path(vacancy.id, job_application.id)
204-
205-
find(".tabs-component")
206-
find_by_id("messages-list")
207-
find("footer")
208204
end
209205

210206
after { logout }
211207

212208
it "passes accessibility checks", :a11y do
209+
# wait for page load
213210
expect(page).to have_text("Hello from publisher")
214211
expect(page).to be_axe_clean
215212
end

0 commit comments

Comments
 (0)