|
1 | | -import { Then } from "@cucumber/cucumber"; |
| 1 | +import {Given, Then} from "@cucumber/cucumber"; |
2 | 2 | import * as chai from 'chai' |
3 | 3 | const expect = chai.expect; |
4 | 4 |
|
5 | | -Then("DAP is configured with default parameters", async function () { |
6 | | - const config = await this.page.evaluate(() => { |
| 5 | +Given("DAP will set custom dimensions", async function (table) { |
| 6 | + const configCommand = await this.page.evaluate(() => { |
7 | 7 | return window.dataLayer.find(item => item[0] === 'config'); |
8 | 8 | }); |
9 | | - expect(config).to.deep.equal( |
10 | | - { |
11 | | - "0": "config", |
12 | | - "1": "G-9TNNMGP8WJ", |
13 | | - "2": { |
14 | | - "cookie_expires": "63072000", |
15 | | - "page_location": "http://localhost:8080/", |
16 | | - "page_title": "DAP test site", |
17 | | - "agency": "HHS", |
18 | | - "site_platform": "unspecified:localhost", |
19 | | - "site_topic": "unspecified:localhost", |
20 | | - "subagency": "LOCALHOST", |
21 | | - "script_source": "http://localhost:8080/universal-federated-analytics-min.js", |
22 | | - "version": "20240712 v8.2 - ga4", |
23 | | - "protocol": "http:", |
24 | | - "using_parallel_tracker": "no" |
25 | | - } |
26 | | - } |
27 | | - ); |
28 | | -}); |
29 | | - |
30 | | -Then("DAP is configured with custom parameters", async function () { |
31 | | - const config = await this.page.evaluate(() => { |
32 | | - return window.dataLayer.find(item => item[0] === 'config'); |
33 | | - }); |
34 | | - expect(config).to.deep.equal( |
35 | | - { |
36 | | - "0": "config", |
37 | | - "1": "G-9TNNMGP8WJ", |
38 | | - "2": { |
39 | | - "cookie_expires": "15768000", |
40 | | - "page_location": "http://localhost:8080/", |
41 | | - "page_title": "DAP test site", |
42 | | - "agency": "GSA", |
43 | | - "site_platform": "standard-site", |
44 | | - "site_topic": "comp,educ,soc|sm|2023-12-04+(ai+education+and+ai+in+education)", |
45 | | - "subagency": "TTS", |
46 | | - "script_source": "http://localhost:8080/universal-federated-analytics-min.js", |
47 | | - "version": "20240712 v8.2 - ga4", |
48 | | - "protocol": "http:", |
49 | | - "using_parallel_tracker": "no" |
50 | | - } |
51 | | - } |
52 | | - ); |
| 9 | + expect(configCommand["0"]).to.equal("config"); |
| 10 | + expect(configCommand["1"]).to.equal("G-9TNNMGP8WJ"); |
| 11 | + expect(configCommand["2"]).to.include(table.rowsHash()); |
53 | 12 | }); |
54 | 13 |
|
55 | 14 | Then("the file download is reported to DAP with interaction type {string}", async function (interactionType) { |
|
0 commit comments