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/yoext 372 smoke tests for mainnet #2934

Merged
merged 54 commits into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
c68915d
Updated page elements
Nebyt Jul 25, 2022
cbeb961
Removed the enterRecoveryPhrase from the helpers.js
Nebyt Jul 25, 2022
23a0bd9
Moved the test common password to the common-constants.js
Nebyt Jul 25, 2022
1336d8c
Added creating a Shelley era wallet step.
Nebyt Jul 25, 2022
503b200
Added 2 smoke tests
Nebyt Jul 25, 2022
7b965e2
Locator object update
Nebyt Jul 25, 2022
4437ff9
added id for tests
Nebyt Aug 19, 2022
d6dbad7
Added a separate Before hook specially for smoke test
Nebyt Aug 19, 2022
67c968b
Added the new page object dashboardPage.js
Nebyt Aug 19, 2022
a971a0f
Reworked old steps
Nebyt Aug 19, 2022
4472399
Using expect instead of chai.expect
Nebyt Aug 19, 2022
726769d
Added the step for waiting till a transaction is confirmed
Nebyt Aug 19, 2022
4c227eb
Renamed walletTransactionsPage.js -> walletTransactionsHistoryPage.js
Nebyt Aug 19, 2022
14e3a77
removed an eslint comment
Nebyt Aug 19, 2022
411c4d4
Added the new test "Intrawallet transaction. 1 ADA"
Nebyt Aug 19, 2022
ceb0fdc
Added ids for tests
Nebyt Aug 19, 2022
99a6fce
Added walletSendPage.js
Nebyt Aug 19, 2022
a281bdf
Fixed steps
Nebyt Aug 19, 2022
2101862
Added tests:
Nebyt Aug 19, 2022
fee75bb
Added a new id for tests
Nebyt Aug 21, 2022
0b1e0cb
Added the page object for the mainnet stake pool page
Nebyt Aug 21, 2022
88c624e
Updated wallet-delegation-steps.js
Nebyt Aug 21, 2022
cf4baff
Added tests:
Nebyt Aug 21, 2022
a901b83
Merged develop
Nebyt Aug 21, 2022
b9cceb9
Added scripts to run smoke tests
Nebyt Aug 21, 2022
1c75b74
Updated smoke tests
Nebyt Aug 21, 2022
84054d6
added the smoke CI
Nebyt Aug 21, 2022
27a4627
fixed CI
Nebyt Aug 21, 2022
ead9e8e
fixed CI
Nebyt Aug 21, 2022
b2e0e91
improved search of the "delegate" button
Nebyt Aug 21, 2022
6e6dda6
Only chrome, for now
Nebyt Aug 21, 2022
369d75e
Only chrome 2, for now
Nebyt Aug 21, 2022
8579e25
Changed structure for logs
cmerloglb Aug 24, 2022
f83767a
flow fixes
Nebyt Aug 25, 2022
7e4d055
Added changes to logs
cmerloglb Aug 25, 2022
b02d14a
Changing back BeforeAll to arrow callback
cmerloglb Aug 25, 2022
515440d
Changing double slash
cmerloglb Aug 25, 2022
afa427a
Added changes to add to Loggers
cmerloglb Aug 25, 2022
263204f
Merge branch 'denis/ci_for_smoke_tests' into separate-browser-logs
Nebyt Aug 25, 2022
26c711b
flow fixes
Nebyt Aug 25, 2022
8f4dd08
minor changes
Nebyt Aug 25, 2022
12d3b82
Merge branch 'develop' into denis/YOEXT-372_smoke_tests_for_mainnet
Nebyt Aug 25, 2022
4a870ef
Merge pull request #2977 from Emurgo/separate-browser-logs
vsubhuman Sep 14, 2022
f80a09a
Merge branch 'develop' into denis/YOEXT-372_smoke_tests_for_mainnet
vsubhuman Sep 14, 2022
9716afc
Merge branch 'denis/YOEXT-372_smoke_tests_for_mainnet' into denis/ci_…
Nebyt Sep 14, 2022
1217297
little fixes
Nebyt Sep 14, 2022
8ab9f1d
Merge pull request #2973 from Emurgo/denis/ci_for_smoke_tests
Nebyt Sep 14, 2022
7f3a90c
little fixes
Nebyt Sep 14, 2022
f9f4acc
created time constants
Nebyt Sep 14, 2022
11119be
Merge branch 'develop' into denis/YOEXT-372_smoke_tests_for_mainnet
Nebyt Sep 14, 2022
ce70cd7
Merge branch 'develop' into denis/YOEXT-372_smoke_tests_for_mainnet
vsubhuman Sep 27, 2022
bcfd51e
Required updates
Nebyt Sep 27, 2022
1118c25
flow fix
Nebyt Sep 27, 2022
3a54916
Run flow and unit tests in the release check
Nebyt Sep 27, 2022
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
2 changes: 1 addition & 1 deletion .github/workflows/flow-and-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
flow-and-lint:
if: github.event.review && (github.event.review.state == 'approved' || contains(github.event.review.body, '/check'))
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
Expand Down
107 changes: 101 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
Unit_tests:
if: github.event.review && (github.event.review.state == 'approved' || contains(github.event.review.body, '/check'))
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
Expand Down Expand Up @@ -114,15 +114,15 @@ jobs:
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: testRunsData
path: ./packages/yoroi-extension/testRunsData
name: testRunsData_${{ 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' ]
browser: ['chrome', 'firefox']
fail-fast: false
steps:
- name: Forcefully update the Chrome browser
Expand Down Expand Up @@ -239,5 +239,100 @@ jobs:
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: testRunsData
path: ./packages/yoroi-extension/testRunsData
name: testRunsData_${{ 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@v2
- 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
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
id: nvm

- name: Setup node
uses: actions/setup-node@v2
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
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@v2
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 mainnet version
working-directory: ./packages/yoroi-extension
run: npm run test:build:mainnet

- name: Create the report's folder
working-directory: ./packages/yoroi-extension
run: |
mkdir reports
touch ./reports/cucumberReports.json

- 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_${{ matrix.browser }}
path: ./packages/yoroi-extension/testRunsData_${{ matrix.browser }}
1 change: 1 addition & 0 deletions packages/yoroi-extension/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ production-key.pem
build/
dev/
testRunsData/
testRunsData*
storybook-static/
__screenshots__/
screenshots/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ export default class WalletSendForm extends Component<Props> {
return {
label,
value: token.value,
id: token.id
id: 'send-all'
}
})
]
Expand Down Expand Up @@ -546,7 +546,7 @@ export default class WalletSendForm extends Component<Props> {
}}
>
{sendAmountOptions.map(option => (
<MenuItem key={option.value} value={option.value}>
<MenuItem key={option.value} value={option.value} id={option.id}>
<TokenOptionRow displayName={option.label} nameOnly />
</MenuItem>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export default class WalletSummary extends Component<Props> {
const { intl } = this.context;

const content = (
<div className={styles.content}>
<div className={styles.content} id='walletSummary_box'>
<div className={styles.leftBlock} />
<div className={styles.middleBlock}>
<BorderedBox>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default class TokenOptionRow extends Component<Props> {
render(): Node {
const notOnlyName = !this.props.nameOnly;
return (
<Box width="100%">
<Box width="100%" id={this.props.displayName}>
<Box
sx={{
display: 'flex',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class CardanoStakingPage extends Component<AllProps, State> {
const isWalletWithNoFunds = balance != null && balance.getDefaultEntry().amount.isZero();

const classicCardanoStakingPage = (
<div>
<div id='classicCardanoStakingPage'>
{this.getDialog()}
<SeizaFetcher
urlTemplate={urlTemplate}
Expand Down
2 changes: 1 addition & 1 deletion packages/yoroi-extension/features/dashboard.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Feature: Yoroi delegation dashboard
| asdfasdfasdf |
Given The expected transaction is "hKYAgYJYIDZ36Gx7ppmv3BzVfULyRvhvaa79dgJQBqx4MT+tK7ohAAGBglg5AfiMMmOcqBWRIjRN6CEig4T8YKJcOWtIDaUVnSFW21zUiJyEEQ1N6QwNUDtRuETbPm/YeZEjiZW7GgCV8hsCGgACpGUDGhH+lM0EgYIBggBYHFbbXNSInIQRDU3pDA1QO1G4RNs+b9h5kSOJlbsFoVgd4VbbXNSInIQRDU3pDA1QO1G4RNs+b9h5kSOJlbsaAExLQKEAgoJYIDHFsozgC4AMMNymh4uSd8Xls6VSRnf9Dxv6kiJPzsubWEAXpQuoGfhAzvgfp0H9ouqVNr4ZQPpQnFG9frwUkkyzA7dLIl1GmIuFbkJFMp3AakfKpXSZ9s+3dpaw9hYFkKgLglgg6cWNnhkPKitPspqy3T6+Lqi2VU1F/s8JE36FUprlBHBYQICDQmLn20i7qEzQSnFGhJv3Yp2qiAFF/6XxaqOeIvva6u/jxDYC/CFoA3UV4B6thf4QFJZ9owY9EsOhQuu14A319g=="
When I confirm Yoroi transfer funds
Then I should see the dashboard stake1u9tdkhx53zwggygdfh5scr2s8dgms3xm8ehas7v3ywyetwcufngyf
Then I should see the dashboard screen
@it-157
Scenario: User can withdraw Ledger rewards from the dashboard w/ deregister (IT-157)
Given I connected Ledger device 707fa118bf6b84
Expand Down
30 changes: 27 additions & 3 deletions packages/yoroi-extension/features/mock-chain/TestWallets.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// @flow

import { commonWalletPassword } from '../support/helpers/common-constants';

export type RestorationInput = {|
name: string,
password: string,
Expand All @@ -8,6 +10,10 @@ export type RestorationInput = {|
deviceId?: ?string,
|};

function getMnemonicFromEnv(walletName): string {
return process.env[walletName] ?? '';
}

function createWallet(payload: {|
name: string,
mnemonic: string,
Expand All @@ -20,15 +26,15 @@ function createWallet(payload: {|
name,
mnemonic,
plate,
password: 'asdfasdfasdf',
password: commonWalletPassword,
deviceId: payload.deviceId,
} };
}

// You can use this website to generate more mnemonics if you need for testing
// https://iancoleman.io/bip39/

type WalletNames =
export type WalletNames =
'shelley-simple-24' |
'shelley-simple-15' |
'shelley-delegated' |
Expand All @@ -48,7 +54,10 @@ type WalletNames =
'shelley-enterprise' |
'shelley-mangled' |
'ergo-token-wallet' |
'cardano-token-wallet';
'cardano-token-wallet' |
'First-Smoke-Test-Wallet' |
'Second-Smoke-Test-Wallet' |
'Second-Smoke-Test-Wallet-FF';

// eslint-disable-next-line prefer-object-spread
export const testWallets: { [key: WalletNames]: RestorationInput, ... } = Object.assign(
Expand Down Expand Up @@ -161,4 +170,19 @@ export const testWallets: { [key: WalletNames]: RestorationInput, ... } = Object
mnemonic: 'rent sword help dynamic enhance collect biology drama agent raven grape bike march length leisure',
plate: 'HZPX-1482',
}),
createWallet({
name: ('First-Smoke-Test-Wallet': WalletNames),
mnemonic: getMnemonicFromEnv('FIRST_SMOKE_TEST_WALLET'),
plate: 'XONT-4910'
}),
createWallet({
name: ('Second-Smoke-Test-Wallet': WalletNames),
mnemonic: getMnemonicFromEnv('SECOND_SMOKE_TEST_WALLET'),
plate: 'XZHD-1651',
}),
createWallet({
name: ('Second-Smoke-Test-Wallet-FF': WalletNames),
mnemonic: getMnemonicFromEnv('SECOND_SMOKE_TEST_WALLET_FF'),
plate: 'CJBE-8896'
}),
);
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ export function getMockServer(settings: {
outputLog?: boolean,
...
}): typeof MockServer {
const dir = `${testRunsDataDir}cardanoMockServerLogs`;
fs.mkdirSync(dir);
const dir = `${testRunsDataDir}_cardanoMockServerLogs`;
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, { recursive: true });
}
const loggerPath = `${dir}/cardanoMockServerLog_${getLogDate()}.log`;

logger = simpleNodeLogger.createSimpleFileLogger(loggerPath);
Expand Down
67 changes: 67 additions & 0 deletions packages/yoroi-extension/features/pages/createWalletPage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// @flow

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

export const walletInfoDialog: LocatorObject = { locator: '.WalletCreateDialog', method: 'css' };
export const creationConfirmButton: LocatorObject = {
locator: '.WalletCreateDialog .primary',
method: 'css',
};
export const backupPrivacyWarningDialog: LocatorObject = {
locator: '.WalletBackupPrivacyWarningDialog',
method: 'css',
};
export const creationWarningContinueButton: LocatorObject = {
locator: '.WalletBackupPrivacyWarningDialog .primary',
method: 'css',
};
export const nobodyLooksCheckbox: LocatorObject = {
locator: '.MuiFormControlLabel-root',
method: 'css',
};
export const walletRecoveryPhraseDisplayDialog: LocatorObject = {
locator: '.WalletRecoveryPhraseDisplayDialog',
method: 'css',
};
export const mnemonicPhraseText: LocatorObject = {
locator: '.WalletRecoveryPhraseMnemonic_component',
method: 'css',
};
export const iWrittenDownButton: LocatorObject = {
locator: '.WalletRecoveryPhraseDisplayDialog .primary',
method: 'css',
};
export const recoveryPhraseEntryDialog: LocatorObject = {
locator: '.WalletRecoveryPhraseEntryDialog',
method: 'css',
};
const recoveryPhraseWord: LocatorObject = {
locator: '.WalletRecoveryPhraseEntryDialog_words .MnemonicWord_component',
method: 'css',
};
export const repeatRecoveryPhrase = async (
customWorld: any,
mnemonicPhrase: string
): Promise<void> => {
const mnemonicPhraseSplit = mnemonicPhrase.split(' ');
for (const mnemonicPhraseWord of mnemonicPhraseSplit) {
const allWords = await customWorld.findElements(recoveryPhraseWord);
for (const wordElement of allWords) {
const elementText = await wordElement.getText();
if (elementText !== mnemonicPhraseWord) continue;
await wordElement.click();
}
}
await customWorld.driver.sleep(500);
};

const recoveryPhraseEntryDialogCheckboxes: LocatorObject = { locator: '.WalletRecoveryPhraseEntryDialog_checkbox', method: 'css' };

export const checkRecoveryPhrase2Checkboxes = async (customWorld: any) => {
const allCheckboxes = await customWorld.findElements(recoveryPhraseEntryDialogCheckboxes);
for (const checkbox of allCheckboxes) {
await checkbox.click();
}
}

export const recoveryPhraseEntryDialogConfirmButton: LocatorObject = { locator: '.WalletRecoveryPhraseEntryDialog .primary', method: 'css' };
16 changes: 16 additions & 0 deletions packages/yoroi-extension/features/pages/dashboardPage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// @flow

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

export const cardValueText: LocatorObject = { locator: '.UserSummary_value', method: 'css' };
export const getTotalAdaValue = async (customWorld: any): Promise<number> => {
const cardsElements = await customWorld.findElements(cardValueText)
const totalValueText = await cardsElements[0].getText()
return parseFloat((totalValueText).split(' ')[0])
}

export const getRewardValue = async (customWorld: any): Promise<number> => {
const cardsElements = await customWorld.findElements(cardValueText)
const rewardValueText = await cardsElements[1].getText()
return parseFloat((rewardValueText).split(' ')[0])
}
11 changes: 11 additions & 0 deletions packages/yoroi-extension/features/pages/newWalletPages.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,25 @@ export const pickUpCurrencyDialog: LocatorObject = { locator: '.PickCurrencyOpti
export const getCurrencyButton = (currency: string): LocatorObject => {
return { locator: `.PickCurrencyOptionDialog_${currency}`, method: 'css' };
};
// Create options dialog
export const createOptionDialog: LocatorObject = { locator: '.WalletCreateOptionDialog', method: 'css' };
export const createNormalWalletButton: LocatorObject = { locator: '.WalletCreateOptionDialog_createWallet', method: 'css' };
export const createPaperWalletButton: LocatorObject = { locator: '.WalletCreateOptionDialog_restorePaperWallet', method: 'css' };

// Restore options dialog
export const restoreOptionDialog: LocatorObject = { locator: '.WalletRestoreOptionDialog', method: 'css' };
export const normalWordWalletButton: LocatorObject = { locator: '.WalletRestoreOptionDialog_restoreNormalWallet', method: 'css' };

// HW options dialog
export const hwOptionsDialog: LocatorObject = { locator: '.WalletConnectHWOptionDialog', method: 'css' };
export const ledgerWalletButton: LocatorObject = { locator: '.WalletConnectHWOptionDialog_connectLedger', method: 'css' };
export const trezorWalletButton: LocatorObject = { locator: '.WalletConnectHWOptionDialog_connectTrezor', method: 'css' };

// Era options dialog
export const eraOptionsDialog: LocatorObject = { locator: '.WalletEraOptionDialog', method: 'css' };
export const shelleyEraButton: LocatorObject = { locator: '.WalletEraOptionDialog_bgShelleyMainnet', method: 'css' };
export const byronEraButton: LocatorObject = { locator: '.WalletEraOptionDialog_bgByronMainnet', method: 'css' };

// Trezor connect dialog
export const trezorConnectDialog: LocatorObject = { locator: '.CheckDialog', method: 'css' };
export const trezorWalletName: LocatorObject = { locator: '//input[@name="walletName"]', method: 'xpath' };
Expand Down
Loading