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

Make test runs robust and reliable #3552

Closed
wants to merge 55 commits into from
Closed
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
2fdd628
Moved failing tests to special folder
Nebyt Jun 18, 2024
ec9770d
using one additional window instead of two
Nebyt Jun 18, 2024
f94369e
Added logs to the driver manager
Nebyt Jun 18, 2024
ff17810
updated loading txs
Nebyt Jun 18, 2024
857df8a
updated packages
Nebyt Jun 18, 2024
6a2e25d
added network constants
Nebyt Jun 18, 2024
8ba054c
using network config and a new way to build a tx
Nebyt Jun 18, 2024
0be0b50
requesting UTxOs in a correct way
Nebyt Jun 18, 2024
e7cd17c
minor fix
Nebyt Jun 18, 2024
74c1d19
removed unused
Nebyt Jun 18, 2024
08dd95e
headless driver
Nebyt Jun 19, 2024
3cb6b74
non headless
Nebyt Jun 19, 2024
265450f
Merge branch 'develop' into denis/yoext-1200/make-tests-great-again
Nebyt Jun 19, 2024
2844857
Merge branch 'develop' into denis/yoext-1200/make-tests-great-again
Nebyt Jun 20, 2024
7722b31
trying ubuntu runner
Nebyt Jun 20, 2024
ad95d34
using headless
Nebyt Jun 20, 2024
a51eced
using xvfb
Nebyt Jun 20, 2024
914ddc3
again non-headless
Nebyt Jun 20, 2024
6f5d146
xvfd-run for all tests
Nebyt Jun 20, 2024
b6635ee
headless, without xvfb
Nebyt Jun 20, 2024
dcba1b2
rollback runner changes
Nebyt Jun 20, 2024
46d8cd1
headless macos
Nebyt Jun 20, 2024
4d59099
jobs names update
Nebyt Jun 20, 2024
a3920f0
update regexp
Nebyt Jun 21, 2024
5924734
Merge branch 'develop' into denis/yoext-1200/make-tests-great-again
Nebyt Jun 21, 2024
82100e6
ubuntu runner again. Non-headless
Nebyt Jun 21, 2024
fd264c7
Merge branch 'denis/yoext-1200/make-tests-great-again' of https://git…
Nebyt Jun 21, 2024
67c0494
updated jobs names, always collecting logs
Nebyt Jun 21, 2024
3641027
removed remote-debugging-pipe
Nebyt Jun 21, 2024
16098c7
using xvfb
Nebyt Jun 21, 2024
5238e2e
another try
Nebyt Jun 21, 2024
1b16a54
another try ubuntu 22
Nebyt Jun 21, 2024
d73ba29
packages updates
Nebyt Jun 21, 2024
4f2c733
no force chrome update
Nebyt Jun 21, 2024
ecac1f6
returned force update
Nebyt Jun 21, 2024
c99cee8
maximize pop-up
Nebyt Jun 21, 2024
86c77c6
get chromedrvire version
Nebyt Jun 21, 2024
0e226e2
added chrome to path
Nebyt Jun 21, 2024
1d2a2c9
another way for arguments
Nebyt Jun 21, 2024
1d1389f
static version of selenium
Nebyt Jun 21, 2024
79c8870
rollback workflows
Nebyt Jun 22, 2024
09067b8
headless
Nebyt Jun 22, 2024
343aadf
experiment
Nebyt Jun 22, 2024
aedeeb6
split build and tests
Nebyt Jun 22, 2024
f0f0446
fix for nvm
Nebyt Jun 22, 2024
b7b3409
one more fix
Nebyt Jun 23, 2024
91b69b4
debug
Nebyt Jun 23, 2024
4c9ebf8
debug
Nebyt Jun 23, 2024
43f9701
debug
Nebyt Jun 23, 2024
ecbdf8a
update driver
Nebyt Jun 23, 2024
9883d0b
headless
Nebyt Jun 23, 2024
c4feef9
a new approach
Nebyt Jun 23, 2024
068f1d3
again reorginized workflows
Nebyt Jun 23, 2024
4196f96
minimal update
Nebyt Jun 23, 2024
140333d
getting fiat balance update
Nebyt Jun 23, 2024
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
46 changes: 28 additions & 18 deletions .github/workflows/e2e-tests-dapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
General:
if: github.event.review && (github.event.review.state == 'approved' || contains(github.event.review.body, '/check') || contains(github.event.review.body, '/dapp-general'))
runs-on: macos-14
runs-on: ubuntu-24.04
strategy:
matrix:
browser: ["chrome"]
Expand All @@ -20,18 +20,23 @@ jobs:
- uses: actions/checkout@v4

- name: distutils hack
run: brew install python-setuptools
run: sudo apt install python3-setuptools

- name: Forcefully update the Chrome browser
if: matrix.browser=='chrome'
run: brew update && brew upgrade --cask google-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: 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_BIN=/Applications/Firefox Developer Edition.app/Contents/MacOS/firefox-bin" >> $GITHUB_ENV
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
Expand Down Expand Up @@ -74,7 +79,7 @@ jobs:
SECOND_STATIC_TEST_WALLET: ${{ secrets.SECOND_STATIC_TEST_WALLET }}
SECOND_SMOKE_TEST_WALLET: ${{ secrets.SECOND_SMOKE_TEST_WALLET }}
SECOND_SMOKE_TEST_WALLET_FF: ${{ secrets.SECOND_SMOKE_TEST_WALLET_FF }}
run: npm run test:${{ matrix.browser }}:dapp
run: xvfb-run -a -e /dev/stdout -s "-screen 0 1920x1080x24" npm run test:${{ matrix.browser }}:dapp

- name: Archive tests screenshots and logs
if: ${{ failure() }}
Expand All @@ -87,28 +92,33 @@ jobs:

Failing:
if: github.event.review && contains(github.event.review.body, '/dapp-failing')
runs-on: macos-14
runs-on: ubuntu-24.04
strategy:
matrix:
browser: ['chrome']
browser: ["chrome"]
fail-fast: false

steps:
- uses: actions/checkout@v4

- name: distutils hack
run: brew install python-setuptools
run: sudo apt install python3-setuptools

- name: Forcefully update the Chrome browser
if: matrix.browser=='chrome'
run: brew update && brew upgrade --cask google-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: 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_BIN=/Applications/Firefox Developer Edition.app/Contents/MacOS/firefox-bin" >> $GITHUB_ENV
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
Expand All @@ -117,7 +127,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
node-version: "${{ steps.nvm.outputs.NVMRC }}"

- name: Cache extension node modules
# https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows
Expand All @@ -138,7 +148,7 @@ jobs:
- name: npm install
run: |
. install-all.sh

- name: Build the test mainnet version
working-directory: ./packages/yoroi-extension
run: npm run test:build:mainnet
Expand All @@ -150,7 +160,7 @@ jobs:
SECOND_STATIC_TEST_WALLET: ${{ secrets.SECOND_STATIC_TEST_WALLET }}
SECOND_SMOKE_TEST_WALLET: ${{ secrets.SECOND_SMOKE_TEST_WALLET }}
SECOND_SMOKE_TEST_WALLET_FF: ${{ secrets.SECOND_SMOKE_TEST_WALLET_FF }}
run: npm run test:${{ matrix.browser }}:dapp:bl
run: xvfb-run -a -e /dev/stdout -s "-screen 0 1920x1080x24" npm run test:${{ matrix.browser }}:dapp:bl

- name: Archive tests screenshots and logs
if: ${{ failure() }}
Expand Down
38 changes: 24 additions & 14 deletions .github/workflows/e2e-tests-ext.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
General:
if: github.event.review && (github.event.review.state == 'approved' || contains(github.event.review.body, '/check') || contains(github.event.review.body, '/ext-general'))
runs-on: macos-14
runs-on: ubuntu-24.04
strategy:
matrix:
browser: ["chrome"]
Expand All @@ -20,18 +20,23 @@ jobs:
- uses: actions/checkout@v4

- name: distutils hack
run: brew install python-setuptools
run: sudo apt install python3-setuptools

- name: Forcefully update the Chrome browser
if: matrix.browser=='chrome'
run: brew update && brew upgrade --cask google-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: 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_BIN=/Applications/Firefox Developer Edition.app/Contents/MacOS/firefox-bin" >> $GITHUB_ENV
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
Expand Down Expand Up @@ -73,7 +78,7 @@ jobs:
SECOND_STATIC_TEST_WALLET: ${{ secrets.SECOND_STATIC_TEST_WALLET }}
SECOND_SMOKE_TEST_WALLET: ${{ secrets.SECOND_SMOKE_TEST_WALLET }}
SECOND_SMOKE_TEST_WALLET_FF: ${{ secrets.SECOND_SMOKE_TEST_WALLET_FF }}
run: npm run test:${{ matrix.browser }}
run: xvfb-run -a -e /dev/stdout -s "-screen 0 1920x1080x24" npm run test:${{ matrix.browser }}

- name: Archive tests screenshots and logs
if: ${{ failure() }}
Expand All @@ -86,7 +91,7 @@ jobs:

Failing:
if: github.event.review && contains(github.event.review.body, '/ext-failing')
runs-on: macos-14
runs-on: ubuntu-24.04
strategy:
matrix:
browser: ["chrome"]
Expand All @@ -96,18 +101,23 @@ jobs:
- uses: actions/checkout@v4

- name: distutils hack
run: brew install python-setuptools
run: sudo apt install python3-setuptools

- name: Forcefully update the Chrome browser
if: matrix.browser=='chrome'
run: brew update && brew upgrade --cask google-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: 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_BIN=/Applications/Firefox Developer Edition.app/Contents/MacOS/firefox-bin" >> $GITHUB_ENV
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
Expand Down Expand Up @@ -149,7 +159,7 @@ jobs:
SECOND_STATIC_TEST_WALLET: ${{ secrets.SECOND_STATIC_TEST_WALLET }}
SECOND_SMOKE_TEST_WALLET: ${{ secrets.SECOND_SMOKE_TEST_WALLET }}
SECOND_SMOKE_TEST_WALLET_FF: ${{ secrets.SECOND_SMOKE_TEST_WALLET_FF }}
run: npm run test:${{ matrix.browser }}:bl
run: xvfb-run -a -e /dev/stdout -s "-screen 0 1920x1080x24" npm run test:${{ matrix.browser }}:bl

- name: Archive tests screenshots and logs
if: ${{ failure() }}
Expand Down
1 change: 1 addition & 0 deletions packages/e2e-tests/helpers/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const getTestString = (basePart, stringLength, withCapitals) => {
return __genString(stringLength, basePart, withCapitals);
};

export const DRIVERS_AMOUNT = 1;
export const chromeExtIdUrl = `chrome-extension://bdlknlffjjmjckcldekkbejaogpkjphg`;
export const firefoxExtensionId = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa';
export const firefoxExtIdUrl = `moz-extension://${firefoxExtensionId}`;
Expand Down
54 changes: 16 additions & 38 deletions packages/e2e-tests/helpers/mock-dApp-webpage/dAppTxHelper.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,6 @@
import BigNumber from 'bignumber.js';
import * as CSL from '@emurgo/cardano-serialization-lib-nodejs';

export function getTtl() {
const fullConfig = [
{
StartAt: 0,
ChainNetworkId: '0',
ByronNetworkId: 1097911063,
GenesisDate: '1563999616000',
SlotsPerEpoch: 21600,
SlotDuration: 20,
},
{
StartAt: 74,
SlotsPerEpoch: 432000,
SlotDuration: 1,
PerEpochPercentageReward: 69344,
LinearFee: {
coefficient: '44',
constant: '155381',
},
MinimumUtxoVal: '1000000',
PoolDeposit: '500000000',
KeyDeposit: '2000000',
},
];
const defaultTtlOffset = 7200;
const absSlotNumber = new BigNumber(
TimeUtils.timeToAbsoluteSlot(fullConfig, new Date(1649261533360))
);

return absSlotNumber.plus(defaultTtlOffset).toNumber();
}
import { protocolParams } from './networkConfig.js';

export function bytesToHex(bytes) {
return Buffer.from(bytes).toString('hex');
Expand Down Expand Up @@ -64,18 +33,27 @@ export const toInt = number => CSL.Int.new_i32(number);
export const getTxBuilder = () => {
return CSL.TransactionBuilder.new(
CSL.TransactionBuilderConfigBuilder.new()
.fee_algo(CSL.LinearFee.new(CSL.BigNum.from_str('44'), CSL.BigNum.from_str('155381')))
.coins_per_utxo_word(CSL.BigNum.from_str('34482'))
.pool_deposit(CSL.BigNum.from_str('500000000'))
.key_deposit(CSL.BigNum.from_str('2000000'))
.fee_algo(
CSL.LinearFee.new(
CSL.BigNum.from_str(protocolParams.linearFee.minFeeA),
CSL.BigNum.from_str(protocolParams.linearFee.minFeeB)
)
)
.pool_deposit(CSL.BigNum.from_str(protocolParams.poolDeposit))
.key_deposit(CSL.BigNum.from_str(protocolParams.keyDeposit))
.coins_per_utxo_byte(
CSL.BigNum.from_str(
Math.floor(parseFloat(protocolParams.coinsPerUtxoWord) / 8).toString(10)
)
)
.max_value_size(protocolParams.maxValueSize)
.max_tx_size(protocolParams.maxTxSize)
.ex_unit_prices(
CSL.ExUnitPrices.new(
CSL.UnitInterval.new(CSL.BigNum.from_str('577'), CSL.BigNum.from_str('10000')),
CSL.UnitInterval.new(CSL.BigNum.from_str('721'), CSL.BigNum.from_str('10000000'))
)
)
.max_value_size(5000)
.max_tx_size(16384)
.build()
);
};
Expand Down
4 changes: 1 addition & 3 deletions packages/e2e-tests/helpers/mock-dApp-webpage/mockedDApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,7 @@ export class MockDAppWebpage {
`MockDApp::requestSigningTx Requesting signing the transaction: amount="${amount}", toAddress="${toAddress}"`
);

// the correct way is to request UTxOs for a required amount
// but currently we have this bug https://emurgo.atlassian.net/browse/YOEXT-932
const UTXOsreposne = await this.getUTXOs(undefined, false);
const UTXOsreposne = await this.getUTXOs(amount, false);
this.logger.info(
`MockDApp::requestSigningTx The UTXOsreposne: ${JSON.stringify(UTXOsreposne, null, 2)}`
);
Expand Down
11 changes: 11 additions & 0 deletions packages/e2e-tests/helpers/mock-dApp-webpage/networkConfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export const protocolParams = Object.freeze({
linearFee: {
minFeeA: '44',
minFeeB: '155381',
},
coinsPerUtxoWord: '34482',
poolDeposit: '500000000',
keyDeposit: '2000000',
maxValueSize: 5000,
maxTxSize: 16384,
});
Loading
Loading