vega-frontend-monorepo/.github/workflows/cypress.yml
Ditmir-Vega 6bccfaf8ab
Task/252 Eth wallet connection and deposit form validation tests (#309)
* add feature/scenarios for deposits

* add file for auction orders tests

* update feature file for deposits

* update feature tests for deposit

* add feature/scenarios for deposits

* add file for auction orders tests

* update feature file for deposits

* update feature tests for deposit

* add test for wallet not connected

* fix lint warning

* add mock ethereum provider to allow connecting ethereum wallet

* add basic test for required validation errors

* add  aria for input errors for a11y and test targeting, expand submit form helper

* use mnemonic for private key generation, update tests to not submit and just assert validation message updates

* add chain id to cypress config

* update scenario

* remove feature file

* lint fix

* Update apps/trading-e2e/cypress.json

Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com>

* use mnemonic from github secret, update cypress.json env vars to match

* fix typo in test name and mnemonic env var

* update env variables

* update eth wallet mnemonic env

* Update libs/cypress/src/lib/eip1193-bridge.ts

Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com>

* remove unused reference to chainId

* update casing

* chainId reference from cypress.json

* Update apps/trading-e2e/cypress.json

Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com>

* Update apps/trading-e2e/src/support/step_definitions/deposits.step.ts

Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com>

* ignore a known failing step in the test due to wallet connected having approved status

* update testid

* update tests for deposits

* tidy up comments in custom cypress commands

* add comment about eager connect when running in cypress

* update deposits tests

Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
Co-authored-by: Dexter Edwards <dexter.edwards93@gmail.com>
2022-05-10 20:37:09 +01:00

115 lines
4.4 KiB
YAML

name: Cypress tests
on:
push:
branches:
- master
- develop
pull_request:
jobs:
master:
name: Run end-to-end tests - main
runs-on: ubuntu-latest
strategy:
matrix:
vegawallet-version:
- '0.13.2'
if: ${{ github.event_name != 'pull_request' }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v2
with:
main-branch-name: master
- name: Use Node.js 16
id: Node
uses: actions/setup-node@v2
with:
node-version: 16.14.0
- name: Install root dependencies
run: yarn install
- name: Download and unzip wallet
run: curl -L https://github.com/vegaprotocol/vegawallet/releases/download/v${{ matrix.vegawallet-version }}/vegawallet-linux-amd64.zip -O
- name: Unzip wallet
run: unzip ./vegawallet-linux-amd64.zip
- name: Create passphrase
run: echo "${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}" > ./passphrase
- name: Create recovery
run: echo "${{ secrets.TRADING_TEST_VEGA_WALLET_RECOVERY }}" > ./recovery
- name: Initialize wallet
run: ./vegawallet init -f
- name: Import wallet
run: ./vegawallet import -w UI_Trading_Test --recovery-phrase-file ./recovery -p ./passphrase
- name: Import config
run: ./vegawallet network import --from-url https://raw.githubusercontent.com/vegaprotocol/networks/master/fairground/fairground.toml
- name: Create public key 2
run: ./vegawallet key generate -w UI_Trading_Test -p ./passphrase
- name: Start service
run: ./vegawallet service run --network fairground &
- name: Run Cypress tests
env:
CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}
CYPRESS_SLACK_WEBHOOK: ${{ secrets.CYPRESS_SLACK_WEBHOOK }}
CYPRESS_ETH_WALLET_MNEMONIC: ${{ secrets.CYPESS_ETH_WALLET_MNEMONIC }}
run: npx nx affected:e2e --parallel=5 --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --browser chrome
pr:
name: Run end-to-end tests - PR
runs-on: ubuntu-latest
strategy:
matrix:
vegawallet-version:
- '0.13.2'
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v2
with:
main-branch-name: master
- name: Use Node.js 16
id: Node
uses: actions/setup-node@v2
with:
node-version: 16.14.0
- name: Install root dependencies
run: yarn install
- name: Download and unzip wallet
run: curl -L https://github.com/vegaprotocol/vegawallet/releases/download/v${{ matrix.vegawallet-version }}/vegawallet-linux-amd64.zip -O
- name: Unzip wallet
run: unzip ./vegawallet-linux-amd64.zip
- name: Create passphrase
run: echo "${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}" > ./passphrase
- name: Create recovery
run: echo "${{ secrets.TRADING_TEST_VEGA_WALLET_RECOVERY }}" > ./recovery
- name: Initialize wallet
run: ./vegawallet init -f
- name: Import wallet
run: ./vegawallet import -w UI_Trading_Test --recovery-phrase-file ./recovery -p ./passphrase
- name: Import config
run: ./vegawallet network import --from-url https://raw.githubusercontent.com/vegaprotocol/networks/master/fairground/fairground.toml
- name: Create public key 2
run: ./vegawallet key generate -w UI_Trading_Test -p ./passphrase
- name: Start service
run: ./vegawallet service run --network fairground &
- name: Run Cypress tests
env:
CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }}
CYPRESS_SLACK_WEBHOOK: ${{ secrets.CYPRESS_SLACK_WEBHOOK }}
CYPRESS_ETH_WALLET_MNEMONIC: ${{ secrets.CYPESS_ETH_WALLET_MNEMONIC }}
run: npx nx affected:e2e --parallel=5 --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --browser chrome