Skip to content

Commit 05099a4

Browse files
committed
I'm so lost
1 parent 72a7f5f commit 05099a4

File tree

4 files changed

+56
-25
lines changed

4 files changed

+56
-25
lines changed

site/e2e/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const gitAuth = {
3434
installationsPath: "/installations",
3535
};
3636

37-
export const requirePremiumTests = Boolean(
37+
export const premiumTestsRequired = Boolean(
3838
process.env.CODER_E2E_REQUIRE_PREMIUM_TESTS,
3939
);
4040
export const license = process.env.CODER_E2E_LICENSE ?? "";

site/e2e/global.setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ test("setup deployment", async ({ page }) => {
2828
await page.getByTestId("button-select-template").isVisible();
2929

3030
// Setup license
31-
if (constants.requirePremiumTests || constants.license) {
31+
if (constants.premiumTestsRequired || constants.license) {
3232
// Make sure that we have something that looks like a real license
3333
expect(constants.license).toBeTruthy();
3434
expect(constants.license.length).toBeGreaterThan(92); // the signature alone should be this long

site/e2e/helpers.ts

Lines changed: 53 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
coderPort,
1919
license,
2020
prometheusPort,
21-
requirePremiumTests,
21+
premiumTestsRequired,
2222
requireTerraformTests,
2323
} from "./constants";
2424
import { expectUrl } from "./expectUrl";
@@ -35,22 +35,37 @@ import {
3535
type RichParameter,
3636
} from "./provisionerGenerated";
3737

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+
*/
3941
export function requiresLicense() {
40-
if (requirePremiumTests) {
42+
if (premiumTestsRequired) {
4143
return;
4244
}
4345

4446
test.skip(!license);
4547
}
4648

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+
*/
4861
export function requireTerraformProvisioner() {
4962
test.skip(!requireTerraformTests);
5063
}
5164

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+
*/
5469
export const createWorkspace = async (
5570
page: Page,
5671
templateName: string,
@@ -90,7 +105,7 @@ export const createWorkspace = async (
90105

91106
await expectUrl(page).toHavePathName(`/@admin/${name}`);
92107

93-
await page.waitForSelector("*[data-testid='build-status'] >> text=Running", {
108+
await page.waitForSelector("[data-testid='build-status'] >> text=Running", {
94109
state: "visible",
95110
});
96111
return name;
@@ -151,8 +166,10 @@ export const verifyParameters = async (
151166
}
152167
};
153168

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+
*/
156173
export enum StarterTemplates {
157174
STARTER_DOCKER = "docker",
158175
}
@@ -166,8 +183,10 @@ function isStarterTemplate(
166183
return typeof input === "string";
167184
}
168185

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+
*/
171190
export const createTemplate = async (
172191
page: Page,
173192
responses?: EchoProvisionerResponses | StarterTemplates,
@@ -200,8 +219,10 @@ export const createTemplate = async (
200219
return name;
201220
};
202221

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+
*/
205226
export const createGroup = async (page: Page): Promise<string> => {
206227
await page.goto("/groups/create", { waitUntil: "domcontentloaded" });
207228
await expectUrl(page).toHavePathName("/groups/create");
@@ -215,7 +236,9 @@ export const createGroup = async (page: Page): Promise<string> => {
215236
return name;
216237
};
217238

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+
*/
219242
export const sshIntoWorkspace = async (
220243
page: Page,
221244
workspace: string,
@@ -298,17 +321,21 @@ export const buildWorkspaceWithParameters = async (
298321
});
299322
};
300323

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+
*/
303328
export const startAgent = async (
304329
page: Page,
305330
token: string,
306331
): Promise<ChildProcess> => {
307332
return startAgentWithCommand(page, token, "go", "run", coderMain);
308333
};
309334

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+
*/
312339
export const downloadCoderVersion = async (
313340
version: string,
314341
): Promise<string> => {
@@ -448,8 +475,10 @@ interface EchoProvisionerResponses {
448475
apply?: RecursivePartial<Response>[];
449476
}
450477

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+
*/
453482
const createTemplateVersionTar = async (
454483
responses?: EchoProvisionerResponses,
455484
): Promise<Buffer> => {
@@ -619,8 +648,10 @@ export const randomName = () => {
619648
return randomUUID().slice(0, 8);
620649
};
621650

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+
*/
624655
export class Awaiter {
625656
private promise: Promise<void>;
626657
private callback?: () => void;

site/e2e/reporter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class CoderReporter implements Reporter {
110110
console.info(`==> Tests ${result.status}`);
111111
if (!license) {
112112
console.info(
113-
"==> Premium tests were skipped, because no license was provided",
113+
"==> Tests that require a license were skipped, because no license was provided",
114114
);
115115
}
116116
console.info(`${this.passedCount} passed`);

0 commit comments

Comments
 (0)