|
| 1 | +import { test, expect } from "@playwright/test"; |
| 2 | +import { |
| 3 | + createGroup, |
| 4 | + createOrganization, |
| 5 | + getCurrentOrgId, |
| 6 | + setupApiCalls, |
| 7 | +} from "../api"; |
| 8 | +import { requiresEnterpriseLicense } from "../helpers"; |
| 9 | +import { beforeCoderTest } from "../hooks"; |
| 10 | +import { expectUrl } from "../expectUrl"; |
| 11 | + |
| 12 | +test.beforeEach(async ({ page }) => await beforeCoderTest(page)); |
| 13 | + |
| 14 | +test("create and delete organization", async ({ page, baseURL }) => { |
| 15 | + requiresEnterpriseLicense(); |
| 16 | + await setupApiCalls(page); |
| 17 | + |
| 18 | + // Create an organzation |
| 19 | + await page.goto(`${baseURL}/organizations/new`, { |
| 20 | + waitUntil: "domcontentloaded", |
| 21 | + }); |
| 22 | + |
| 23 | + await page.getByLabel("Name", { exact: true }).fill("floop"); |
| 24 | + await page.getByLabel("Display name").fill("Floop"); |
| 25 | + await page.getByLabel("Description").fill("Org description floop"); |
| 26 | + await page.getByLabel("Icon", { exact: true }).fill("/emojis/1f957.png"); |
| 27 | + |
| 28 | + await page.getByRole("button", { name: "Submit" }).click(); |
| 29 | + |
| 30 | + // Expect to be redirected to the new organization |
| 31 | + await expectUrl(page).toHavePathName("/organizations/floop"); |
| 32 | + await expect(page.getByText("Organization created.")).toBeVisible(); |
| 33 | + |
| 34 | + await page.getByRole("button", { name: "Delete this organization" }).click(); |
| 35 | + const dialog = page.getByTestId("dialog"); |
| 36 | + await dialog.getByLabel("Name").fill("floop"); |
| 37 | + await dialog.getByRole("button", { name: "Delete" }).click(); |
| 38 | + await expect(page.getByText("Organization deleted.")).toBeVisible(); |
| 39 | +}); |
0 commit comments