Skip to content

Commit

Permalink
🏗️ chore: Parallel exports for Playwright & Cypress (#1149)
Browse files Browse the repository at this point in the history
* 🏗️ chore: Parallel exports for Playwright & Cypress

* fix: cleanup
  • Loading branch information
matstyler authored Jun 19, 2024
1 parent 4d856a4 commit df5b9aa
Show file tree
Hide file tree
Showing 20 changed files with 45 additions and 36 deletions.
2 changes: 1 addition & 1 deletion examples/new-dawn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
Original file line number Diff line number Diff line change
@@ -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))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import synpress from '../synpress'
import synpress from './synpress'

const test = synpress

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test as advancedFixtures } from '../advancedFixtures'
import { test as advancedFixtures } from './advancedFixtures'

import { testWithSynpress } from '@synthetixio/synpress'

Expand Down
Original file line number Diff line number Diff line change
@@ -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<{
Expand Down
Original file line number Diff line number Diff line change
@@ -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))
Original file line number Diff line number Diff line change
@@ -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!!!'
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 12 additions & 4 deletions release/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions release/src/cypress/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@synthetixio/ethereum-wallet-mock/cypress'
11 changes: 1 addition & 10 deletions release/src/index.ts
Original file line number Diff line number Diff line change
@@ -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
}
2 changes: 2 additions & 0 deletions release/src/playwright/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from '@synthetixio/ethereum-wallet-mock/playwright'
export { MetaMask, getExtensionId, metaMaskFixtures } from '@synthetixio/synpress-metamask'
2 changes: 1 addition & 1 deletion release/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"sourceMap": false,
"declarationMap": true
},
"include": ["src/index.ts"]
"include": ["src"]
}
2 changes: 1 addition & 1 deletion release/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 8 additions & 4 deletions wallets/ethereum-wallet-mock/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 0 additions & 3 deletions wallets/ethereum-wallet-mock/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
export { default as EthereumWalletMock } from './playwright/EthereumWalletMock'
export * from './playwright/utils'
export * from './playwright/fixtures/ethereumWalletMockFixtures'
3 changes: 2 additions & 1 deletion wallets/ethereum-wallet-mock/src/playwright/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export { default as EthereumWalletMock } from './EthereumWalletMock'
export { default as synpress } from './synpress'
export * from './utils'
export * from './fixtures/ethereumWalletMockFixtures'
2 changes: 1 addition & 1 deletion wallets/ethereum-wallet-mock/src/playwright/synpress.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { testWithSynpress } from '@synthetixio/synpress-core'
import { ethereumWalletMockFixtures } from '../index'
import { ethereumWalletMockFixtures } from '.'

export default testWithSynpress(ethereumWalletMockFixtures)
2 changes: 1 addition & 1 deletion wallets/ethereum-wallet-mock/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit df5b9aa

Please sign in to comment.