Skip to content

Commit

Permalink
fix donate test for wallet connected
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotBraem committed May 20, 2024
1 parent e0be84f commit 3db39c7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 22 deletions.
4 changes: 2 additions & 2 deletions playwright-tests/storage-states/wallet-connected.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
},
{
"name": "near_app_wallet_auth_key",
"value": "{\"accountId\":\"staging.potlock.near\"}"
"value": "{\"accountId\":\"root.near\"}"
},
{
"name": "near-social-vm:v01::accountId:",
"value": "staging.potlock.near"
"value": "root.near"
},
{
"name": "flags",
Expand Down
46 changes: 26 additions & 20 deletions playwright-tests/tests/donate.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,38 @@ test("should open donate modal", async ({ page }) => {
expect(await page.isVisible("text=Donate to")).toBeTruthy();
});

test("project with no active pot should donate direct with correct amount", async ({ page }) => {
test.setTimeout(120000); // 2 minutes... we want to improve performance
test.describe("User is logged in", () => {
test.use({
storageState: "playwright-tests/storage-states/wallet-connected.json",
});

// go to project page (PotLock project)
await page.goto(`${ROOT_SRC}?tab=project&projectId=${DEFAULT_PROJECT_ID}`);
test("project with no active pot should donate direct with correct amount", async ({ page }) => {
test.setTimeout(120000); // 2 minutes... we want to improve performance

// click donate button
await page.getByRole("button", { name: "Donate" }).click();
// go to project page (PotLock project)
await page.goto(`${ROOT_SRC}?tab=project&projectId=${DEFAULT_PROJECT_ID}`);

// wait for modal to appear
expect(await page.isVisible("text=Donate to")).toBeTruthy();
// click donate button
await page.getByRole("button", { name: "Donate" }).click();

// wait for modal to appear
expect(await page.isVisible("text=Donate to")).toBeTruthy();

// input amount
await page.fill("input[name=amount]", "100");
// input amount
await page.fill("input[name=amount]", "1");

await page.getByRole("button", { name: "Proceed to donate" }).click();
await page.getByRole("button", { name: "Proceed to donate" }).click();

// Confirm Donation
await page.getByRole("button", { name: "Confirm donation" }).click();
// Confirm Donation
await page.getByRole("button", { name: "Confirm donation" }).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,
// 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 3db39c7

Please sign in to comment.