Skip to content

Commit

Permalink
Add organization fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
ericpgreen2 committed Dec 13, 2024
1 parent 45c34e6 commit 41b7e41
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion web-admin/tests/organizations.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test.describe("Organizations", () => {
await page.goto("/e2e");
await expect(page.getByRole("heading", { name: "e2e" })).toBeVisible();

// Clean up
// Clean up quickly
await execAsync("rill org delete e2e --force");
});
});
10 changes: 9 additions & 1 deletion web-admin/tests/setup/base.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { test as base, type Page } from "@playwright/test";
import { cliLogin, cliLogout } from "./cli";
import { cliLogin, cliLogout } from "./fixtures/cli";
import { orgCreate, orgDelete } from "./fixtures/org";

type MyFixtures = {
anonPage: Page;
cli: void;
organization: void;
};

export const test = base.extend<MyFixtures>({
Expand All @@ -21,4 +23,10 @@ export const test = base.extend<MyFixtures>({
await use();
await cliLogout();
},

organization: async ({ cli }, use) => {

Check failure on line 27 in web-admin/tests/setup/base.ts

View workflow job for this annotation

GitHub Actions / build

'cli' is defined but never used. Allowed unused args must match /^_/u
await orgCreate();
await use();
await orgDelete();
},
});
File renamed without changes.
17 changes: 17 additions & 0 deletions web-admin/tests/setup/fixtures/org.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { expect } from "@playwright/test";
import { exec } from "child_process";
import { promisify } from "util";

const execAsync = promisify(exec);

export async function orgCreate() {
const { stdout: orgCreateStdout } = await execAsync("rill org create e2e");
expect(orgCreateStdout).toContain("Created organization");
}

export async function orgDelete() {
const { stdout: orgDeleteStdout } = await execAsync(
"rill org delete e2e --force",
);
expect(orgDeleteStdout).toContain("Deleted organization");
}

0 comments on commit 41b7e41

Please sign in to comment.