Skip to content

Tests

Tests #1583

Workflow file for this run

name: Tests
on:
pull_request_review:
types: [ submitted ]
jobs:
Unit_tests:
if: github.event.review && (github.event.review.state == 'approved' || contains(github.event.review.body, '/check') || contains(github.event.review.body, '/release-check'))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Read .nvmrc
id: nvm
run: echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_OUTPUT
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
- name: Cache node modules
# https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows
uses: actions/cache@v3
env:
cache-name: cache-yoroi-extension-node-modules
with:
# https://github.com/actions/cache/blob/main/examples.md#node---npm
# It is recommended to cache the NPM cache (~/.npm) instead of node_modules.
# But we put node version into the cache key and cache node_modules.
path: packages/yoroi-extension/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-node-${{ steps.nvm.outputs.NVMRC }}-${{ hashFiles('packages/yoroi-extension/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: npm install
run: |
. install-all.sh
- name: tests
run: |
npm run test
E2E_tests_dApp:
if: github.event.review && (github.event.review.state == 'approved' || contains(github.event.review.body, '/check') || contains(github.event.review.body, '/dapp-check'))
runs-on: macos-12
strategy:
matrix:
browser: ['chrome', 'firefox']
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Forcefully update the Chrome browser
if: matrix.browser=='chrome'
run: brew update && brew upgrade --cask google-chrome
- name: Forcefully install Firefox for Developers browser
if: matrix.browser=='firefox'
run: |
brew update
brew tap homebrew/cask-versions && brew install --cask firefox-developer-edition
echo "FIREFOX_DEV=/Applications/Firefox Developer Edition.app/Contents/MacOS/firefox-bin" >> $GITHUB_ENV
- name: Read .nvmrc
id: nvm
run: echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_OUTPUT
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
- name: Cache extension node modules
# https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows
uses: actions/cache@v3
env:
cache-name: cache-yoroi-extension-node-modules
with:
# https://github.com/actions/cache/blob/main/examples.md#node---npm
# It is recommended to cache the NPM cache (~/.npm) instead of node_modules.
# But we put node version into the cache key and cache node_modules.
path: packages/yoroi-extension/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-node-${{ steps.nvm.outputs.NVMRC }}-${{ hashFiles('packages/yoroi-extension/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache connector node modules
# https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows
uses: actions/cache@v3
env:
cache-name: cache-yoroi-connector-node-modules
with:
# https://github.com/actions/cache/blob/main/examples.md#node---npm
# It is recommended to cache the NPM cache (~/.npm) instead of node_modules.
# But we put node version into the cache key and cache node_modules.
path: packages/yoroi-connector/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-node-${{ steps.nvm.outputs.NVMRC }}-${{ hashFiles('packages/yoroi-connector/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: npm install
run: |
. install-all.sh
- name: Build the test version
working-directory: ./packages/yoroi-extension
run: npm run test:build
- name: Run dapp connector tests
working-directory: ./packages/yoroi-extension
env:
MAILSAC_API_KEY: ${{ secrets.MAILSAC_API_KEY }}
run: npm run test:run:e2e:dApp:${{ matrix.browser }}
- name: Archive tests screenshots and logs
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: testRunsData_E2E_tests_dApp_${{ matrix.browser }}
path: ./packages/yoroi-extension/testRunsData_${{ matrix.browser }}
Trezor_Model_T_emulator:
if: github.event.review && (github.event.review.state == 'approved' || contains(github.event.review.body, '/check') || contains(github.event.review.body, '/trezor-check'))
runs-on: ubuntu-22.04
strategy:
matrix:
browser: ['chrome', 'firefox']
fail-fast: false
steps:
- name: Forcefully update the Chrome browser
if: matrix.browser=='chrome'
run: |
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
sudo apt-get update
sudo apt-get --only-upgrade install google-chrome-stable
- name: Install Firefox Developer Edition
if: matrix.browser=='firefox'
run: |
wget -c "https://download.mozilla.org/?product=firefox-devedition-latest-ssl&os=linux64&lang=en-US" -O - | sudo tar -xj -C /opt
sudo rm -rf /opt/firefoxdev
sudo mv /opt/firefox /opt/firefoxdev
echo "FIREFOX_DEV=/opt/firefoxdev/firefox-bin" >> $GITHUB_ENV
- name: Clone the trezor-usr-env
run: |
cd ..
git clone https://github.com/trezor/trezor-user-env.git
- name: Install nix-shell
run: |
sudo apt update
sudo apt -y install nix-bin
- name: Download firmware
working-directory: ../trezor-user-env/src/binaries/firmware/bin/
run: sudo ./download.sh
- name: Download trezord-go
working-directory: ../trezor-user-env/src/binaries/trezord-go/bin/
run: sudo ./download.sh
- name: Copy the v2-master firmware to the root of the project
working-directory: ../trezor-user-env
run: cp -rf src/binaries/firmware/bin/trezor-emu-core-v2-master ./
- name: Copy the trezord-go-v2.0.32 to the root of the project
working-directory: ../trezor-user-env
run: cp -rf src/binaries/trezord-go/bin/trezord-go-v2.0.32 ./
- name: Create the logs folder in the root of the trezor-user-env
working-directory: ../trezor-user-env
run: mkdir logs
- name: Run the trezor user environment
working-directory: ../trezor-user-env
run: sudo docker run -p 9001:9001 -p 9002:9002 -p 21326:21326 -p 127.0.0.1:21325:21326 -p 21324:21324 -v logs:/trezor-user-env/logs/screens -v trezor-emu-core-v2-master:/trezor-user-env/src/binaries/firmware/bin/user_downloaded -v trezord-go-v2.0.32:/trezor-user-env/src/binaries/trezord-go/bin -d emurgornd/trezor-user-env:latest
- uses: actions/checkout@v3
- name: Read .nvmrc
id: nvm
run: echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_OUTPUT
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
- name: Cache extension node modules
# https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows
uses: actions/cache@v3
env:
cache-name: cache-yoroi-extension-node-modules
with:
# https://github.com/actions/cache/blob/main/examples.md#node---npm
# It is recommended to cache the NPM cache (~/.npm) instead of node_modules.
# But we put node version into the cache key and cache node_modules.
path: packages/yoroi-extension/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-node-${{ steps.nvm.outputs.NVMRC }}-${{ hashFiles('packages/yoroi-extension/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache connector node modules
# https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows
uses: actions/cache@v3
env:
cache-name: cache-yoroi-connector-node-modules
with:
# https://github.com/actions/cache/blob/main/examples.md#node---npm
# It is recommended to cache the NPM cache (~/.npm) instead of node_modules.
# But we put node version into the cache key and cache node_modules.
path: packages/yoroi-connector/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-node-${{ steps.nvm.outputs.NVMRC }}-${{ hashFiles('packages/yoroi-connector/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: npm install
run: |
. install-all.sh
- name: Build the test version
working-directory: ./packages/yoroi-extension
run: npm run test:build
- name: Run tests
working-directory: ./packages/yoroi-extension
run: xvfb-run -a -e /dev/stdout -s "-screen 0 1920x1080x24" npm run test:run:e2e:trezor:${{ matrix.browser }}
- name: Archive tests screenshots and logs
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: testRunsData_Trezor_Model_T_emulator_${{ matrix.browser }}
path: ./packages/yoroi-extension/testRunsData_${{ matrix.browser }}
E2E_smoke_tests:
if: github.event.review && (contains(github.event.review.body, '/release-check'))
runs-on: ubuntu-22.04
strategy:
matrix:
browser: ['chrome', 'firefox']
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Forcefully update the Chrome browser
if: matrix.browser=='chrome'
run: |
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
sudo apt-get update
sudo apt-get --only-upgrade install google-chrome-stable
- name: Install Firefox Developer Edition
if: matrix.browser=='firefox'
run: |
wget -c "https://download.mozilla.org/?product=firefox-devedition-latest-ssl&os=linux64&lang=en-US" -O - | sudo tar -xj -C /opt
sudo rm -rf /opt/firefoxdev
sudo mv /opt/firefox /opt/firefoxdev
echo "FIREFOX_DEV=/opt/firefoxdev/firefox-bin" >> $GITHUB_ENV
- name: Read .nvmrc
id: nvm
run: echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_OUTPUT
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
- name: Cache extension node modules
# https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows
uses: actions/cache@v3
env:
cache-name: cache-yoroi-extension-node-modules
with:
# https://github.com/actions/cache/blob/main/examples.md#node---npm
# It is recommended to cache the NPM cache (~/.npm) instead of node_modules.
# But we put node version into the cache key and cache node_modules.
path: packages/yoroi-extension/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-node-${{ steps.nvm.outputs.NVMRC }}-${{ hashFiles('packages/yoroi-extension/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache connector node modules
# https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows
uses: actions/cache@v3
env:
cache-name: cache-yoroi-connector-node-modules
with:
# https://github.com/actions/cache/blob/main/examples.md#node---npm
# It is recommended to cache the NPM cache (~/.npm) instead of node_modules.
# But we put node version into the cache key and cache node_modules.
path: packages/yoroi-connector/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-node-${{ steps.nvm.outputs.NVMRC }}-${{ hashFiles('packages/yoroi-connector/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: npm install
run: |
. install-all.sh
- name: Build the test mainnet version
working-directory: ./packages/yoroi-extension
run: npm run test:build:mainnet
- name: Run smoke tests
working-directory: ./packages/yoroi-extension
env:
FIRST_SMOKE_TEST_WALLET: ${{ secrets.FIRST_SMOKE_TEST_WALLET }}
SECOND_SMOKE_TEST_WALLET: ${{ secrets.SECOND_SMOKE_TEST_WALLET }}
SECOND_SMOKE_TEST_WALLET_FF: ${{ secrets.SECOND_SMOKE_TEST_WALLET_FF }}
run: xvfb-run -a -e /dev/stdout -s "-screen 0 1920x1080x24" npm run test:run:e2e:smoke:${{ matrix.browser }}
- name: Archive tests screenshots and logs
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: testRunsData_E2E_smoke_tests_${{ matrix.browser }}
path: ./packages/yoroi-extension/testRunsData_${{ matrix.browser }}
E2E_regression_tests:
if: github.event.review && (github.event.review.state == 'approved' || contains(github.event.review.body, '/check') || contains(github.event.review.body, '/regression-check'))
runs-on: ubuntu-22.04
strategy:
matrix:
browser: [ 'chrome', 'firefox' ]
fail-fast: false
steps:
- name: Forcefully update the Chrome browser
if: matrix.browser=='chrome'
run: |
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
sudo apt-get update
sudo apt-get --only-upgrade install google-chrome-stable
- name: Install Firefox Developer Edition
if: matrix.browser=='firefox'
run: |
wget -c "https://download.mozilla.org/?product=firefox-devedition-latest-ssl&os=linux64&lang=en-US" -O - | sudo tar -xj -C /opt
sudo rm -rf /opt/firefoxdev
sudo mv /opt/firefox /opt/firefoxdev
echo "FIREFOX_DEV=/opt/firefoxdev/firefox-bin" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: Read .nvmrc
id: nvm
run: echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_OUTPUT
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
- name: Cache extension node modules
# https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows
uses: actions/cache@v3
env:
cache-name: cache-yoroi-extension-node-modules
with:
# https://github.com/actions/cache/blob/main/examples.md#node---npm
# It is recommended to cache the NPM cache (~/.npm) instead of node_modules.
# But we put node version into the cache key and cache node_modules.
path: packages/yoroi-extension/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-node-${{ steps.nvm.outputs.NVMRC }}-${{ hashFiles('packages/yoroi-extension/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache connector node modules
# https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows
uses: actions/cache@v3
env:
cache-name: cache-yoroi-connector-node-modules
with:
# https://github.com/actions/cache/blob/main/examples.md#node---npm
# It is recommended to cache the NPM cache (~/.npm) instead of node_modules.
# But we put node version into the cache key and cache node_modules.
path: packages/yoroi-ergo-connector/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-node-${{ steps.nvm.outputs.NVMRC }}-${{ hashFiles('packages/yoroi-ergo-connector/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: npm install
run: |
. install-all.sh
- name: Build the test version
working-directory: ./packages/yoroi-extension
run: npm run test:build
- name: Run tests
working-directory: ./packages/yoroi-extension
env:
MAILSAC_API_KEY: ${{secrets.MAILSAC_API_KEY}}
run: xvfb-run -a -e /dev/stdout -s "-screen 0 1920x1080x24" npm run test:run:e2e:${{ matrix.browser }}
- name: Archive tests screenshots and logs
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: testRunsData_E2E_regression_tests_${{ matrix.browser }}
path: ./packages/yoroi-extension/testRunsData_${{ matrix.browser }}