From 25e3edca1b668a7d3fe1db314309c64261df6b9c Mon Sep 17 00:00:00 2001 From: Spandan Datta Date: Mon, 13 May 2024 23:41:12 -0500 Subject: [PATCH 1/2] completed pot test --- playwright-tests/tests/pots.spec.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/playwright-tests/tests/pots.spec.js b/playwright-tests/tests/pots.spec.js index 0bf88c15..dee916b1 100644 --- a/playwright-tests/tests/pots.spec.js +++ b/playwright-tests/tests/pots.spec.js @@ -65,7 +65,16 @@ test("should show active pots", async ({ page }) => { }); test("should show completed pots", async ({ page }) => { - // TODO: + await page.goto(`${ROOT_SRC}?tab=pots`); + + const completedPots = page.locator('[data-testid="inactive-pot"]'); + + await completedPots.first().waitFor(); + + const count = await completedPots.count(); + for (let i = 0; i < count; i++) { + await expect(completedPots.nth(i)).toBeVisible(); + } }); test("should sort pots", async ({ page }) => { From d09e2debb46627539cb481821aa9cb094e8139fe Mon Sep 17 00:00:00 2001 From: Spandan Datta Date: Tue, 28 May 2024 00:29:34 -0500 Subject: [PATCH 2/2] TEst the Ux of Pots that are currently open --- playwright-tests/tests/donate.spec.js | 42 +++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/playwright-tests/tests/donate.spec.js b/playwright-tests/tests/donate.spec.js index 7ffde24a..991ede4e 100644 --- a/playwright-tests/tests/donate.spec.js +++ b/playwright-tests/tests/donate.spec.js @@ -40,3 +40,45 @@ test.skip("project with no active pot should donate direct with correct amount", recipient_id: DEFAULT_PROJECT_ID, }); }); + + + +test("Should donate the correct amount to active pots", async ({ page }) => { + test.setTimeout(100000); + + // go to Pots page + await page.goto(`${ROOT_SRC}?tab=pots`); + console.log(`${ROOT_SRC}?tab=pots`); + + + //Find an active pot + const daysLeftElement = page.locator('text=days left to donate'); + await daysLeftElement.click(); + + // log the current URL + const currentUrl = page.url(); + console.log(`Current URL: ${currentUrl}`); + + await page.getByRole("button", { name: "Fund matching pool" }).click(); + + // wait for modal to appear + expect(await page.isVisible("text=Enter matching pool contribution amount in NEAR (no minimum)")).toBeTruthy(); + + // input amount + await page.fill("input[name=Enter amount here in NEAR]", "100"); + + await page.getByRole("button", { name: "Contribute 100 NEAR to matching pool" }).click(); + + // Confirm Donation + await page.getByRole("button", { name: "Confirm" }).click(); + + // Confirmation modal should be visible + const transactionObj = JSON.parse(await page.locator("div.modal-body code").innerText()); + + // check if transaction object is correct + expect(transactionObj).toMatchObject({ + bypass_protocol_fee: false, + message: "", + recipient_id: DEFAULT_PROJECT_ID, + }); +}); \ No newline at end of file