-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui-tests): scaffolds basic test (#388)
- Loading branch information
Showing
21 changed files
with
385 additions
and
174 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,44 @@ | ||
name: Playwright Tests | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
concurrency: | ||
# Support push/pr as event types with different behaviors each: | ||
# 1. push: queue up builds | ||
# 2. pr: only allow one run per PR | ||
group: ${{ github.workflow }}-${{ github.event.type }}${{ github.event.pull_request.number }} | ||
# If there is already a workflow running for the same pull request, cancel it | ||
cancel-in-progress: ${{ github.event_name == 'pull_request' }} | ||
jobs: | ||
test: | ||
timeout-minutes: 10 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- name: Install dependencies | ||
run: yarn | ||
- name: Install Playwright Browsers | ||
run: yarn playwright:install | ||
- name: Run Playwright tests | ||
run: yarn playwright:test | ||
env: | ||
VITE_PROJECT_ID: ${{ secrets.VITE_DEV_PROJECT_ID }} | ||
VITE_EXPLORER_API_URL: ${{ secrets.VITE_EXPLORER_API_URL }} | ||
VITE_CI: true | ||
- uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 7 | ||
- uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: test-results | ||
path: test-results/ | ||
retention-days: 7 |
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
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
27 changes: 0 additions & 27 deletions
27
src/components/settings/PrivacySettings/PrivacySettings.scss
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 @@ | ||
export const isCI = import.meta.env.VITE_CI === 'true' |
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,20 @@ | ||
# Functional Tests | ||
|
||
We use Playwright as our functional test runner. It's configured to try multiple permutations: | ||
|
||
- Browsers: Chromium/Firefox | ||
|
||
## Running Tests | ||
|
||
- `npx playwright test` to run in default mode (make sure your `.env` is set up) | ||
- `npm run playwright:debug` to step by step see what the tests are doing | ||
|
||
## Debugging | ||
|
||
For scenarios when tests pass locally but not remotely you can `await this.page.screenshot({ path: './screenshots/wallet.png' })` and the screenshot will be uploaded to GitHub Actions. | ||
|
||
## Running from GitHub Actions | ||
|
||
These tests can be run from GitHub Actions both from this and other repositories. | ||
|
||
You can tweak what's under test by setting the `BASE_URL` and `WALLET_URL` (default 'https://react-wallet.walletconnect.com/') environment variables. |
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,10 @@ | ||
import type { SessionParams } from '../types' | ||
|
||
// Allow localhost | ||
export const BASE_URL = process.env['BASE_URL'] || 'http://localhost:5173/' | ||
export const WALLET_URL = process.env['WALLET_URL'] || 'https://react-wallet.walletconnect.com/' | ||
export const DEFAULT_SESSION_PARAMS: SessionParams = { | ||
reqAccounts: ['1', '2'], | ||
optAccounts: ['1', '2'], | ||
accept: true | ||
} |
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,24 @@ | ||
import { test as base } from '@playwright/test' | ||
|
||
import { ModalPage } from '../pages/InboxPage' | ||
import { ModalValidator } from '../validators/ModalValidator' | ||
|
||
// Declare the types of fixtures to use | ||
export interface ModalFixture { | ||
modalPage: ModalPage | ||
modalValidator: ModalValidator | ||
library: string | ||
} | ||
|
||
export const test = base.extend<ModalFixture>({ | ||
modalPage: async ({ page }, use) => { | ||
const modalPage = new ModalPage(page) | ||
await modalPage.load() | ||
await use(modalPage) | ||
}, | ||
modalValidator: async ({ modalPage }, use) => { | ||
const modalValidator = new ModalValidator(modalPage.page) | ||
await use(modalValidator) | ||
} | ||
}) | ||
export { expect } from '@playwright/test' |
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,28 @@ | ||
import { WalletPage } from '../pages/WalletPage' | ||
import { WalletValidator } from '../validators/WalletValidator' | ||
import { test as base } from './fixture' | ||
|
||
// Declare the types of fixtures to use | ||
interface ModalWalletFixture { | ||
walletPage: WalletPage | ||
walletValidator: WalletValidator | ||
} | ||
|
||
export const testWallet = base.extend<ModalWalletFixture>({ | ||
walletPage: async ({ context, browserName }, use) => { | ||
// WalletPage needs clipboard permissions with chromium to paste URI | ||
if (browserName === 'chromium') { | ||
await context.grantPermissions(['clipboard-read', 'clipboard-write']) | ||
} | ||
|
||
// Use a new page, to open alongside the modal | ||
const walletPage = new WalletPage(await context.newPage()) | ||
await walletPage.load() | ||
await use(walletPage) | ||
}, | ||
walletValidator: async ({ walletPage }, use) => { | ||
const walletValidator = new WalletValidator(walletPage.page) | ||
await use(walletValidator) | ||
} | ||
}) | ||
export { expect } from '@playwright/test' |
Oops, something went wrong.
663184c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
app-web3inbox – ./
web3inbox-dev-hidden.vercel.app
app-web3inbox-git-main-walletconnect1.vercel.app
app-web3inbox-walletconnect1.vercel.app
app.web3inbox.com