-
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.
- Loading branch information
Showing
11 changed files
with
138 additions
and
219 deletions.
There are no files selected for viewing
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,29 @@ | ||
name: Playwright Tests | ||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
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 }} | ||
- uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 30 |
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
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,25 @@ | ||
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>({ | ||
library: ['wagmi', { option: true }], | ||
modalPage: async ({ page, library }, 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 was deleted.
Oops, something went wrong.
22 changes: 2 additions & 20 deletions
22
tests/shared/fixtures/w3m-wallet-fixture.ts → tests/shared/fixtures/wallet-fixture.ts
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,58 @@ | ||
import type { Locator, Page } from '@playwright/test' | ||
|
||
import { BASE_URL } from '../constants' | ||
|
||
export class ModalPage { | ||
private readonly baseURL = BASE_URL | ||
|
||
private readonly connectButton: Locator | ||
|
||
constructor(public readonly page: Page) { | ||
this.connectButton = this.page.getByRole('button', { name: 'Connect Wallet' }) | ||
} | ||
|
||
async load() { | ||
await this.page.goto(this.baseURL) | ||
} | ||
|
||
async copyConnectUriToClipboard() { | ||
await this.page.goto(this.baseURL) | ||
await this.connectButton.click() | ||
await this.page.getByTestId('wallet-selector-walletconnect').click() | ||
await this.page.waitForTimeout(2000) | ||
await this.page.getByTestId('copy-wc2-uri').click() | ||
} | ||
|
||
async disconnect() { | ||
await this.page.getByTestId('account-button').click() | ||
await this.page.getByTestId('disconnect-button').click() | ||
} | ||
|
||
async promptSiwe() { | ||
await this.page.getByRole('button', { name: 'Sign in with wallet' }).click() | ||
} | ||
|
||
async subscribe(nth: number) { | ||
await this.page.locator('.AppCard__body > .AppCard__body__subscribe').nth(nth).click() | ||
} | ||
|
||
async unsubscribe() { | ||
await this.page.getByRole('button', { name: 'Subscribed' }).click() | ||
await this.page.getByRole('button', { name: 'Subscribed' }).isHidden() | ||
await this.page.getByRole('button').first().click() | ||
await this.page.getByRole('button', { name: 'Unsubscribe' }).click() | ||
await this.page.getByRole('button', { name: 'Unsubscribe' }).nth(1).click() | ||
await this.page.waitForTimeout(2000) | ||
} | ||
|
||
async cancelSiwe() { | ||
await this.page.getByTestId('w3m-connecting-siwe-cancel').click() | ||
} | ||
|
||
async switchNetwork(network: string) { | ||
await this.page.getByTestId('account-button').click() | ||
await this.page.getByTestId('w3m-account-select-network').click() | ||
await this.page.getByTestId(`w3m-network-switch-${network}`).click() | ||
await this.page.getByTestId(`w3m-header-close`).click() | ||
} | ||
} |
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
Oops, something went wrong.