1
1
'use strict'
2
2
3
- const { exec } = require ( 'child_process' )
3
+ const { exec, execSync } = require ( 'child_process' )
4
4
5
5
const { assert } = require ( 'chai' )
6
6
const getPort = require ( 'get-port' )
@@ -23,9 +23,14 @@ describe('test visibility automatic log submission', () => {
23
23
'@cucumber/cucumber' ,
24
24
'jest' ,
25
25
'winston' ,
26
- 'chai@4'
26
+ 'chai@4' ,
27
+ '@playwright/test'
27
28
] , true )
28
29
cwd = sandbox . folder
30
+ const { NODE_OPTIONS , ...restOfEnv } = process . env
31
+ // Install chromium (configured in integration-tests/playwright.config.js)
32
+ // *Be advised*: this means that we'll only be using chromium for this test suite
33
+ execSync ( 'npx playwright install chromium' , { cwd, env : restOfEnv , stdio : 'inherit' } )
29
34
webAppPort = await getPort ( )
30
35
webAppServer . listen ( webAppPort )
31
36
} )
@@ -58,10 +63,18 @@ describe('test visibility automatic log submission', () => {
58
63
{
59
64
name : 'cucumber' ,
60
65
command : './node_modules/.bin/cucumber-js ci-visibility/automatic-log-submission-cucumber/*.feature'
66
+ } ,
67
+ {
68
+ name : 'playwright' ,
69
+ command : './node_modules/.bin/playwright test -c playwright.config.js' ,
70
+ getExtraEnvVars : ( ) => ( {
71
+ PW_BASE_URL : `http://localhost:${ webAppPort } ` ,
72
+ TEST_DIR : 'ci-visibility/automatic-log-submission-playwright'
73
+ } )
61
74
}
62
75
]
63
76
64
- testFrameworks . forEach ( ( { name, command } ) => {
77
+ testFrameworks . forEach ( ( { name, command, getExtraEnvVars = ( ) => ( { } ) } ) => {
65
78
context ( `with ${ name } ` , ( ) => {
66
79
it ( 'can automatically submit logs' , ( done ) => {
67
80
let logIds , testIds
@@ -113,11 +126,13 @@ describe('test visibility automatic log submission', () => {
113
126
DD_AGENTLESS_LOG_SUBMISSION_ENABLED : '1' ,
114
127
DD_AGENTLESS_LOG_SUBMISSION_URL : `http://localhost:${ receiver . port } ` ,
115
128
DD_API_KEY : '1' ,
116
- DD_SERVICE : 'my-service'
129
+ DD_SERVICE : 'my-service' ,
130
+ ...getExtraEnvVars ( )
117
131
} ,
118
132
stdio : 'pipe'
119
133
}
120
134
)
135
+
121
136
childProcess . on ( 'exit' , ( ) => {
122
137
Promise . all ( [ logsPromise , eventsPromise ] ) . then ( ( ) => {
123
138
const { logSpanId, logTraceId } = logIds
@@ -151,7 +166,8 @@ describe('test visibility automatic log submission', () => {
151
166
env : {
152
167
...getCiVisAgentlessConfig ( receiver . port ) ,
153
168
DD_AGENTLESS_LOG_SUBMISSION_URL : `http://localhost:${ receiver . port } ` ,
154
- DD_SERVICE : 'my-service'
169
+ DD_SERVICE : 'my-service' ,
170
+ ...getExtraEnvVars ( )
155
171
} ,
156
172
stdio : 'pipe'
157
173
}
@@ -181,7 +197,8 @@ describe('test visibility automatic log submission', () => {
181
197
DD_SERVICE : 'my-service' ,
182
198
DD_TRACE_DEBUG : '1' ,
183
199
DD_TRACE_LOG_LEVEL : 'warn' ,
184
- DD_API_KEY : ''
200
+ DD_API_KEY : '' ,
201
+ ...getExtraEnvVars ( )
185
202
} ,
186
203
stdio : 'pipe'
187
204
}
0 commit comments