-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add proper types to the provider
- Loading branch information
1 parent
d9f07cf
commit 429bbcf
Showing
7 changed files
with
205 additions
and
196 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,28 @@ | ||
import { defineConfig } from '@playwright/test' | ||
|
||
export default defineConfig({ | ||
name: 'adapter', | ||
testDir: './test', | ||
timeout: process.env.CI ? 60 * 1000 : 30 * 1000, | ||
expect: { | ||
timeout: 5000, | ||
}, | ||
fullyParallel: false, | ||
forbidOnly: Boolean(process.env.CI), | ||
maxFailures: process.env.CI ? 2 : 1, | ||
retries: process.env.CI ? 2 : 0, | ||
retries: process.env.CI ? 2 : 1, | ||
workers: process.env.CI ? 1 : 2, | ||
reporter: process.env.CI ? [['html'], ['list']] : 'list', | ||
use: { | ||
actionTimeout: 0, | ||
baseURL: 'http://localhost:5173', | ||
trace: 'on-first-retry', | ||
colorScheme: 'dark', | ||
browserName: 'chromium', | ||
}, | ||
webServer: [ | ||
{ | ||
command: | ||
'pnpm --filter filsnap run build && pnpm --filter filsnap exec sirv --port 8081', | ||
url: 'http://localhost:8081/dist/snap.js', | ||
}, | ||
{ | ||
command: 'pnpm --filter demo exec vite', | ||
url: 'http://localhost:5173', | ||
}, | ||
], | ||
}) |
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,97 @@ | ||
import { createFixture } from 'metamask-testing-tools' | ||
|
||
const SNAP_ID = 'local:http://localhost:8081' | ||
const SNAP_VERSION = '*' | ||
const METAMASK_VERSION = 'v11.16.5' | ||
const RAINBOW_PASSWORD = '12345678' | ||
const RAINBOW_EXTENSION_ID = 'opfgelmcmbiajamepnmloijbpoleiama' | ||
|
||
/** | ||
* @param {any} data | ||
*/ | ||
async function setupExtraExtensions(data) { | ||
for (const extension of data) { | ||
if (extension.title === 'Rainbow Wallet') { | ||
const page = extension.page | ||
await page.getByTestId('create-wallet-button').click() | ||
await page.getByTestId('skip-button').click() | ||
await page.getByTestId('password-input').fill(RAINBOW_PASSWORD) | ||
await page.getByTestId('confirm-password-input').fill(RAINBOW_PASSWORD) | ||
await page.getByTestId('set-password-button').click() | ||
} | ||
} | ||
} | ||
|
||
let fixture = createFixture({ | ||
downloadOptions: { | ||
flask: true, | ||
tag: METAMASK_VERSION, | ||
}, | ||
}) | ||
|
||
fixture.test( | ||
'should start connect to snap when flask is installed', | ||
async ({ metamask, page }) => { | ||
await page.getByTestId('connect-snap').click() | ||
|
||
const dialog = await metamask.waitForDialog('experimental-area') | ||
await fixture.expect(dialog.getByTestId('experimental-area')).toBeVisible() | ||
} | ||
) | ||
|
||
fixture.test( | ||
'should start enabling snap when metamask as an account', | ||
async ({ metamask, page }) => { | ||
await metamask.setup() | ||
await page.getByTestId('connect-snap').click() | ||
|
||
const dialog = await metamask.waitForDialog('snaps-connect') | ||
fixture.expect(dialog).toBeDefined() | ||
} | ||
) | ||
|
||
fixture = createFixture({ | ||
isolated: true, | ||
downloadOptions: { | ||
flask: true, | ||
tag: METAMASK_VERSION, | ||
}, | ||
snap: { | ||
id: SNAP_ID, | ||
version: SNAP_VERSION, | ||
}, | ||
}) | ||
|
||
fixture.test( | ||
'should show connect button when snap is installed', | ||
async ({ metamask, page }) => { | ||
await page.getByTestId('connect-snap').click() | ||
|
||
const dialog = await metamask.waitForDialog('snap-install') | ||
fixture.expect(dialog).toBeDefined() | ||
} | ||
) | ||
|
||
fixture = createFixture({ | ||
isolated: true, | ||
downloadOptions: { | ||
flask: true, | ||
extensionsIds: [RAINBOW_EXTENSION_ID], | ||
tag: METAMASK_VERSION, | ||
}, | ||
snap: { | ||
id: SNAP_ID, | ||
version: SNAP_VERSION, | ||
}, | ||
}) | ||
|
||
fixture.test( | ||
'should start connect to snap when flask is installed alongside rainbow wallet', | ||
async ({ metamask, page }) => { | ||
await metamask.setupExtraExtensions(setupExtraExtensions) | ||
await page.getByTestId('connect-snap').click() | ||
|
||
const dialog = await metamask.waitForDialog('connect') | ||
fixture.expect(dialog).toBeDefined() | ||
} | ||
) |
Oops, something went wrong.