From b1807bf73635217f1bc7207f5efd9150aa609deb Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 18 Dec 2024 17:03:55 +0000 Subject: [PATCH] Updated the GA4 tracking test for bank holidays page 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. --- spec/system/bank_holidays_spec.rb | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/spec/system/bank_holidays_spec.rb b/spec/system/bank_holidays_spec.rb index 25026cf7bd..17a9908314 100644 --- a/spec/system/bank_holidays_spec.rb +++ b/spec/system/bank_holidays_spec.rb @@ -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