Skip to content

feat: unify organization and deployment management settings #13602

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 17 commits into from
Jul 1, 2024
Prev Previous commit
Next Next commit
e2e test
  • Loading branch information
aslilac committed Jun 28, 2024
commit 42463492f357233211b5734cb89363889bc36e3b
11 changes: 11 additions & 0 deletions site/e2e/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ export const createGroup = async (orgId: string) => {
return group;
};

export const createOrganization = async () => {
const name = randomName();
const org = await API.createOrganization({
name,
display_name: `Org ${name}`,
description: `Org description ${name}`,
icon: "/emojis/1f957.png",
});
return org;
};

export async function verifyConfigFlagBoolean(
page: Page,
config: DeploymentConfig,
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 @@ -147,7 +147,7 @@ export default defineConfig({
gitAuth.validatePath,
),
CODER_PPROF_ADDRESS: "127.0.0.1:" + coderdPProfPort,
CODER_EXPERIMENTS: e2eFakeExperiment1 + "," + e2eFakeExperiment2,
CODER_EXPERIMENTS: `multi-organization,${e2eFakeExperiment1},${e2eFakeExperiment2}`,

// Tests for Deployment / User Authentication / OIDC
CODER_OIDC_ISSUER_URL: "https://accounts.google.com",
Expand Down
39 changes: 39 additions & 0 deletions site/e2e/tests/organizations.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { test, expect } from "@playwright/test";
import {
createGroup,

Check failure on line 3 in site/e2e/tests/organizations.spec.ts

View workflow job for this annotation

GitHub Actions / fmt

'createGroup' is defined but never used. Allowed unused vars must match /^_/u
createOrganization,

Check failure on line 4 in site/e2e/tests/organizations.spec.ts

View workflow job for this annotation

GitHub Actions / fmt

'createOrganization' is defined but never used. Allowed unused vars must match /^_/u
getCurrentOrgId,

Check failure on line 5 in site/e2e/tests/organizations.spec.ts

View workflow job for this annotation

GitHub Actions / fmt

'getCurrentOrgId' is defined but never used. Allowed unused vars must match /^_/u
setupApiCalls,
} from "../api";
import { requiresEnterpriseLicense } from "../helpers";
import { beforeCoderTest } from "../hooks";
import { expectUrl } from "../expectUrl";

test.beforeEach(async ({ page }) => await beforeCoderTest(page));

test("create and delete organization", async ({ page, baseURL }) => {
requiresEnterpriseLicense();
await setupApiCalls(page);

// Create an organzation

Check warning on line 18 in site/e2e/tests/organizations.spec.ts

View workflow job for this annotation

GitHub Actions / lint

"organzation" should be "organization".
await page.goto(`${baseURL}/organizations/new`, {
waitUntil: "domcontentloaded",
});

await page.getByLabel("Name", { exact: true }).fill("floop");
await page.getByLabel("Display name").fill("Floop");
await page.getByLabel("Description").fill("Org description floop");
await page.getByLabel("Icon", { exact: true }).fill("/emojis/1f957.png");

await page.getByRole("button", { name: "Submit" }).click();

// Expect to be redirected to the new organization
await expectUrl(page).toHavePathName("/organizations/floop");
await expect(page.getByText("Organization created.")).toBeVisible();

await page.getByRole("button", { name: "Delete this organization" }).click();
const dialog = page.getByTestId("dialog");
await dialog.getByLabel("Name").fill("floop");
await dialog.getByRole("button", { name: "Delete" }).click();
await expect(page.getByText("Organization deleted.")).toBeVisible();
});
Loading