better restore test

This commit is contained in:
Paul Miller
2023-07-12 11:19:46 -05:00
parent 345569c3ee
commit 990d9b3062
4 changed files with 87 additions and 65 deletions

View File

@@ -8,7 +8,9 @@ test("initial load", async ({ page }) => {
// Expect a title "to contain" a substring. // Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/Mutiny Wallet/); 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 // Wait up to 30 seconds for an image element matching the selector to be visible
await page.waitForSelector("img[alt='lightning']", { timeout: 30000 }); await page.waitForSelector("img[alt='lightning']", { timeout: 30000 });
@@ -51,10 +53,9 @@ test("first receive", async ({ page }) => {
continueButton.click(); continueButton.click();
// Find a p with the text "Show or share this code with the sender." await expect(
await expect(page.locator("p")).toContainText([ page.getByText("Keep Mutiny open to complete the payment.")
"Keep Mutiny open to receive the payment." ).toBeVisible();
]);
// Locate an SVG inside a div with id "qr" // Locate an SVG inside a div with id "qr"
const qrCode = await page.locator("#qr > svg"); const qrCode = await page.locator("#qr > svg");

View File

@@ -61,4 +61,26 @@ test("restore from seed", async ({ page }) => {
// Eventually we should have a balance of 100k sats // Eventually we should have a balance of 100k sats
await page.waitForSelector("text=100,000 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']");
}); });

View File

@@ -10,68 +10,68 @@ import { defineConfig, devices } from "@playwright/test";
* See https://playwright.dev/docs/test-configuration. * See https://playwright.dev/docs/test-configuration.
*/ */
export default defineConfig({ export default defineConfig({
testDir: "./e2e", testDir: "./e2e",
/* Run tests in files in parallel */ /* Run tests in files in parallel */
fullyParallel: true, fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */ /* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI, forbidOnly: !!process.env.CI,
/* Retry on CI only */ /* Retry on CI only */
retries: process.env.CI ? 2 : 0, retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */ /* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined, workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ /* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: "html", reporter: "html",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: { use: {
/* Base URL to use in actions like `await page.goto('/')`. */ /* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000', // baseURL: 'http://127.0.0.1:3000',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry" trace: "on-first-retry"
},
/* Configure projects for major browsers */
projects: [
// {
// name: "chromium",
// use: { ...devices["Desktop Chrome"] }
// },
{
name: "firefox",
use: { ...devices["Desktop Firefox"] }
}, },
// { /* Configure projects for major browsers */
// name: "webkit", projects: [
// use: { ...devices["Desktop Safari"] } // {
// }, // name: "chromium",
// use: { ...devices["Desktop Chrome"] }
// },
/* Test against mobile viewports. */ // {
{ // name: "firefox",
name: "Mobile Chrome", // use: { ...devices["Desktop Firefox"] }
use: { ...devices["Pixel 5"] } // },
},
{ // {
name: "Mobile Safari", // name: "webkit",
use: { ...devices["iPhone 12"] } // 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
}
}); });

View File

@@ -54,7 +54,6 @@ export default defineConfig({
// Don't want vite to bundle these late during dev causing reload // Don't want vite to bundle these late during dev causing reload
include: [ include: [
"qr-scanner", "qr-scanner",
"nostr-tools",
"class-variance-authority", "class-variance-authority",
"@kobalte/core", "@kobalte/core",
"@solid-primitives/upload", "@solid-primitives/upload",