diff --git a/e2e/load.spec.ts b/e2e/load.spec.ts index 9510a79..f29ee4c 100644 --- a/e2e/load.spec.ts +++ b/e2e/load.spec.ts @@ -8,7 +8,9 @@ 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"]); + 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 }); @@ -51,10 +53,9 @@ test("first receive", async ({ page }) => { continueButton.click(); - // Find a p with the text "Show or share this code with the sender." - await expect(page.locator("p")).toContainText([ - "Keep Mutiny open to receive the payment." - ]); + await expect( + page.getByText("Keep Mutiny open to complete the payment.") + ).toBeVisible(); // Locate an SVG inside a div with id "qr" const qrCode = await page.locator("#qr > svg"); diff --git a/e2e/restore.spec.ts b/e2e/restore.spec.ts index 6b862d8..740643b 100644 --- a/e2e/restore.spec.ts +++ b/e2e/restore.spec.ts @@ -61,4 +61,26 @@ test("restore from seed", async ({ page }) => { // Eventually we should have a balance of 100k sats await page.waitForSelector("text=100,000 SATS"); + + // Now we should clean up after ourselves and delete the wallet + settingsLink.click(); + + // Wait for settings to load + await page.waitForSelector("text=Settings"); + + // Click the "Restore" link + page.click("text=Admin Page"); + + // Clicke the Delete Everything button + page.click("text=Delete Everything"); + + // A modal should pop up, click the "Confirm" button + const confirmDeleteButton = await page.locator("button", { + hasText: "Confirm" + }); + confirmDeleteButton.click(); + + // Wait for the wallet to load + // Wait for the wallet to load + await page.waitForSelector("img[alt='lightning']"); }); diff --git a/playwright.config.ts b/playwright.config.ts index 694e2e9..753cf35 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -10,68 +10,68 @@ import { defineConfig, devices } from "@playwright/test"; * See https://playwright.dev/docs/test-configuration. */ export default defineConfig({ - testDir: "./e2e", - /* Run tests in files in parallel */ - fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, - /* Retry on CI only */ - retries: process.env.CI ? 2 : 0, - /* Opt out of parallel tests on CI. */ - workers: process.env.CI ? 1 : undefined, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: "html", - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - // baseURL: 'http://127.0.0.1:3000', + testDir: "./e2e", + /* Run tests in files in parallel */ + fullyParallel: true, + /* Fail the build on CI if you accidentally left test.only in the source code. */ + forbidOnly: !!process.env.CI, + /* Retry on CI only */ + retries: process.env.CI ? 2 : 0, + /* Opt out of parallel tests on CI. */ + workers: process.env.CI ? 1 : undefined, + /* Reporter to use. See https://playwright.dev/docs/test-reporters */ + reporter: "html", + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ + use: { + /* Base URL to use in actions like `await page.goto('/')`. */ + // baseURL: 'http://127.0.0.1:3000', - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: "on-first-retry" - }, - - /* Configure projects for major browsers */ - projects: [ - // { - // name: "chromium", - // use: { ...devices["Desktop Chrome"] } - // }, - - { - name: "firefox", - use: { ...devices["Desktop Firefox"] } + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ + trace: "on-first-retry" }, - // { - // name: "webkit", - // use: { ...devices["Desktop Safari"] } - // }, + /* Configure projects for major browsers */ + projects: [ + // { + // name: "chromium", + // use: { ...devices["Desktop Chrome"] } + // }, - /* Test against mobile viewports. */ - { - name: "Mobile Chrome", - use: { ...devices["Pixel 5"] } - }, - { - name: "Mobile Safari", - use: { ...devices["iPhone 12"] } + // { + // name: "firefox", + // use: { ...devices["Desktop Firefox"] } + // }, + + // { + // name: "webkit", + // use: { ...devices["Desktop Safari"] } + // }, + + /* Test against mobile viewports. */ + { + name: "Mobile Chrome", + use: { ...devices["Pixel 5"] } + } + // { + // name: "Mobile Safari", + // use: { ...devices["iPhone 12"] } + // } + + /* Test against branded browsers. */ + // { + // name: 'Microsoft Edge', + // use: { ...devices['Desktop Edge'], channel: 'msedge' }, + // }, + // { + // name: 'Google Chrome', + // use: { ..devices['Desktop Chrome'], channel: 'chrome' }, + // }, + ], + + /* Run your local dev server before starting the tests */ + webServer: { + command: "pnpm run dev", + url: "http://localhost:3420", + reuseExistingServer: !process.env.CI } - - /* Test against branded browsers. */ - // { - // name: 'Microsoft Edge', - // use: { ...devices['Desktop Edge'], channel: 'msedge' }, - // }, - // { - // name: 'Google Chrome', - // use: { ..devices['Desktop Chrome'], channel: 'chrome' }, - // }, - ], - - /* Run your local dev server before starting the tests */ - webServer: { - command: "pnpm run dev", - url: "http://localhost:3420", - reuseExistingServer: !process.env.CI - } }); diff --git a/vite.config.ts b/vite.config.ts index 22211a4..01e9760 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -54,7 +54,6 @@ export default defineConfig({ // Don't want vite to bundle these late during dev causing reload include: [ "qr-scanner", - "nostr-tools", "class-variance-authority", "@kobalte/core", "@solid-primitives/upload",