diff --git a/examples/new-dawn/README.md b/examples/new-dawn/README.md index 4a5beee71..102ae8257 100644 --- a/examples/new-dawn/README.md +++ b/examples/new-dawn/README.md @@ -11,7 +11,7 @@ The New Dawn version of Synpress differs in one major way from all previous vers - We set up the browser only once, and we cache it. Thanks to this, tests not only run faster, but it also allows to use **ALL FEATURES** of [Playwright](https://playwright.dev/), such as parallel testing 🚀 -You can define how a browser should be set up yourself. You can find setup file examples [here](./test/wallet-setup). +You can define how a browser should be set up yourself. You can find setup file examples [here](test/playwright/wallet-setup). All setup files must have the following naming structure: `*.setup.{js,ts}`. Once you define a setup file, you can build a cache with our CLI. By default, the cache is built in a headed mode and diff --git a/examples/new-dawn/test/e2e/00_mock.spec.ts b/examples/new-dawn/test/playwright/00_mock.spec.ts similarity index 85% rename from examples/new-dawn/test/e2e/00_mock.spec.ts rename to examples/new-dawn/test/playwright/00_mock.spec.ts index ac2eef648..b564dceed 100644 --- a/examples/new-dawn/test/e2e/00_mock.spec.ts +++ b/examples/new-dawn/test/playwright/00_mock.spec.ts @@ -1,4 +1,5 @@ -import { EthereumWalletMock, ethereumWalletMockFixtures, testWithSynpress } from '@synthetixio/synpress' +import { testWithSynpress } from '@synthetixio/synpress' +import { EthereumWalletMock, ethereumWalletMockFixtures } from '@synthetixio/synpress/playwright' const test = testWithSynpress(ethereumWalletMockFixtures) diff --git a/examples/new-dawn/test/e2e/01_basic.spec.ts b/examples/new-dawn/test/playwright/01_basic.spec.ts similarity index 77% rename from examples/new-dawn/test/e2e/01_basic.spec.ts rename to examples/new-dawn/test/playwright/01_basic.spec.ts index 04b1058fc..438e9d74b 100644 --- a/examples/new-dawn/test/e2e/01_basic.spec.ts +++ b/examples/new-dawn/test/playwright/01_basic.spec.ts @@ -1,5 +1,6 @@ -import { MetaMask, metaMaskFixtures, testWithSynpress } from '@synthetixio/synpress' -import basicSetup from '../wallet-setup/basic.setup' +import { testWithSynpress } from '@synthetixio/synpress' +import { MetaMask, metaMaskFixtures } from '@synthetixio/synpress/playwright' +import basicSetup from './wallet-setup/basic.setup' const test = testWithSynpress(metaMaskFixtures(basicSetup)) diff --git a/examples/new-dawn/test/e2e/02_simple.spec.ts b/examples/new-dawn/test/playwright/02_simple.spec.ts similarity index 97% rename from examples/new-dawn/test/e2e/02_simple.spec.ts rename to examples/new-dawn/test/playwright/02_simple.spec.ts index 283d9f92e..312ad9b6d 100644 --- a/examples/new-dawn/test/e2e/02_simple.spec.ts +++ b/examples/new-dawn/test/playwright/02_simple.spec.ts @@ -1,4 +1,4 @@ -import synpress from '../synpress' +import synpress from './synpress' const test = synpress diff --git a/examples/new-dawn/test/e2e/03_advanced.spec.ts b/examples/new-dawn/test/playwright/03_advanced.spec.ts similarity index 96% rename from examples/new-dawn/test/e2e/03_advanced.spec.ts rename to examples/new-dawn/test/playwright/03_advanced.spec.ts index 570cdebf7..13eb92dfc 100644 --- a/examples/new-dawn/test/e2e/03_advanced.spec.ts +++ b/examples/new-dawn/test/playwright/03_advanced.spec.ts @@ -1,4 +1,4 @@ -import { test as advancedFixtures } from '../advancedFixtures' +import { test as advancedFixtures } from './advancedFixtures' import { testWithSynpress } from '@synthetixio/synpress' diff --git a/examples/new-dawn/test/advancedFixtures.ts b/examples/new-dawn/test/playwright/advancedFixtures.ts similarity index 94% rename from examples/new-dawn/test/advancedFixtures.ts rename to examples/new-dawn/test/playwright/advancedFixtures.ts index f68952ba5..88026f2cb 100644 --- a/examples/new-dawn/test/advancedFixtures.ts +++ b/examples/new-dawn/test/playwright/advancedFixtures.ts @@ -1,4 +1,4 @@ -import { metaMaskFixtures } from '@synthetixio/synpress' +import { metaMaskFixtures } from '@synthetixio/synpress/playwright' import connectedSetup from './wallet-setup/connected.setup' export const test = metaMaskFixtures(connectedSetup).extend<{ diff --git a/examples/new-dawn/test/synpress.ts b/examples/new-dawn/test/playwright/synpress.ts similarity index 50% rename from examples/new-dawn/test/synpress.ts rename to examples/new-dawn/test/playwright/synpress.ts index 954746f17..9a4bee138 100644 --- a/examples/new-dawn/test/synpress.ts +++ b/examples/new-dawn/test/playwright/synpress.ts @@ -1,4 +1,5 @@ -import { metaMaskFixtures, testWithSynpress } from '@synthetixio/synpress' +import { testWithSynpress } from '@synthetixio/synpress' +import { metaMaskFixtures } from '@synthetixio/synpress/playwright' import connectedSetup from './wallet-setup/connected.setup' export default testWithSynpress(metaMaskFixtures(connectedSetup)) diff --git a/examples/new-dawn/test/wallet-setup/basic.setup.ts b/examples/new-dawn/test/playwright/wallet-setup/basic.setup.ts similarity index 72% rename from examples/new-dawn/test/wallet-setup/basic.setup.ts rename to examples/new-dawn/test/playwright/wallet-setup/basic.setup.ts index 2886b28e1..1790294f0 100644 --- a/examples/new-dawn/test/wallet-setup/basic.setup.ts +++ b/examples/new-dawn/test/playwright/wallet-setup/basic.setup.ts @@ -1,4 +1,5 @@ -import { MetaMask, defineWalletSetup } from '@synthetixio/synpress' +import { defineWalletSetup } from '@synthetixio/synpress' +import { MetaMask } from '@synthetixio/synpress/playwright' const SEED_PHRASE = 'test test test test test test test test test test test junk' const PASSWORD = 'SynpressIsAwesomeNow!!!' diff --git a/examples/new-dawn/test/wallet-setup/connected.setup.ts b/examples/new-dawn/test/playwright/wallet-setup/connected.setup.ts similarity index 84% rename from examples/new-dawn/test/wallet-setup/connected.setup.ts rename to examples/new-dawn/test/playwright/wallet-setup/connected.setup.ts index f74c2080f..ec58c3176 100644 --- a/examples/new-dawn/test/wallet-setup/connected.setup.ts +++ b/examples/new-dawn/test/playwright/wallet-setup/connected.setup.ts @@ -1,4 +1,5 @@ -import { MetaMask, defineWalletSetup, getExtensionId } from '@synthetixio/synpress' +import { defineWalletSetup } from '@synthetixio/synpress' +import { MetaMask, getExtensionId } from '@synthetixio/synpress/playwright' import 'dotenv/config' const SEED_PHRASE = process.env.SEED_PHRASE diff --git a/release/package.json b/release/package.json index 61888fcf7..9e83eeee6 100644 --- a/release/package.json +++ b/release/package.json @@ -3,11 +3,19 @@ "version": "4.0.0-alpha.7", "type": "module", "exports": { - "types": "./types/index.d.ts", - "default": "./dist/index.js" + ".": { + "default": "./dist/index.js", + "types": "./types/index.d.ts" + }, + "./cypress": { + "types": "./types/cypress/index.d.ts", + "default": "./dist/cypress/index.js" + }, + "./playwright": { + "types": "./types/playwright/index.d.ts", + "default": "./dist/playwright/index.js" + } }, - "main": "./dist/index.js", - "types": "./types/index.d.ts", "bin": "./dist/cli.js", "files": [ "dist", diff --git a/release/src/cypress/index.ts b/release/src/cypress/index.ts new file mode 100644 index 000000000..0366851cb --- /dev/null +++ b/release/src/cypress/index.ts @@ -0,0 +1 @@ +export * from '@synthetixio/ethereum-wallet-mock/cypress' diff --git a/release/src/index.ts b/release/src/index.ts index 27c84cf48..9cfff4f26 100644 --- a/release/src/index.ts +++ b/release/src/index.ts @@ -1,17 +1,8 @@ -import { EthereumWalletMock, ethereumWalletMockFixtures } from '@synthetixio/ethereum-wallet-mock' import { defineWalletSetup } from '@synthetixio/synpress-cache' import { testWithSynpress } from '@synthetixio/synpress-core' -import { MetaMask, getExtensionId, metaMaskFixtures } from '@synthetixio/synpress-metamask' export { - // Framework fixtures testWithSynpress, - ethereumWalletMockFixtures, - metaMaskFixtures, - // API - MetaMask, - EthereumWalletMock, // Helpers - defineWalletSetup, - getExtensionId + defineWalletSetup } diff --git a/release/src/playwright/index.ts b/release/src/playwright/index.ts new file mode 100644 index 000000000..e4ac6235e --- /dev/null +++ b/release/src/playwright/index.ts @@ -0,0 +1,2 @@ +export * from '@synthetixio/ethereum-wallet-mock/playwright' +export { MetaMask, getExtensionId, metaMaskFixtures } from '@synthetixio/synpress-metamask' diff --git a/release/tsconfig.json b/release/tsconfig.json index 8ad5db0e8..110c9ad4c 100644 --- a/release/tsconfig.json +++ b/release/tsconfig.json @@ -7,5 +7,5 @@ "sourceMap": false, "declarationMap": true }, - "include": ["src/index.ts"] + "include": ["src"] } diff --git a/release/tsup.config.ts b/release/tsup.config.ts index 03e5ac0fe..be0fcfe21 100644 --- a/release/tsup.config.ts +++ b/release/tsup.config.ts @@ -2,7 +2,7 @@ import { defineConfig } from 'tsup' export default defineConfig({ name: 'synpress', - entry: ['src/index.ts', 'src/cli.ts'], + entry: ['src/index.ts', 'src/cli.ts', 'src/cypress/index.ts', 'src/playwright/index.ts'], outDir: 'dist', format: 'esm', splitting: false, diff --git a/wallets/ethereum-wallet-mock/package.json b/wallets/ethereum-wallet-mock/package.json index d51116ad3..feca49d86 100644 --- a/wallets/ethereum-wallet-mock/package.json +++ b/wallets/ethereum-wallet-mock/package.json @@ -3,11 +3,15 @@ "version": "0.0.1-alpha.7", "type": "module", "exports": { - "types": "./types/index.d.ts", - "default": "./dist/index.js" + "./cypress": { + "types": "./types/cypress/index.d.ts", + "default": "./dist/cypress/index.js" + }, + "./playwright": { + "types": "./types/playwright/index.d.ts", + "default": "./dist/playwright/index.js" + } }, - "main": "./dist/index.js", - "types": "./types/index.d.ts", "files": [ "dist", "src", diff --git a/wallets/ethereum-wallet-mock/src/index.ts b/wallets/ethereum-wallet-mock/src/index.ts index 24e2d27cc..e69de29bb 100644 --- a/wallets/ethereum-wallet-mock/src/index.ts +++ b/wallets/ethereum-wallet-mock/src/index.ts @@ -1,3 +0,0 @@ -export { default as EthereumWalletMock } from './playwright/EthereumWalletMock' -export * from './playwright/utils' -export * from './playwright/fixtures/ethereumWalletMockFixtures' diff --git a/wallets/ethereum-wallet-mock/src/playwright/index.ts b/wallets/ethereum-wallet-mock/src/playwright/index.ts index 320f5f6d5..62808819c 100644 --- a/wallets/ethereum-wallet-mock/src/playwright/index.ts +++ b/wallets/ethereum-wallet-mock/src/playwright/index.ts @@ -1,2 +1,3 @@ export { default as EthereumWalletMock } from './EthereumWalletMock' -export { default as synpress } from './synpress' +export * from './utils' +export * from './fixtures/ethereumWalletMockFixtures' diff --git a/wallets/ethereum-wallet-mock/src/playwright/synpress.ts b/wallets/ethereum-wallet-mock/src/playwright/synpress.ts index f54d1ce1b..3e726d79a 100644 --- a/wallets/ethereum-wallet-mock/src/playwright/synpress.ts +++ b/wallets/ethereum-wallet-mock/src/playwright/synpress.ts @@ -1,4 +1,4 @@ import { testWithSynpress } from '@synthetixio/synpress-core' -import { ethereumWalletMockFixtures } from '../index' +import { ethereumWalletMockFixtures } from '.' export default testWithSynpress(ethereumWalletMockFixtures) diff --git a/wallets/ethereum-wallet-mock/tsup.config.ts b/wallets/ethereum-wallet-mock/tsup.config.ts index a7e4c2978..466b3c680 100644 --- a/wallets/ethereum-wallet-mock/tsup.config.ts +++ b/wallets/ethereum-wallet-mock/tsup.config.ts @@ -2,7 +2,7 @@ import { defineConfig } from 'tsup' export default defineConfig({ name: 'ethereum-wallet-mock', - entry: ['src/index.ts'], + entry: ['src/index.ts', 'src/playwright/index.ts', 'src/cypress/index.ts'], outDir: 'dist', format: 'esm', splitting: false,