Skip to content

Commit

Permalink
Updated the GA4 tracking test for bank holidays page
Browse files Browse the repository at this point in the history
The `.app-c-subscribe` CSS class is no longer present following the removal of the subscribe app component.

The test has been updated to get all links than end with the `.ics` file extension and check they have the correct data attributes set.
  • Loading branch information
MartinJJones committed Dec 18, 2024
1 parent 323bf66 commit 1292a29
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions spec/system/bank_holidays_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -273,16 +273,11 @@
context "GA4 tracking" do
it "has GA4 tracking on the .ics file links" do
visit "/bank-holidays"
link_parents = page.all(".app-c-subscribe")
link_parents.each do |link_parent|
within(link_parent) do
expect(link_parent).to have_selector("a[data-module='ga4-link-tracker']")
ics_file_links = page.all("a[href$='.ics']")

ga4_link = link_parent.find("a[data-ga4-link]")["data-ga4-link"]
ga4_expected_object = "{\"event_name\":\"file_download\",\"type\":\"generic download\"}"

expect(ga4_expected_object).to eq(ga4_link)
end
ics_file_links.each do |ics_file_link|
expect(ics_file_link["data-module"]).to eq("ga4-link-tracker")
expect(ics_file_link["data-ga4-link"]).to eq('{"event_name":"file_download","type":"generic download"}')
end
end
end
Expand Down

0 comments on commit 1292a29

Please sign in to comment.