-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ui-tests): scaffolds basic test #388
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
93fe4cc
feat(ui-tests): scaffolds basic test
arein 0d678fd
feat: tests
arein 5bafc9a
feat: tests
arein b32846f
feat: tests
arein 1ff8bc7
feat: tests
arein b0e8025
feat: tests
arein 7f58493
feat: tests
arein 48b54a9
feat: tests
arein 67cd9d8
feat: tests
arein bc92ed9
chore: udpdate dependencies
arein 8eb4c8b
feat: improve speed
arein 19ef7dd
feat: reset yarn
arein ff47a7e
refactor: tests (#413)
enesozturk a9af335
chore: remove dotenv
arein 46ddb77
chore: fix yarn lock in tests (#414)
devceline File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think we can avoid this flag by granting the
notification
permission. Also we'll need to test these states anyway so this will have to change.