Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ux test1 #136

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
});
});
11 changes: 10 additions & 1 deletion playwright-tests/tests/pots.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => {
Expand Down
Loading