Skip to content

Commit

Permalink
TEst the Ux of Pots that are currently open
Browse files Browse the repository at this point in the history
  • Loading branch information
Spandan Datta authored and Spandan Datta committed May 28, 2024
1 parent 25e3edc commit d09e2de
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions playwright-tests/tests/donate.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
});

0 comments on commit d09e2de

Please sign in to comment.