@@ -18,7 +18,7 @@ import {
18
18
coderPort ,
19
19
license ,
20
20
prometheusPort ,
21
- requirePremiumTests ,
21
+ premiumTestsRequired ,
22
22
requireTerraformTests ,
23
23
} from "./constants" ;
24
24
import { expectUrl } from "./expectUrl" ;
@@ -35,22 +35,37 @@ import {
35
35
type RichParameter ,
36
36
} from "./provisionerGenerated" ;
37
37
38
- // requiresLicense will skip the test if we're not running with a license added
38
+ /**
39
+ * requiresLicense will skip the test if we're not running with a license added
40
+ */
39
41
export function requiresLicense ( ) {
40
- if ( requirePremiumTests ) {
42
+ if ( premiumTestsRequired ) {
41
43
return ;
42
44
}
43
45
44
46
test . skip ( ! license ) ;
45
47
}
46
48
47
- // requireTerraformProvisioner by default is enabled.
49
+ /**
50
+ * This function is used to mark a few e2e tests that seem to always fail when
51
+ * running with a license. If we can ever get all of them fixed we should remove
52
+ * this.
53
+ */
54
+ export function failsWithLicense ( ) {
55
+ test . skip ( Boolean ( license ) ) ;
56
+ }
57
+
58
+ /**
59
+ * requireTerraformProvisioner by default is enabled.
60
+ */
48
61
export function requireTerraformProvisioner ( ) {
49
62
test . skip ( ! requireTerraformTests ) ;
50
63
}
51
64
52
- // createWorkspace creates a workspace for a template.
53
- // It does not wait for it to be running, but it does navigate to the page.
65
+ /**
66
+ * createWorkspace creates a workspace for a template. It does not wait for it
67
+ * to be running, but it does navigate to the page.
68
+ */
54
69
export const createWorkspace = async (
55
70
page : Page ,
56
71
templateName : string ,
@@ -90,7 +105,7 @@ export const createWorkspace = async (
90
105
91
106
await expectUrl ( page ) . toHavePathName ( `/@admin/${ name } ` ) ;
92
107
93
- await page . waitForSelector ( "* [data-testid='build-status'] >> text=Running" , {
108
+ await page . waitForSelector ( "[data-testid='build-status'] >> text=Running" , {
94
109
state : "visible" ,
95
110
} ) ;
96
111
return name ;
@@ -151,8 +166,10 @@ export const verifyParameters = async (
151
166
}
152
167
} ;
153
168
154
- // StarterTemplates are ids of starter templates that can be used in place of
155
- // the responses payload. These starter templates will require real provisioners.
169
+ /**
170
+ * StarterTemplates are ids of starter templates that can be used in place of
171
+ * the responses payload. These starter templates will require real provisioners.
172
+ */
156
173
export enum StarterTemplates {
157
174
STARTER_DOCKER = "docker" ,
158
175
}
@@ -166,8 +183,10 @@ function isStarterTemplate(
166
183
return typeof input === "string" ;
167
184
}
168
185
169
- // createTemplate navigates to the /templates/new page and uploads a template
170
- // with the resources provided in the responses argument.
186
+ /**
187
+ * createTemplate navigates to the /templates/new page and uploads a template
188
+ * with the resources provided in the responses argument.
189
+ */
171
190
export const createTemplate = async (
172
191
page : Page ,
173
192
responses ?: EchoProvisionerResponses | StarterTemplates ,
@@ -200,8 +219,10 @@ export const createTemplate = async (
200
219
return name ;
201
220
} ;
202
221
203
- // createGroup navigates to the /groups/create page and creates a group with a
204
- // random name.
222
+ /**
223
+ * createGroup navigates to the /groups/create page and creates a group with a
224
+ * random name.
225
+ */
205
226
export const createGroup = async ( page : Page ) : Promise < string > => {
206
227
await page . goto ( "/groups/create" , { waitUntil : "domcontentloaded" } ) ;
207
228
await expectUrl ( page ) . toHavePathName ( "/groups/create" ) ;
@@ -215,7 +236,9 @@ export const createGroup = async (page: Page): Promise<string> => {
215
236
return name ;
216
237
} ;
217
238
218
- // sshIntoWorkspace spawns a Coder SSH process and a client connected to it.
239
+ /**
240
+ * sshIntoWorkspace spawns a Coder SSH process and a client connected to it.
241
+ */
219
242
export const sshIntoWorkspace = async (
220
243
page : Page ,
221
244
workspace : string ,
@@ -298,17 +321,21 @@ export const buildWorkspaceWithParameters = async (
298
321
} ) ;
299
322
} ;
300
323
301
- // startAgent runs the coder agent with the provided token.
302
- // It awaits the agent to be ready before returning.
324
+ /**
325
+ * startAgent runs the coder agent with the provided token. It waits for the
326
+ * agent to be ready before returning.
327
+ */
303
328
export const startAgent = async (
304
329
page : Page ,
305
330
token : string ,
306
331
) : Promise < ChildProcess > => {
307
332
return startAgentWithCommand ( page , token , "go" , "run" , coderMain ) ;
308
333
} ;
309
334
310
- // downloadCoderVersion downloads the version provided into a temporary dir and
311
- // caches it so subsequent calls are fast.
335
+ /**
336
+ * downloadCoderVersion downloads the version provided into a temporary dir and
337
+ * caches it so subsequent calls are fast.
338
+ */
312
339
export const downloadCoderVersion = async (
313
340
version : string ,
314
341
) : Promise < string > => {
@@ -448,8 +475,10 @@ interface EchoProvisionerResponses {
448
475
apply ?: RecursivePartial < Response > [ ] ;
449
476
}
450
477
451
- // createTemplateVersionTar consumes a series of echo provisioner protobufs and
452
- // converts it into an uploadable tar file.
478
+ /**
479
+ * createTemplateVersionTar consumes a series of echo provisioner protobufs and
480
+ * converts it into an uploadable tar file.
481
+ */
453
482
const createTemplateVersionTar = async (
454
483
responses ?: EchoProvisionerResponses ,
455
484
) : Promise < Buffer > => {
@@ -619,8 +648,10 @@ export const randomName = () => {
619
648
return randomUUID ( ) . slice ( 0 , 8 ) ;
620
649
} ;
621
650
622
- // Awaiter is a helper that allows you to wait for a callback to be called.
623
- // It is useful for waiting for events to occur.
651
+ /**
652
+ * Awaiter is a helper that allows you to wait for a callback to be called. It
653
+ * is useful for waiting for events to occur.
654
+ */
624
655
export class Awaiter {
625
656
private promise : Promise < void > ;
626
657
private callback ?: ( ) => void ;
0 commit comments