-
Notifications
You must be signed in to change notification settings - Fork 9
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
6 changed files
with
119 additions
and
32 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,39 @@ | ||
# NOTE: This name appears in GitHub's Checks API and in workflow's status badge. | ||
name: ci-playwright | ||
|
||
# Trigger the workflow when: | ||
on: | ||
# A push occurs to one of the matched branches. | ||
push: | ||
branches: [master] | ||
# Or when a pull request event occurs for a pull request against one of the | ||
# matched branches. | ||
pull_request: | ||
branches: [master] | ||
|
||
jobs: | ||
playwright: | ||
# NOTE: This name appears in GitHub's Checks API. | ||
name: playwright | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Set up Node.js 20 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20.x' | ||
cache: yarn | ||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
- name: Run dev server | ||
run: yarn start & | ||
- name: Install playwright | ||
run: yarn install --frozen-lockfile | ||
working-directory: playwright | ||
- name: Install playwright dependencies | ||
run: yarn playwright install --with-deps | ||
working-directory: playwright | ||
- name: Run playwright tests | ||
run: yarn playwright test --browser all | ||
working-directory: playwright |
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 |
---|---|---|
@@ -1 +1,5 @@ | ||
{} | ||
{ | ||
"devDependencies": { | ||
"@playwright/test": "^1.36.2" | ||
} | ||
} |
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,47 @@ | ||
import { expect, test } from '@playwright/test' | ||
import { RuntimeAccount } from '../../src/oasis-nexus/api' | ||
|
||
test('getPreciseNumberFormat', async ({ page }) => { | ||
await page.route( | ||
'https://api.coingecko.com/api/v3/simple/price?ids=oasis-network&vs_currencies=usd', | ||
route => { | ||
// Don't respond | ||
}, | ||
) | ||
await page.route('**/v1/', route => { | ||
// Don't respond | ||
}) | ||
await page.route('**/v1/sapphire/status', route => { | ||
// Don't respond | ||
}) | ||
|
||
await page.route('**/v1/sapphire/accounts/oasis1qq2v39p9fqk997vk6742axrzqyu9v2ncyuqt8uek', route => { | ||
route.fulfill({ | ||
body: JSON.stringify({ | ||
address: 'oasis1qq2v39p9fqk997vk6742axrzqyu9v2ncyuqt8uek', | ||
address_preimage: { | ||
address_data: 'AAAAAAAAAAAAAAAAAAAAAAAAAAA=', | ||
context: 'oasis-runtime-sdk/address: secp256k1eth', | ||
context_version: 0, | ||
}, | ||
balances: [], | ||
evm_balances: [], | ||
stats: { | ||
num_txns: 0, | ||
total_received: '111222333444555666777888999111222333444555666', | ||
total_sent: '0', | ||
}, | ||
} satisfies Partial<RuntimeAccount>), | ||
}) | ||
}) | ||
|
||
await page.goto( | ||
'http://localhost:1234/mainnet/sapphire/address/0x0000000000000000000000000000000000000000/tokens/erc-20#tokens', | ||
) | ||
await expect( | ||
page | ||
.getByText('111,222,333,444,555,666,777,888,999.111222333444555666') | ||
// Expect precise fallback when browser doesn't support precise formatting | ||
.or(page.getByText('111222333444555666777888999.111222333444555666')), | ||
).toBeVisible() | ||
}) |
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,28 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|
||
"@playwright/test@^1.36.2": | ||
version "1.36.2" | ||
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.36.2.tgz#9edd68a02b0929c5d78d9479a654ceb981dfb592" | ||
integrity sha512-2rVZeyPRjxfPH6J0oGJqE8YxiM1IBRyM8hyrXYK7eSiAqmbNhxwcLa7dZ7fy9Kj26V7FYia5fh9XJRq4Dqme+g== | ||
dependencies: | ||
"@types/node" "*" | ||
playwright-core "1.36.2" | ||
optionalDependencies: | ||
fsevents "2.3.2" | ||
|
||
"@types/node@*": | ||
version "20.4.5" | ||
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.4.5.tgz#9dc0a5cb1ccce4f7a731660935ab70b9c00a5d69" | ||
integrity sha512-rt40Nk13II9JwQBdeYqmbn2Q6IVTA5uPhvSO+JVqdXw/6/4glI6oR9ezty/A9Hg5u7JH4OmYmuQ+XvjKm0Datg== | ||
|
||
[email protected]: | ||
version "2.3.2" | ||
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" | ||
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== | ||
|
||
[email protected]: | ||
version "1.36.2" | ||
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.36.2.tgz#32382f2d96764c24c65a86ea336cf79721c2e50e" | ||
integrity sha512-sQYZt31dwkqxOrP7xy2ggDfEzUxM1lodjhsQ3NMMv5uGTRDsLxU0e4xf4wwMkF2gplIxf17QMBCodSFgm6bFVQ== |