Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
🧹
  • Loading branch information
aslilac committed Mar 27, 2024
commit a5b7635a9ceb40eb27e03fd0922ca0aea2af518d
7 changes: 7 additions & 0 deletions site/e2e/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import * as path from "path";

export const coderMain = path.join(__dirname, "../../enterprise/cmd/coder");

// Default port from the server
export const coderPort = process.env.CODER_E2E_PORT
? Number(process.env.CODER_E2E_PORT)
Expand Down Expand Up @@ -28,3 +32,6 @@ export const gitAuth = {
validatePath: "/validate",
installationsPath: "/installations",
};

export const enterpriseLicense = process.env.CODER_E2E_ENTERPRISE_LICENSE ?? "";
export const skipEnterpriseTests = Boolean(enterpriseLicense);
7 changes: 4 additions & 3 deletions site/e2e/enterprise.setup.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { test } from "@playwright/test";

const license = process.env.CODER_E2E_ENTERPRISE_LICENSE!;
import { enterpriseLicense, skipEnterpriseTests } from "./constants";

test("setup license", async ({ page }) => {
test.skip(skipEnterpriseTests);

await page.goto("/deployment/licenses", { waitUntil: "domcontentloaded" });

await page.getByText("Add a license").click();
await page.getByRole("textbox").fill(license);
await page.getByRole("textbox").fill(enterpriseLicense);
await page.getByText("Upload License").click();

await page.getByText("You have successfully added a license").isVisible();
Expand Down
25 changes: 9 additions & 16 deletions site/e2e/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ import type {
UpdateTemplateMeta,
} from "api/typesGenerated";
import { TarWriter } from "utils/tar";
import { agentPProfPort, coderPort, prometheusPort } from "./constants";
import {
agentPProfPort,
coderMain,
coderPort,
prometheusPort,
} from "./constants";
import {
Agent,
type App,
Expand Down Expand Up @@ -147,7 +152,7 @@ export const sshIntoWorkspace = async (
binaryArgs: string[] = [],
): Promise<ssh.Client> => {
if (binaryPath === "go") {
binaryArgs = ["run", coderMainPath()];
binaryArgs = ["run", coderMain];
}
const sessionToken = await findSessionToken(page);
return new Promise<ssh.Client>((resolve, reject) => {
Expand Down Expand Up @@ -229,7 +234,7 @@ export const startAgent = async (
page: Page,
token: string,
): Promise<ChildProcess> => {
return startAgentWithCommand(page, token, "go", "run", coderMainPath());
return startAgentWithCommand(page, token, "go", "run", coderMain);
};

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

const coderMainPath = (): string => {
return path.join(
__dirname,
"..",
"..",
"enterprise",
"cmd",
"coder",
"main.go",
);
};

// Allows users to more easily define properties they want for agents and resources!
type RecursivePartial<T> = {
[P in keyof T]?: T[P] extends (infer U)[]
Expand Down Expand Up @@ -686,7 +679,7 @@ export const updateTemplate = async (
"go",
[
"run",
coderMainPath(),
coderMain,
"templates",
"push",
"--test.provisioner",
Expand Down
6 changes: 2 additions & 4 deletions site/e2e/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { defineConfig } from "@playwright/test";
import path from "path";
import { coderPort, coderdPProfPort, gitAuth } from "./constants";
import * as path from "path";
import { coderMain, coderPort, coderdPProfPort, gitAuth } from "./constants";

export const wsEndpoint = process.env.CODER_E2E_WS_ENDPOINT;

const coderMain = path.join(__dirname, "../../enterprise/cmd/coder");

// This is where auth cookies are stored!
export const storageState = path.join(__dirname, ".auth.json");

Expand Down
2 changes: 2 additions & 0 deletions site/e2e/tests/updateTemplate.enterpriseSpec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { expect, test } from "@playwright/test";
import { skipEnterpriseTests } from "../constants";
import { createTemplate } from "../helpers";

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

await page.goto(`/templates/${templateName}/settings`, {
Expand Down
2 changes: 1 addition & 1 deletion site/e2e/tests/updateTemplate.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test } from "@playwright/test";
import { createTemplate, updateTemplateSettings } from "../helpers";

test("template update with new name redirects on successful submit", async ({
test.only("template update with new name redirects on successful submit", async ({
page,
}) => {
const templateName = await createTemplate(page);
Expand Down