-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #128 from zkBob/staging
Version 1.1.0
- Loading branch information
Showing
75 changed files
with
3,654 additions
and
194 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,65 @@ | ||
name: E2E tests | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
staging | ||
push: | ||
branches: | ||
e2e-tests | ||
|
||
env: | ||
ENV: local | ||
jobs: | ||
test: | ||
name: E2E tests | ||
runs-on: ubuntu-latest | ||
env: | ||
BASE_URL: ${{ secrets.BASE_URL }} | ||
ZKACCOUNT_PASSWORD: ${{ secrets.ZKACCOUNT_PASSWORD }} | ||
ZKACCOUNT_SEED_PHRASE: ${{ secrets.ZKACCOUNT_SEED_PHRASE }} | ||
ZKBOB_RECEIVER_ADDRESS: ${{ secrets.ZKBOB_RECEIVER_ADDRESS }} | ||
METAMASK_PASSWORD: ${{ secrets.METAMASK_PASSWORD }} | ||
METAMASK_SEED_PHRASE: ${{ secrets.METAMASK_SEED_PHRASE }} | ||
ADDRESS_METAMASK_ACCOUNT: ${{ secrets.ADDRESS_METAMASK_ACCOUNT }} | ||
steps: | ||
- name: Check out this repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: v14.17.0 | ||
|
||
- name: Install Playwright | ||
run: | | ||
cd e2e-ci-cd/ | ||
npm install --global yarn | ||
yarn | ||
npx playwright install | ||
- name: Create account | ||
run: | | ||
cd e2e-ci-cd/ && xvfb-run yarn test zkaccount.test.ts | ||
- name: Deposit | ||
if: always() | ||
run: | | ||
cd e2e-ci-cd/ && xvfb-run yarn test deposit.test.ts | ||
- name: Transfer | ||
if: always() | ||
run: | | ||
cd e2e-ci-cd/ && xvfb-run yarn test transfer.test.ts | ||
- name: Withdraw | ||
if: always() | ||
run: | | ||
cd e2e-ci-cd/ && xvfb-run yarn test withdraw.test.ts | ||
- uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: report | ||
path: e2e-ci-cd/test-results/ | ||
|
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,45 @@ | ||
lib-cov | ||
*.seed | ||
*.log | ||
*.csv | ||
*.dat | ||
*.out | ||
*.pid | ||
*.gz | ||
*.swp | ||
|
||
pids | ||
logs | ||
results | ||
tmp | ||
|
||
# Build | ||
public/css/main.css | ||
|
||
# Coverage reports | ||
coverage | ||
|
||
# API keys and secrets | ||
.env | ||
.env.local | ||
|
||
|
||
# Dependency directory | ||
node_modules | ||
bower_components | ||
|
||
# Editors | ||
.idea | ||
*.iml | ||
|
||
# OS metadata | ||
.DS_Store | ||
Thumbs.db | ||
|
||
# ignore yarn.lock | ||
yarn.lock | ||
|
||
test-results/ | ||
tmp/ | ||
dist/metamask/** | ||
playwright-report/ |
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 @@ | ||
### E2E UI TESTS | ||
|
||
Install dependencies: | ||
``` | ||
npm install --global yarn | ||
yarn | ||
``` | ||
|
||
Create `.env.local` file : | ||
``` | ||
BASE_URL="" | ||
ZKACCOUNT_PASSWORD="" | ||
ZKACCOUNT_SEED_PHRASE="" | ||
ZKBOB_RECEIVER_ADDRESS = "" | ||
METAMASK_PASSWORD = "" | ||
METAMASK_SEED_PHRASE = "" | ||
ADDRESS_METAMASK_ACCOUNT = "" | ||
``` | ||
Run: | ||
``` | ||
yarn 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,18 @@ | ||
import { test } from '../fixtures/testContextFixture'; | ||
|
||
test.beforeEach(async ({metamask, zkAccount}) => { | ||
await metamask.importWallet() | ||
await zkAccount.open('/') | ||
await zkAccount.button_zkAccount() | ||
await zkAccount.button_Agree() | ||
await zkAccount.ConnectMetaMaskWallet() | ||
await zkAccount.GenerateKey() | ||
await zkAccount.CreatePassword() | ||
await zkAccount.CheckAccount() | ||
}); | ||
|
||
|
||
|
||
test('Deposit', async({OperationsWithToken}) => { | ||
await OperationsWithToken.Deposit() | ||
}) |
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,7 @@ | ||
import { test } from '../fixtures/testContextFixture'; | ||
|
||
test('Import wallet', async ({app, metamask}) => { | ||
await metamask.importWallet() | ||
await app.open('/') | ||
await app.connectMetamask() | ||
}); |
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 { test } from '../fixtures/testContextFixture'; | ||
|
||
test.beforeEach(async ({metamask, zkAccount}) => { | ||
await metamask.importWallet() | ||
await zkAccount.open('/') | ||
await zkAccount.button_zkAccount() | ||
await zkAccount.button_Agree() | ||
await zkAccount.ConnectMetaMaskWallet() | ||
await zkAccount.GenerateKey() | ||
await zkAccount.CreatePassword() | ||
await zkAccount.CheckAccount() | ||
}); | ||
|
||
|
||
|
||
test('Deposit', async({OperationsWithToken}) => { | ||
await OperationsWithToken.Deposit() | ||
}) | ||
|
||
test('Transfer', async({OperationsWithToken}) => { | ||
await OperationsWithToken.Transfer() | ||
await OperationsWithToken.CheckTransfer() | ||
}) | ||
|
||
test('Withdraw', async ({OperationsWithToken}) => { | ||
await OperationsWithToken.Withdraw() | ||
}) | ||
|
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,17 @@ | ||
import { test } from '../fixtures/testContextFixture'; | ||
|
||
test.beforeEach(async ({metamask, zkAccount}) => { | ||
await metamask.importWallet() | ||
await zkAccount.open('/') | ||
await zkAccount.button_zkAccount() | ||
await zkAccount.button_Agree() | ||
await zkAccount.ConnectMetaMaskWallet() | ||
await zkAccount.GenerateKey() | ||
await zkAccount.CreatePassword() | ||
await zkAccount.CheckAccount() | ||
}); | ||
|
||
test('Transfer', async({OperationsWithToken}) => { | ||
await OperationsWithToken.Transfer() | ||
await OperationsWithToken.CheckTransfer() | ||
}) |
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,14 @@ | ||
import { test } from '../fixtures/testContextFixture'; | ||
|
||
test.beforeEach(async ({metamask, zkAccount}) => { | ||
await zkAccount.open('/') | ||
await zkAccount.button_zkAccount() | ||
await zkAccount.button_Agree() | ||
await zkAccount.RestoreAccount() | ||
await zkAccount.CreatePassword() | ||
await zkAccount.CheckAccount() | ||
}); | ||
|
||
test('Withdraw', async ({OperationsWithToken}) => { | ||
await OperationsWithToken.Withdraw() | ||
}) |
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,33 @@ | ||
import { test } from '../fixtures/testContextFixture'; | ||
|
||
test.describe.configure({mode: `parallel`}) | ||
|
||
|
||
test('Create zkAccount with MetaMask', async ({zkAccount, metamask}) => { | ||
await metamask.importWallet() | ||
await zkAccount.open('/') | ||
await zkAccount.button_zkAccount() | ||
await zkAccount.button_Agree() | ||
await zkAccount.ConnectMetaMaskWallet() | ||
await zkAccount.GenerateKey() | ||
await zkAccount.CreatePassword() | ||
await zkAccount.CheckAccount() | ||
}); | ||
|
||
test('Create zkAccount from seed phrase', async ({zkAccount}) => { | ||
await zkAccount.open('/') | ||
await zkAccount.button_zkAccount() | ||
await zkAccount.button_Agree() | ||
await zkAccount.CreateWithSecretRecoveryPhrase() | ||
await zkAccount.CheckAccount() | ||
}); | ||
|
||
test('Restore zkAccount', async ({zkAccount}) => { | ||
await zkAccount.open('/') | ||
await zkAccount.button_zkAccount() | ||
await zkAccount.button_Agree() | ||
await zkAccount.RestoreAccount() | ||
await zkAccount.CreatePassword() | ||
await zkAccount.CheckAccount() | ||
|
||
}); |
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,11 @@ | ||
export const TIMEOUTS = { | ||
tiny: 100, | ||
fast: 1000, | ||
small: 3 * 1000, | ||
medium: 5 * 1000, | ||
big: 30 * 1000, | ||
huge: 45 * 1000, | ||
oneMinute: 60 * 1000, | ||
fiveMinutes: 5 * 60 * 1000, | ||
tenMinutes: 10 * 60 * 1000, | ||
}; |
Binary file not shown.
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,75 @@ | ||
import path from 'path'; | ||
import { BrowserContext, chromium, test as base } from '@playwright/test'; | ||
|
||
import App from '../pages/app'; | ||
import zkAccountPage from '../pages/PageObjects/zkAccount/zkAccountElements'; | ||
|
||
import Metamask from '../pages/metamask'; | ||
import OperationsWithTokenPages from '../pages/PageObjects/OperationsWithToken/OperationsWithTokenElements'; | ||
|
||
interface TestContextFixture { | ||
metamask: Metamask; | ||
metamaskContext: BrowserContext; | ||
app: App; | ||
zkAccount: zkAccountPage; | ||
OperationsWithToken: OperationsWithTokenPages; | ||
} | ||
|
||
export const test = base.extend<TestContextFixture>({ | ||
metamaskContext: [ | ||
async ({}, use) => { | ||
const pathToExtension = path.join(__dirname, '../dist/metamask/'); | ||
const userDataDir = path.join( | ||
__dirname, | ||
`../tmp/${+new Date()}${Math.random()}`, | ||
); | ||
|
||
const context = await chromium.launchPersistentContext(userDataDir, { | ||
headless: false, | ||
viewport: { width: 1080, height: 800 }, | ||
args: [ | ||
`--disable-extensions-except=${pathToExtension}`, | ||
`--load-extension=${pathToExtension}`, | ||
'--disable-dev-shm-usage', | ||
'--no-sandbox', | ||
'--disable-gpu', | ||
'--disable-dev-shm-usage', | ||
], | ||
locale: 'en-US', | ||
}); | ||
await use(context); | ||
await context.close() | ||
}, | ||
{ scope: 'test', auto: true }, | ||
], | ||
metamask: [ | ||
({ metamaskContext: context }, use) => { | ||
context.on('page', async (page) => { | ||
await page.waitForLoadState(); | ||
if ((await page.title()) === 'MetaMask') { | ||
await page.reload(); | ||
await page.waitForLoadState(); | ||
await use(new Metamask(page)); | ||
} | ||
}); | ||
}, | ||
{ scope: 'test' }, | ||
], | ||
|
||
app: async ({ metamaskContext: context }, use) => { | ||
await use(new App(context.pages()[0])); | ||
await context.close(); | ||
}, | ||
|
||
zkAccount: async ({ metamaskContext: context }, use) => { | ||
await use(new zkAccountPage(context.pages()[0])); | ||
await context.close(); | ||
}, | ||
|
||
OperationsWithToken: async ({ metamaskContext: context }, use) => { | ||
await use(new OperationsWithTokenPages(context.pages()[0])); | ||
await context.close(); | ||
}, | ||
|
||
|
||
}); |
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,15 @@ | ||
import extract from 'extract-zip'; | ||
import path from 'path'; | ||
|
||
async function unpackMetamaskExtension(): Promise<void> { | ||
const source = path.join(__dirname, './dist/metamask-chrome-10.19.0.zip'); | ||
const target = path.join(__dirname, './dist/metamask'); | ||
|
||
return extract(source, { dir: target }); | ||
} | ||
|
||
async function globalSetup() { | ||
await unpackMetamaskExtension(); | ||
} | ||
|
||
export default globalSetup; |
Oops, something went wrong.