-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
e428447
commit 1db80d2
Showing
9 changed files
with
167 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
declare global { | ||
namespace NodeJS { | ||
interface ProcessEnv { | ||
CI: boolean | ||
HEADLESS: boolean | ||
} | ||
} | ||
} | ||
|
||
declare global { | ||
interface Window { | ||
ethereum: import('ethers').Eip1193Provider | ||
} | ||
|
||
// biome-ignore lint/suspicious/noExplicitAny: Web3Mock is a mock object | ||
const Web3Mock: any | ||
} | ||
|
||
export {} |
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,54 @@ | ||
{ | ||
"name": "@synthetixio/synpress-phantom", | ||
"version": "0.0.1-alpha.0", | ||
"type": "module", | ||
"exports": { | ||
"types": "./types/index.d.ts", | ||
"default": "./dist/index.js" | ||
}, | ||
"main": "./dist/index.js", | ||
"types": "./types/index.d.ts", | ||
"files": [ | ||
"dist", | ||
"src", | ||
"types" | ||
], | ||
"scripts": { | ||
"build": "pnpm run clean && pnpm run build:dist && pnpm run build:types", | ||
"build:cache": "synpress-cache test/wallet-setup --phantom", | ||
"build:dist": "tsup --tsconfig tsconfig.build.json", | ||
"build:types": "tsc --emitDeclarationOnly --project tsconfig.build.json", | ||
"clean": "rimraf dist types", | ||
"test:coverage": "vitest run --coverage", | ||
"test:e2e:headful": "playwright test", | ||
"test:e2e:headless": "HEADLESS=true playwright test", | ||
"test:e2e:headless:ui": "HEADLESS=true playwright test --ui", | ||
"test:watch": "vitest watch", | ||
"types:check": "tsc --noEmit" | ||
}, | ||
"dependencies": { | ||
"@synthetixio/synpress-cache": "workspace:*", | ||
"@synthetixio/synpress-core": "workspace:*", | ||
"@viem/anvil": "0.0.7", | ||
"clipboardy": "4.0.0", | ||
"fs-extra": "11.2.0", | ||
"node-fetch": "3.3.2", | ||
"underscore": "1.13.6", | ||
"zod": "3.22.4" | ||
}, | ||
"devDependencies": { | ||
"@synthetixio/synpress-tsconfig": "workspace:*", | ||
"@types/fs-extra": "11.0.4", | ||
"@types/node": "20.11.17", | ||
"@types/underscore": "1.11.15", | ||
"@vitest/coverage-v8": "1.2.2", | ||
"cypress": "13.9.0", | ||
"rimraf": "5.0.5", | ||
"tsup": "8.0.2", | ||
"typescript": "5.3.3", | ||
"vitest": "1.2.2" | ||
}, | ||
"peerDependencies": { | ||
"@playwright/test": "1.44.0" | ||
} | ||
} |
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,50 @@ | ||
import { defineConfig, devices } from '@playwright/test' | ||
|
||
/** | ||
* See https://playwright.dev/docs/test-configuration. | ||
*/ | ||
export default defineConfig({ | ||
// Look for test files in the "test/e2e" directory, relative to this configuration file. | ||
testDir: './test/e2e', | ||
|
||
// We're increasing the timeout to 60 seconds to allow all traces to be recorded. | ||
// Sometimes it threw an error saying that traces were not recorded in the 30 seconds timeout limit. | ||
timeout: 60_000, | ||
|
||
// Run all tests in parallel. | ||
fullyParallel: true, | ||
|
||
// Fail the build on CI if you accidentally left test.only in the source code. | ||
forbidOnly: !!process.env.CI, | ||
|
||
// Fail all remaining tests on CI after the first failure. We want to reduce the feedback loop on CI to minimum. | ||
maxFailures: process.env.CI ? 1 : 0, | ||
|
||
// Opt out of parallel tests on CI since it supports only 1 worker. | ||
workers: process.env.CI ? 1 : undefined, | ||
|
||
// Concise 'dot' for CI, default 'html' when running locally. | ||
// See https://playwright.dev/docs/test-reporters. | ||
reporter: process.env.CI | ||
? [['html', { open: 'never', outputFolder: `playwright-report-${process.env.HEADLESS ? 'headless' : 'headful'}` }]] | ||
: 'html', | ||
|
||
// Shared settings for all the projects below. | ||
// See https://playwright.dev/docs/api/class-testoptions. | ||
use: { | ||
// We are using locally deployed MetaMask Test Dapp. | ||
baseURL: '/', | ||
|
||
// Collect all traces on CI, and only traces for failed tests when running locally. | ||
// See https://playwright.dev/docs/trace-viewer. | ||
trace: process.env.CI ? 'on' : 'retain-on-failure' | ||
}, | ||
|
||
// Configure projects for major browsers. | ||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: { ...devices['Desktop Chrome'] } | ||
} | ||
] | ||
}) |
File renamed without changes.
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,3 @@ | ||
export * from './PhantomWallet' | ||
export * from './utils' | ||
export * from './fixtures/phantomFixtures' |
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,5 @@ | ||
import { testWithSynpress } from '@synthetixio/synpress-core' | ||
import { phantomFixtures } from '../src' | ||
import importPhantom from './wallet-setup/import-wallet.setup' | ||
|
||
export default testWithSynpress(phantomFixtures(importPhantom)) |
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,12 @@ | ||
{ | ||
"extends": "@synthetixio/synpress-tsconfig/base.json", | ||
"compilerOptions": { | ||
"rootDir": "src", | ||
"outDir": "types", | ||
"declaration": true, | ||
"sourceMap": true, | ||
"declarationMap": true | ||
}, | ||
"include": ["src"], | ||
"files": ["environment.d.ts"] | ||
} |
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,12 @@ | ||
{ | ||
"type": "commonjs", | ||
"extends": "./tsconfig.build.json", | ||
"compilerOptions": { | ||
"rootDir": ".", | ||
"exactOptionalPropertyTypes": false, // Allows for `undefined` in `playwright.config.ts` | ||
"types": ["cypress"], | ||
"sourceMap": false | ||
}, | ||
"include": ["src", "test"], | ||
"files": ["environment.d.ts", "playwright.config.ts"] | ||
} |
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,12 @@ | ||
import { defineConfig } from 'tsup' | ||
|
||
export default defineConfig({ | ||
name: 'phantom', | ||
entry: ['src/index.ts'], | ||
outDir: 'dist', | ||
format: 'esm', | ||
splitting: false, | ||
treeshake: true, | ||
sourcemap: true, | ||
external: ['@playwright/test'] | ||
}) |