Skip to content

Commit

Permalink
fix: imports
Browse files Browse the repository at this point in the history
  • Loading branch information
matstyler committed Oct 1, 2024
1 parent 9a6d448 commit 8283b3a
Show file tree
Hide file tree
Showing 1,066 changed files with 338,821 additions and 29 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions examples/ethereum-wallet-mock/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { configureSynpressForEthereumWalletMock } from '@synthetixio/synpress/cypress'
import { defineConfig } from 'cypress'

export default defineConfig({
chromeWebSecurity: false,
e2e: {
baseUrl: 'http://localhost:9999',
specPattern: 'test/cypress/**/*.cy.{js,jsx,ts,tsx}',
supportFile: 'src/cypress/support/e2e.{js,jsx,ts,tsx}',
testIsolation: false,
async setupNodeEvents(on, config) {
return configureSynpressForEthereumWalletMock(on, config)
}
}
})
File renamed without changes.
25 changes: 25 additions & 0 deletions examples/ethereum-wallet-mock/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "@examples/ethereum-wallet-mock",
"version": "0.0.1-alpha.9",
"private": true,
"type": "module",
"scripts": {
"build:cache": "synpress",
"build:cache:force": "synpress --force",
"build:cache:headless": "synpress --headless",
"serve:test-dapp": "serve node_modules/@metamask/test-dapp/dist -p 9999",
"test:cypress:headful": "cypress run --browser chrome --headed"
},
"dependencies": {
"@synthetixio/synpress": "workspace:*",
"dotenv": "16.4.2"
},
"devDependencies": {
"@metamask/test-dapp": "8.1.0",
"@synthetixio/synpress-tsconfig": "0.0.1-alpha.9",
"@types/node": "20.11.17",
"cypress": "13.13.0",
"serve": "14.2.1",
"typescript": "5.3.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// ***********************************************************

// Import commands.js using ES2015 syntax:
import { mockEthereum, synpressCommandsForEthereumWalletMock } from '@synthetixio/synpress/cypress'
import { synpressCommandsForEthereumWalletMock, mockEthereum } from '@synthetixio/synpress/cypress/support'

synpressCommandsForEthereumWalletMock()
mockEthereum()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"skipLibCheck": true,
"types": ["cypress"]
},
"include": ["test"],
"include": ["cypress.config.ts", "test", "src"],
"files": ["environment.d.ts"]
}
2 changes: 2 additions & 0 deletions examples/metamask/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SEED_PHRASE="test test test test test test test test test test test junk"
WALLET_PASSWORD="SynpressIsAwesomeNow!!!"
70 changes: 70 additions & 0 deletions examples/metamask/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# example-new-dawn

## 0.0.1-alpha.9

### Patch Changes

- Alpha Release
- Updated dependencies
- @synthetixio/synpress@4.0.0-alpha.9

## 0.0.1-alpha.8

### Patch Changes

- Alpha Release
- Updated dependencies
- @synthetixio/synpress@4.0.0-alpha.8

## 0.0.1-alpha.7

### Patch Changes

- Alpha Release
- Updated dependencies
- @synthetixio/synpress@4.0.0-alpha.7

## 0.0.1-alpha.6

### Patch Changes

- Alpha Release
- Updated dependencies
- @synthetixio/synpress@4.0.0-alpha.6

## 0.0.1-alpha.5

### Patch Changes

- Alpha Release
- Updated dependencies
- @synthetixio/synpress@4.0.0-alpha.5

## 0.0.1-alpha.4

### Patch Changes

- Alpha Release
- Updated dependencies
- @synthetixio/synpress@4.0.0-alpha.4

## 0.0.1-alpha.2

### Patch Changes

- Updated dependencies
- @synthetixio/synpress@4.0.0-alpha.3

## 0.0.1-alpha.1

### Patch Changes

- Updated dependencies
- @synthetixio/synpress@4.0.0-alpha.2

## 0.0.1-alpha.0

### Patch Changes

- Updated dependencies
- @synthetixio/synpress@4.0.0-alpha.1
87 changes: 87 additions & 0 deletions examples/metamask/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<h1 align="center">
Synpress: New Dawn
<br>
<small>⭐ Example Project ⭐</small>
</h1>

# 📖 Intro

The New Dawn version of Synpress differs in one major way from all previous versions and all other similar Web3 tools:

- 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).
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
utilizes the setup files from `test/wallet-setup` directory.
Try running it with the `--help` flag to see all available configuration options.

Here's how to use it:

```bash
# Build cache in a headed mode:
synpress

# Build cache in a headless mode:
synpress --headless
```

# 🧑‍💻 Usage

1. Install dependencies:

```bash
pnpm install
```

2. Start MetaMask Test Dapp:

```bash
pnpm run serve:test-dapp
```

3. Install Playwright:

```bash
pnpm exec playwright install
```

*3a. If you do not have Anvil installed, go to
the [Foundry installation guide](https://book.getfoundry.sh/getting-started/installation#installation)* and follow the
instructions.

4. Build cache with our CLI by using a script:

```bash
# You can either build cache in a headed mode:
pnpm run build:cache

# Or in a headless mode:
pnpm run build:cache:headless
```

5. Run Playwright tests as you would normally do:

```bash
# Use one of our scripts:
pnpm run test:playwright:headful
pnpm run test:playwright:headless
pnpm run test:playwright:headless:ui

# Or use Playwright directly:
playwright test
HEADLESS=true playwright test
HEADLESS=true playwright test --ui
```

### ⚠️ Important note ⚠️

Currently, tests are triggered in a headed mode by default. Add `HEADLESS=true` to run them in a headless mode.

This behavior will change soon! 🫡

# 🤔 Still want more?

If you need more than this example project, check out our tests for MetaMask [here](../../wallets/metamask/test/e2e).
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { configureSynpress } from '@synthetixio/synpress/cypress'
import { configureSynpressForMetaMask } from '@synthetixio/synpress/cypress'
import { defineConfig } from 'cypress'

export default defineConfig({
chromeWebSecurity: false,
e2e: {
baseUrl: 'http://localhost:9999',
specPattern: 'test/cypress/**/*.cy.{js,jsx,ts,tsx}',
supportFile: 'test/cypress/support/e2e.{js,jsx,ts,tsx}',
supportFile: 'src/cypress/support/e2e.{js,jsx,ts,tsx}',
testIsolation: false,
async setupNodeEvents(on, config) {
return configureSynpress(on, config)
return configureSynpressForMetaMask(on, config)
}
}
})
Binary file not shown.
Loading

0 comments on commit 8283b3a

Please sign in to comment.