Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Denis/new ci workflow #3037

Merged
merged 20 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 135 additions & 19 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@ jobs:
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@v2
- uses: actions/checkout@v3

- name: Read .nvmrc
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
id: nvm
run: echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_OUTPUT

- name: Setup node
uses: actions/setup-node@v1
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@v2
uses: actions/cache@v3
env:
cache-name: cache-yoroi-extension-node-modules
with:
Expand All @@ -32,9 +35,11 @@ jobs:
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-

- name: npm install
run: |
. install-all.sh

- name: tests
run: |
npm run test
Expand All @@ -46,27 +51,33 @@ jobs:
matrix:
browser: ['chrome', 'firefox']
fail-fast: false

steps:
- uses: actions/checkout@v2
- 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
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
id: nvm
run: echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_OUTPUT

- name: Setup node
uses: actions/setup-node@v1
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@v2
uses: actions/cache@v3
env:
cache-name: cache-yoroi-extension-node-modules
with:
Expand All @@ -79,9 +90,10 @@ jobs:
${{ 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@v2
uses: actions/cache@v3
env:
cache-name: cache-yoroi-connector-node-modules
with:
Expand All @@ -94,27 +106,32 @@ jobs:
${{ 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: Create the report's folder
working-directory: ./packages/yoroi-extension
run: |
mkdir reports
touch ./reports/cucumberReports.json

- 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_${{ matrix.browser }}
name: testRunsData_E2E_tests_dApp_${{ matrix.browser }}
path: ./packages/yoroi-extension/testRunsData_${{ matrix.browser }}

Trezor_Model_T_emulator:
Expand All @@ -124,6 +141,7 @@ jobs:
matrix:
browser: ['chrome', 'firefox']
fail-fast: false

steps:
- name: Forcefully update the Chrome browser
if: matrix.browser=='chrome'
Expand Down Expand Up @@ -178,13 +196,14 @@ jobs:
- uses: actions/checkout@v3

- name: Read .nvmrc
run: echo ::set-output name=NVMRC::$(cat .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
Expand Down Expand Up @@ -221,7 +240,7 @@ jobs:
run: |
. install-all.sh

- name: Build the test version using emulators
- name: Build the test version
working-directory: ./packages/yoroi-extension
run: npm run test:build

Expand All @@ -239,7 +258,7 @@ jobs:
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: testRunsData_${{ matrix.browser }}
name: testRunsData_Trezor_Model_T_emulator_${{ matrix.browser }}
path: ./packages/yoroi-extension/testRunsData_${{ matrix.browser }}

E2E_smoke_tests:
Expand All @@ -249,8 +268,10 @@ jobs:
matrix:
browser: ['chrome', 'firefox']
fail-fast: false

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Forcefully update the Chrome browser
if: matrix.browser=='chrome'
run: |
Expand All @@ -268,17 +289,17 @@ jobs:
echo "FIREFOX_DEV=/opt/firefoxdev/firefox-bin" >> $GITHUB_ENV

- name: Read .nvmrc
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
id: nvm
run: echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_OUTPUT

- name: Setup node
uses: actions/setup-node@v2
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@v2
uses: actions/cache@v3
env:
cache-name: cache-yoroi-extension-node-modules
with:
Expand All @@ -294,7 +315,7 @@ jobs:

- name: Cache connector node modules
# https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows
uses: actions/cache@v2
uses: actions/cache@v3
env:
cache-name: cache-yoroi-connector-node-modules
with:
Expand Down Expand Up @@ -334,5 +355,100 @@ jobs:
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: testRunsData_${{ matrix.browser }}
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: Create the report's folder
working-directory: ./packages/yoroi-extension
run: |
mkdir reports
touch ./reports/cucumberReports.json

- 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 }}
5 changes: 5 additions & 0 deletions packages/yoroi-extension/features/pages/basicSetupPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import { By } from 'selenium-webdriver';

const LANGUAGE_SELECTION_FORM = '.LanguageSelectionForm_component';

export const loadingSpinnerComponent: LocatorObject = {
locator: '.LoadingSpinner_component',
method: 'css',
};

// language select page
export const languageSelectionForm: LocatorObject = {
locator: LANGUAGE_SELECTION_FORM,
Expand Down
2 changes: 1 addition & 1 deletion packages/yoroi-extension/features/pages/supportPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import type { LocatorObject } from '../support/webdriver';

export const iframe: LocatorObject = { locator: '#webWidget', method: 'css' };
export const iframe: LocatorObject = { locator: 'webWidget', method: 'id' };

export const supportButton: LocatorObject = {
locator: '.MuiButtonBase-root',
Expand Down
5 changes: 5 additions & 0 deletions packages/yoroi-extension/features/pages/walletPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,8 @@ export const walletNavBackButton: LocatorObject = {
locator: '.NavBar_navbar .NavBar_title .NavBarBack_backButton',
method: 'css',
};

export const walletSyncingOverlayComponent: LocatorObject = {
locator: '.WalletSyncingOverlay_component',
method: 'css',
};
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ import {
walletAddressRow,
getAddressFromAddressRow,
} from '../pages/walletReceivePage';
import { halfSecond, oneSecond } from '../support/helpers/common-constants';
import { oneSecond } from '../support/helpers/common-constants';

Given(/^Revamp. I go to the receive screen$/, async function () {
await this.click(receiveTab);
await this.driver.sleep(oneSecond + halfSecond);
await this.waitForElement(generateAddressButton);
});

Given(/^I go to the receive screen$/, async function () {
await this.click(receiveTab);
await this.driver.sleep(oneSecond + halfSecond);
await this.waitForElement(generateAddressButton);
});

When(/^I click on the Generate new address button$/, async function () {
Expand Down Expand Up @@ -105,6 +105,7 @@ Then(/^I see every generated address is unique$/, async function () {
});

Then(/^I should see the addresses exactly list them$/, async function (table) {
await this.driver.sleep(2 * oneSecond);
const rows = table.hashes();
const waitUntilAddressesAppeared = rows.map(async (row, index) => {
const addressLocator = getGeneratedAddress(index);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,12 @@ import {
walletRecoveryPhraseDisplayDialog
} from '../pages/createWalletPage';
import * as helpers from '../support/helpers/helpers';
import { walletNameText, walletPlate } from '../pages/walletPage';
import { walletNameText, walletPlate, walletSyncingOverlayComponent } from '../pages/walletPage';
import {
continueButton,
getTosCheckbox,
languageSelectionForm,
loadingSpinnerComponent,
termsOfUseComponent,
walletAddComponent,
} from '../pages/basicSetupPage';
Expand Down Expand Up @@ -370,6 +371,8 @@ async function restoreWallet (
await customWorld.waitForElement(verifyRestoredInfoDialog);
await checkWalletPlate(customWorld, walletName, restoreInfo);
customWorld.webDriverLogger.info(`Step:restoreWallet: Wallet plate is checked`);
await customWorld.waitForElementNotPresent(walletSyncingOverlayComponent);
customWorld.webDriverLogger.info(`Step:restoreWallet: Wallet is fully synchronized`);
}

async function checkWalletPlate(
Expand Down Expand Up @@ -564,6 +567,7 @@ Given(/^I import a snapshot named ([^"]*)$/, async function (snapshotName) {
await this.driver.navigate().refresh();
// wait for page to refresh
await this.driver.sleep(oneSecond + halfSecond);
await this.waitForElementNotPresent(loadingSpinnerComponent);
await this.waitForElement(yoroiModern);
});

Expand Down
Loading