Skip to content

Commit

Permalink
feat: program and dg round testsˆ
Browse files Browse the repository at this point in the history
  • Loading branch information
vacekj committed Feb 1, 2024
1 parent 357e52b commit 09ba6c9
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 29 deletions.
1 change: 1 addition & 0 deletions packages/round-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
"typescript": "^5.3.0",
"url": "^0.11.0",
"util": "^0.12.4",
"uuid": "^9.0.1",
"verify-env": "*",
"wagmi": "0.12.18",
"web-vitals": "^2.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/round-manager/playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { defineConfig, devices } from "@playwright/test";

export default defineConfig({
testDir: "./tests",
timeout: 30 * 1000,
timeout: 60 * 1000,
expect: {
timeout: 5000,
},
Expand Down
7 changes: 5 additions & 2 deletions packages/round-manager/tests/createDgRound.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { test } from "../fixtures";
import * as metamask from "@synthetixio/synpress/commands/metamask";
import { faker } from "@faker-js/faker";
import { v4 } from "uuid";

test.beforeEach(async ({ page }) => {
// baseUrl is set in playwright.config.ts
Expand All @@ -9,6 +11,7 @@ test.beforeEach(async ({ page }) => {
test("connect wallet, create a program, create a dg round", async ({
page,
}) => {
const roundName = faker.company.name() + v4();
await page.getByRole("navigation").getByTestId("rk-connect-button").click();
await page.getByText("Metamask").click();
await metamask.acceptAccess();
Expand All @@ -19,7 +22,7 @@ test("connect wallet, create a program, create a dg round", async ({
await page.getByRole("button", { name: "Direct Grants Choose this" }).click();
await page.getByRole("button", { name: "Create round" }).click();
await page.getByLabel("Round Name").click();
await page.getByLabel("Round Name").fill("Testing Program from Playwright");
await page.getByLabel("Round Name").fill(roundName);
await page.getByTestId("support-type-select").click();
await page.getByRole("option", { name: "Email" }).locator("div").click();
await page.getByPlaceholder("Enter desired form of contact").click();
Expand All @@ -41,5 +44,5 @@ test("connect wallet, create a program, create a dg round", async ({
await page.getByTestId("requirement-input").fill("Be a bot!");
await page.getByRole("button", { name: "Next" }).click();
await page.getByRole("button", { name: "Launch" }).click();
await page.getByText("Testing Program from Playwright").waitFor();
await page.getByText(roundName).waitFor();
});
10 changes: 8 additions & 2 deletions packages/round-manager/tests/createProgram.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { test } from "../fixtures";
import * as metamask from "@synthetixio/synpress/commands/metamask";
import { faker } from "@faker-js/faker";
import { v4 } from "uuid";
import { abbreviateAddress } from "../src/features/api/utils";

test.beforeEach(async ({ page }) => {
// baseUrl is set in playwright.config.ts
await page.goto("/");
});

test("create a program", async ({ page }) => {
const programName = faker.company.name() + v4();
await page.getByRole("navigation").getByTestId("rk-connect-button").click();
await page.getByText("Metamask").click();
await metamask.acceptAccess();
Expand All @@ -15,8 +19,10 @@ test("create a program", async ({ page }) => {
await metamask.allowToAddAndSwitchNetwork();
await page.getByTestId("create-program").click();
await page.getByTestId("program-name").click();
await page.getByTestId("program-name").fill("Testing from Playwright");
await page.getByTestId("program-name").fill(programName);
await page.getByTestId("save").click();
await metamask.confirmTransaction();
await page.getByText("Testing from Playwright").waitFor();
await page.getByText(programName).waitFor();
await page.getByText(programName).click();
await page.getByText(abbreviateAddress(metamask.walletAddress())).waitFor();
});
46 changes: 22 additions & 24 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 09ba6c9

Please sign in to comment.