-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
40a3e79
commit 4928e9f
Showing
6 changed files
with
79 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,11 @@ | ||
import { expect, test } from "@playwright/test"; | ||
import { test } from "@playwright/test"; | ||
|
||
import { loadHome } from "./utils"; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await page.goto("http://localhost:3420/"); | ||
}); | ||
|
||
test("initial load", async ({ page }) => { | ||
// Expect a title "to contain" a substring. | ||
await expect(page).toHaveTitle(/Mutiny Wallet/); | ||
|
||
await expect(page.locator("header")).toContainText(["Activity"], { | ||
timeout: 30000 | ||
}); | ||
|
||
// Wait up to 30 seconds for an image element matching the selector to be visible | ||
await page.waitForSelector("img[alt='lightning']", { timeout: 30000 }); | ||
|
||
// Wait for an element matching the selector to appear in DOM. | ||
await page.waitForSelector("text=0 SATS"); | ||
|
||
console.log("Page loaded."); | ||
await loadHome(page); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { expect, Page } from "@playwright/test"; | ||
|
||
export async function loadHome(page: Page) { | ||
// Start on the home page | ||
await expect(page).toHaveTitle(/Mutiny Wallet/); | ||
await page.waitForSelector("text=Welcome to the Mutiny!"); | ||
|
||
console.log("Waiting for new wallet to be created..."); | ||
|
||
await page.locator(`button:has-text('New Wallet')`).click(); | ||
|
||
await page.locator("text=Create your profile").first(); | ||
|
||
await page.locator("button:has-text('Skip for now')").click(); | ||
|
||
// Should have a balance up top now | ||
await page.locator(`text=0 sats`).first(); | ||
} | ||
|
||
export async function visitSettings(page: Page) { | ||
// Find an image with an alt text of "mutiny" and click it | ||
// TODO: probably should have better ARIA stuff for this | ||
await page.locator("img[alt='mutiny']").first().click(); | ||
await expect(page.locator("h1").first()).toHaveText("Settings"); | ||
} |