Skip to content

Commit

Permalink
better restore test
Browse files Browse the repository at this point in the history
  • Loading branch information
futurepaul committed Jul 28, 2023
1 parent 345569c commit 990d9b3
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 63 deletions.
11 changes: 6 additions & 5 deletions e2e/load.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down Expand Up @@ -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");
Expand Down
22 changes: 22 additions & 0 deletions e2e/restore.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']");
});
114 changes: 57 additions & 57 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
/* 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"] }
// },
/* Configure projects for major browsers */
projects: [
// {
// name: "chromium",
// use: { ...devices["Desktop Chrome"] }
// },

{
name: "firefox",
use: { ...devices["Desktop Firefox"] }
},
// {
// name: "firefox",
// use: { ...devices["Desktop Firefox"] }
// },

// {
// name: "webkit",
// use: { ...devices["Desktop Safari"] }
// },
// {
// 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 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' },
// },
],
/* 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
}
/* Run your local dev server before starting the tests */
webServer: {
command: "pnpm run dev",
url: "http://localhost:3420",
reuseExistingServer: !process.env.CI
}
});
1 change: 0 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 990d9b3

Please sign in to comment.