@@ -4,14 +4,21 @@ Feature: gas4() custom event API
44 Given I load an empty browser
55 And DAP is configured for agency "GSA"
66
7- Scenario : gas4() with a page_view event name sends a page_view event
7+ Scenario : gas4() sends a virtual page_view event
88 When I load the test site
99 And I execute script "window.gas4('page_view', {page_location: '/virtual/page', page_title: 'Virtual Page'})"
1010 Then a "page_view" event is sent to DAP with parameters
11- | page_location | http ://localhost /virtual /page |
12- | page_title | Virtual Page |
11+ | page_location | http ://dap - test - site . local /virtual /page |
12+ | page_title | Virtual Page |
1313
14- Scenario : gas4() with a valid GA4 event name sends the event
14+ Scenario : gas4() sends a virtual page_view event setting default page title
15+ When I load the test site
16+ And I execute script "window.gas4('page_view', {page_location: '/virtual/page'})"
17+ Then a "page_view" event is sent to DAP with parameters
18+ | page_location | http ://dap -test -site .local /virtual /page |
19+ | page_title | DAP test site |
20+
21+ Scenario : gas4() sends a file_download event
1522 When I load the test site
1623 And I execute script "window.gas4('file_download', {file_name: '/test.pdf', file_extension: 'pdf', link_text: 'Download Test PDF', link_id: 'download-link', link_url: 'https://example.gov/test.pdf', link_domain: 'example.gov', interaction_type: 'Mouse Click'})"
1724 Then a "file_download" event is sent to DAP with parameters
@@ -23,12 +30,6 @@ Feature: gas4() custom event API
2330 | link_domain | example .gov |
2431 | interaction_type | Mouse Click |
2532
26- Scenario : gas4() with an invalid event name falls back to dap_event
27- When I load the test site
28- And I execute script "window.gas4('not_a_valid_event', {some_param: 'value'})"
29- Then a "dap_event" event is sent to DAP with parameters
30- | some_param | value |
31-
3233 Scenario : gas4() sends a form_start event
3334 When I load the test site
3435 And I execute script "window.gas4('form_start', {form_id: 'contact-form', form_name: 'Contact Form', form_destination: '/thank-you', section: 'body'})"
@@ -47,13 +48,10 @@ Feature: gas4() custom event API
4748
4849 Scenario : gas4() sends a form_submit event
4950 When I load the test site
50- And I click on element with selector ".column:first-child input[type=submit] "
51+ And I execute script "window.gas4('form_submit', {form_step: 3, form_submit_text: 'Submit'}) "
5152 Then a "form_submit" event is sent to DAP with parameters
52- | form_name | <form_name > |
53- | form_id | <form_id > |
54- | form_destination | <form_destination > |
55- | section | <section > |
56- | form_submit_text | <form_submit_text > |
53+ | form_step | 3 |
54+ | form_submit_text | Submit |
5755
5856 Scenario : gas4() sends a content_view event
5957 When I load the test site
@@ -96,18 +94,6 @@ Feature: gas4() custom event API
9694 | outbound | <outbound > |
9795 | section | <section > |
9896
99- Scenario : gas4() falls back to dap_event when cta event name is invalid
100- When I load the test site
101- And I click on element with selector "button[onclick*=\" gas4('cta',\" ]"
102- Then a "dap_event" event is sent to DAP with parameters
103- | link_text | <link_text > |
104- | link_domain | <link_domain > |
105- | link_url | <link_url > |
106- | link_id | <link_id > |
107- | link_classes | <link_classes > |
108- | outbound | <outbound > |
109- | section | <section > |
110-
11197 Scenario : gas4() sends a navigation_click event
11298 When I load the test site
11399 And I click on element with selector "a[href='#home']"
@@ -162,3 +148,9 @@ Feature: gas4() custom event API
162148 Then a "sort" event is sent to DAP with parameters
163149 | sort_selection | newest |
164150 | section | results |
151+
152+ Scenario : gas4() with an invalid event name falls back to dap_event
153+ When I load the test site
154+ And I execute script "window.gas4('not_a_valid_event', {some_param: 'value'})"
155+ Then a "dap_event" event is sent to DAP with parameters
156+ | some_param | value |
0 commit comments