Skip to content

Commit a5b7635

Browse files
committed
🧹
1 parent 56390e1 commit a5b7635

File tree

6 files changed

+25
-24
lines changed

6 files changed

+25
-24
lines changed

site/e2e/constants.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import * as path from "path";
2+
3+
export const coderMain = path.join(__dirname, "../../enterprise/cmd/coder");
4+
15
// Default port from the server
26
export const coderPort = process.env.CODER_E2E_PORT
37
? Number(process.env.CODER_E2E_PORT)
@@ -28,3 +32,6 @@ export const gitAuth = {
2832
validatePath: "/validate",
2933
installationsPath: "/installations",
3034
};
35+
36+
export const enterpriseLicense = process.env.CODER_E2E_ENTERPRISE_LICENSE ?? "";
37+
export const skipEnterpriseTests = Boolean(enterpriseLicense);

site/e2e/enterprise.setup.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { test } from "@playwright/test";
2-
3-
const license = process.env.CODER_E2E_ENTERPRISE_LICENSE!;
2+
import { enterpriseLicense, skipEnterpriseTests } from "./constants";
43

54
test("setup license", async ({ page }) => {
5+
test.skip(skipEnterpriseTests);
6+
67
await page.goto("/deployment/licenses", { waitUntil: "domcontentloaded" });
78

89
await page.getByText("Add a license").click();
9-
await page.getByRole("textbox").fill(license);
10+
await page.getByRole("textbox").fill(enterpriseLicense);
1011
await page.getByText("Upload License").click();
1112

1213
await page.getByText("You have successfully added a license").isVisible();

site/e2e/helpers.ts

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ import type {
1212
UpdateTemplateMeta,
1313
} from "api/typesGenerated";
1414
import { TarWriter } from "utils/tar";
15-
import { agentPProfPort, coderPort, prometheusPort } from "./constants";
15+
import {
16+
agentPProfPort,
17+
coderMain,
18+
coderPort,
19+
prometheusPort,
20+
} from "./constants";
1621
import {
1722
Agent,
1823
type App,
@@ -147,7 +152,7 @@ export const sshIntoWorkspace = async (
147152
binaryArgs: string[] = [],
148153
): Promise<ssh.Client> => {
149154
if (binaryPath === "go") {
150-
binaryArgs = ["run", coderMainPath()];
155+
binaryArgs = ["run", coderMain];
151156
}
152157
const sessionToken = await findSessionToken(page);
153158
return new Promise<ssh.Client>((resolve, reject) => {
@@ -229,7 +234,7 @@ export const startAgent = async (
229234
page: Page,
230235
token: string,
231236
): Promise<ChildProcess> => {
232-
return startAgentWithCommand(page, token, "go", "run", coderMainPath());
237+
return startAgentWithCommand(page, token, "go", "run", coderMain);
233238
};
234239

235240
// downloadCoderVersion downloads the version provided into a temporary dir and
@@ -358,18 +363,6 @@ const waitUntilUrlIsNotResponding = async (url: string) => {
358363
);
359364
};
360365

361-
const coderMainPath = (): string => {
362-
return path.join(
363-
__dirname,
364-
"..",
365-
"..",
366-
"enterprise",
367-
"cmd",
368-
"coder",
369-
"main.go",
370-
);
371-
};
372-
373366
// Allows users to more easily define properties they want for agents and resources!
374367
type RecursivePartial<T> = {
375368
[P in keyof T]?: T[P] extends (infer U)[]
@@ -686,7 +679,7 @@ export const updateTemplate = async (
686679
"go",
687680
[
688681
"run",
689-
coderMainPath(),
682+
coderMain,
690683
"templates",
691684
"push",
692685
"--test.provisioner",

site/e2e/playwright.config.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import { defineConfig } from "@playwright/test";
2-
import path from "path";
3-
import { coderPort, coderdPProfPort, gitAuth } from "./constants";
2+
import * as path from "path";
3+
import { coderMain, coderPort, coderdPProfPort, gitAuth } from "./constants";
44

55
export const wsEndpoint = process.env.CODER_E2E_WS_ENDPOINT;
66

7-
const coderMain = path.join(__dirname, "../../enterprise/cmd/coder");
8-
97
// This is where auth cookies are stored!
108
export const storageState = path.join(__dirname, ".auth.json");
119

site/e2e/tests/updateTemplate.enterpriseSpec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { expect, test } from "@playwright/test";
2+
import { skipEnterpriseTests } from "../constants";
23
import { createTemplate } from "../helpers";
34

45
test("require latest version", async ({ page }) => {
6+
test.skip(skipEnterpriseTests);
57
const templateName = await createTemplate(page);
68

79
await page.goto(`/templates/${templateName}/settings`, {

site/e2e/tests/updateTemplate.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { test } from "@playwright/test";
22
import { createTemplate, updateTemplateSettings } from "../helpers";
33

4-
test("template update with new name redirects on successful submit", async ({
4+
test.only("template update with new name redirects on successful submit", async ({
55
page,
66
}) => {
77
const templateName = await createTemplate(page);

0 commit comments

Comments
 (0)