Skip to content

chore: enable terraform provisioners in e2e by default #13134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
May 8, 2024
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
PR suggestions, using web terminal helper
  • Loading branch information
Emyrk committed May 7, 2024
commit e34546fdacb1106178d49eee8aed15fff4ff11ff
3 changes: 2 additions & 1 deletion site/e2e/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,7 @@ export async function openTerminalWindow(
page: Page,
context: BrowserContext,
workspaceName: string,
agentName: string = "dev",
): Promise<Page> {
// Wait for the web terminal to open in a new tab
const pagePromise = context.waitForEvent("page");
Expand All @@ -910,7 +911,7 @@ export async function openTerminalWindow(
// isn't POSIX compatible, such as Fish.
const commandQuery = `?command=${encodeURIComponent("/usr/bin/env bash")}`;
await expectUrl(terminal).toHavePathName(
`/@admin/${workspaceName}.dev/terminal`,
`/@admin/${workspaceName}.${agentName}/terminal`,
);
await terminal.goto(`/@admin/${workspaceName}.dev/terminal${commandQuery}`);

Expand Down
2 changes: 1 addition & 1 deletion site/e2e/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if (requireTerraformTests) {
// So if both these work, then we can launch terraform provisioners.
execSync("terraform --version");
execSync("docker --version");
} catch (e) {
} catch {
throw new Error(
"Terraform provisioners require docker & terraform. " +
"At least one of these is not present in the runtime environment. To check yourself:\n" +
Expand Down
28 changes: 14 additions & 14 deletions site/e2e/tests/createWorkspace.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
createTemplate,
createWorkspace,
echoResponsesWithParameters,
openTerminalWindow,
requiresTerraform,
verifyParameters,
} from "../helpers";
Expand Down Expand Up @@ -150,15 +151,15 @@ test("create workspace with disable_param search params", async ({ page }) => {
await expect(page.getByLabel(/Second parameter/i)).toBeDisabled();
});

test("create docker workspace", async ({ page }) => {
test.skip(
true,
"creating docker containers is currently leaky. They are not cleaned up when the tests are over.",
);
test("create docker workspace", async ({ context, page }) => {
// test.skip(
// true,
// "creating docker containers is currently leaky. They are not cleaned up when the tests are over.",
// );
requiresTerraform();
const template = await createTemplate(page, StarterTemplates.STARTER_DOCKER);

const _ = await createWorkspace(page, template);
const workspaceName = await createWorkspace(page, template);

// The workspace agents must be ready before we try to interact with the workspace.
await page.waitForSelector(
Expand All @@ -175,14 +176,13 @@ test("create docker workspace", async ({ page }) => {
state: "visible",
});

// We can't click the terminal button because that opens a new tab.
// So grab the href, and manually navigate.
const terminalPageURL = await page.getAttribute(terminalButton, "href");
expect(terminalPageURL).not.toBeNull();
await page.goto(terminalPageURL!, {
waitUntil: "domcontentloaded",
});
await page.waitForSelector(
const terminal = await openTerminalWindow(
page,
context,
workspaceName,
"main",
);
await terminal.waitForSelector(
`//textarea[contains(@class,"xterm-helper-textarea")]`,
{
state: "visible",
Expand Down
2 changes: 1 addition & 1 deletion site/src/pages/CreateTemplatePage/CreateTemplateForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export type CreateTemplateFormProps = (
};

export const CreateTemplateForm: FC<CreateTemplateFormProps> = (props) => {
const [searchParams, _] = useSearchParams();
const [searchParams] = useSearchParams();
const {
onCancel,
onSubmit,
Expand Down
Loading