Skip to content

Commit

Permalink
Add Explore test
Browse files Browse the repository at this point in the history
  • Loading branch information
ericpgreen2 committed Dec 13, 2024
1 parent 41b7e41 commit d5baafc
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
21 changes: 21 additions & 0 deletions web-admin/tests/explores.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { expect } from "@playwright/test";
import { test } from "./setup/base";

test.describe("Explores", () => {
test("should have data", async ({ project, page }) => {

Check failure on line 5 in web-admin/tests/explores.spec.ts

View workflow job for this annotation

GitHub Actions / build

'project' is defined but never used. Allowed unused args must match /^_/u
// Wait for reconciliation to complete
// (But, really, the dashboard link should be disabled until it's been reconciled)
await page.waitForTimeout(5000);

// Navigate to the explore
await page
.getByRole("link", { name: "Programmatic Ads Auction" })
.first()
.click();

// Check the Big Number
await expect(
page.getByRole("button", { name: "Requests 635M" }),
).toBeVisible();
});
});
8 changes: 8 additions & 0 deletions web-admin/tests/setup/base.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { test as base, type Page } from "@playwright/test";
import { cliLogin, cliLogout } from "./fixtures/cli";
import { orgCreate, orgDelete } from "./fixtures/org";
import { projectDelete, projectDeploy } from "./fixtures/project";

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

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

project: async ({ organization, page }, use) => {

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

View workflow job for this annotation

GitHub Actions / build

'organization' is defined but never used. Allowed unused args must match /^_/u
await projectDeploy(page);
await use();
await projectDelete();
},
});
19 changes: 19 additions & 0 deletions web-admin/tests/setup/fixtures/project.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { Page } from "@playwright/test";
import { exec } from "child_process";
import { promisify } from "util";

const execAsync = promisify(exec);

export async function projectDeploy(page: Page) {
await execAsync(
"rill deploy --path tests/setup/git/repos/rill-examples --subpath rill-openrtb-prog-ads --project openrtb --github true",
);
await page.goto("/e2e/openrtb");
}

export async function projectDelete() {
await execAsync("rill project delete openrtb --force");
await execAsync(
"rm -rf tests/setup/git/repos/rill-examples/rill-openrtb-prog-ads/.rillcloud",
);
}

0 comments on commit d5baafc

Please sign in to comment.