You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Runner -->|drives| Puppeteer -->|controls| Browser -->|loads| Site
32
+
config_startup --> DAP_Local
33
+
config_startup --> DAP_Staging
34
+
config_startup --> DAP_Prod
35
+
Site-.->|sends events to| GA4
36
+
Site -->|loads one of|config_startup
37
+
```
38
+
39
+
## Running the test site
40
+
The test site is a simple nginx server running in a Docker container. It serves static HTML pages that include the DAP code, allowing us to test the DAP code's behavior in a realistic environment.
41
+
42
+
To start up the test site, run one of the `test-site-*` commands:
43
+
44
+
```bash
45
+
npm run test-site-dev
46
+
```
47
+
This will start the test site at http://localhost:8080/, configured to use your local version of the DAP code by loading:
You can also choose to run the test site configured to load a deployed version of the DAP code, either staging or production, by running `npm run test-site-stg` or `npm run test-site-prd`, respectively.
54
+
55
+
## Configuring DAP in the test site
56
+
The DAP code is configurable at load time via query parameters. For instance, to enable DAP's YouTube tracking, a website
57
+
can load the DAP code with the `yt` query parameter set to `true`.
The full list of configurable options is available in the [DAP Code Capabilities Summary](https://github.com/digital-analytics-program/gov-wide-code/wiki/DAP-Code-Capabilities-Summary).
64
+
65
+
The test site is designed to pass through query parameters to the DAP code, allowing you to test different DAP configurations by changing the URL.
66
+
For instance, opening http://localhost:8080/youtube.html?yt=true&search=nasa will load the page for testing DAP's YouTube tracking with YouTube tracking enbabled.
67
+
Any query parameters that don't match one of DAP's configuration options will be treated as a normal query parameter (e.g. `search=nasa`).
9
68
10
-
Use the `DAP_ENV` environment variable to insert live versions of the code into
11
-
the test HTML page instead of the local version as described below.
69
+
This capability is used extensively in the automated tests to check the DAP code's behavior in various configurations.
12
70
13
71
## Running the tests
14
72
15
-
Start up the test site at http://localhost:8080/:
73
+
Start up the test site using any of the `test-site-*` commands:
16
74
17
75
```bash
18
76
npm run test-site-dev
@@ -38,24 +96,11 @@ npm run cucumber:report
38
96
39
97
Test report should be available in `output/test-results.html`.
40
98
41
-
##Configuring with environment variables
99
+
### Running the tests in verbose mode
42
100
43
-
### Verbose mode
44
-
45
-
Print debugging information to stdout while running the tests:
101
+
Verbose mode logs events that occur within the browser during test execution. If you find yourself wishing that you could
102
+
see watch what's happening in browser devtools during test execution, try verbose mode:
46
103
47
104
```bash
48
105
VERBOSE=true npm run cucumber
49
106
```
50
-
51
-
### Run tests against the live staging environment
52
-
53
-
```bash
54
-
DAP_ENV=staging npm run cucumber
55
-
```
56
-
57
-
### Run tests against the live production environment
0 commit comments