mirror of
https://github.com/trezor/trezor-suite.git
synced 2026-02-20 00:33:07 +01:00
tests(e2e): visual testing
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -7,3 +7,4 @@ packages/suite-data/files/bin/tor/mac-*/*.dylib filter=lfs diff=lfs merge=lfs -t
|
||||
packages/suite-data/files/bin/tor/mac-*/tor filter=lfs diff=lfs merge=lfs -text
|
||||
packages/suite-data/files/bin/tor/win-*/*.dll filter=lfs diff=lfs merge=lfs -text
|
||||
packages/suite-data/files/bin/tor/win-*/tor.exe filter=lfs diff=lfs merge=lfs -text
|
||||
packages/integration-tests/projects/suite-web/snapshots/** filter=lfs diff=lfs merge=lfs -text
|
||||
|
||||
@@ -80,7 +80,7 @@ suite-web deploy dev:
|
||||
CYPRESS_ASSET_PREFIX: /web
|
||||
CYPRESS_baseUrl: ${DEV_SERVER_URL}/suite-web/${CI_BUILD_REF_NAME}
|
||||
# should tests do snapshot testing
|
||||
CYPRESS_SNAPSHOT: 0
|
||||
CYPRESS_SNAPSHOT: 1
|
||||
# reporter url
|
||||
TRACK_SUITE_URL: https://track-suite.herokuapp.com
|
||||
# when debugging or developing tests it does not make sense to have retries,
|
||||
@@ -102,6 +102,7 @@ suite-web deploy dev:
|
||||
- ./packages/integration-tests/projects/suite-web/snapshots
|
||||
- ./packages/integration-tests/projects/suite-web/screenshots
|
||||
- ./packages/integration-tests/projects/suite-web/videos
|
||||
- download-snapshots.sh
|
||||
|
||||
e2e web suite:
|
||||
extends: .e2e web
|
||||
@@ -128,6 +129,58 @@ e2e web metadata:
|
||||
variables:
|
||||
TEST_GROUP: '@group:metadata'
|
||||
|
||||
# Update snapshots
|
||||
# You may update snapshots either locally (see readme https://docs.trezor.io/trezor-suite/tests/e2e-web.html)
|
||||
# But as this is quite time consuming you may prefer to do it in CI
|
||||
|
||||
# TODO: should there be one job updating all? not sure
|
||||
e2e web suite snapshots:
|
||||
when: manual
|
||||
extends: .e2e web
|
||||
variables:
|
||||
CYPRESS_SNAPSHOT: 1
|
||||
CYPRESS_updateSnapshots: 1
|
||||
TEST_GROUP: '@group:suite'
|
||||
|
||||
e2e web onboarding snapshots:
|
||||
when: manual
|
||||
extends: .e2e web
|
||||
variables:
|
||||
CYPRESS_SNAPSHOT: 1
|
||||
CYPRESS_updateSnapshots: 1
|
||||
TEST_GROUP: '@group:onboarding'
|
||||
|
||||
e2e web device-management snapshots:
|
||||
when: manual
|
||||
extends: .e2e web
|
||||
variables:
|
||||
CYPRESS_SNAPSHOT: 1
|
||||
CYPRESS_updateSnapshots: 1
|
||||
TEST_GROUP: '@group:device-management'
|
||||
|
||||
e2e web settings snapshots:
|
||||
when: manual
|
||||
extends: .e2e web
|
||||
variables:
|
||||
CYPRESS_SNAPSHOT: 1
|
||||
CYPRESS_updateSnapshots: 1
|
||||
TEST_GROUP: '@group:settings'
|
||||
|
||||
e2e web metadata snapshots:
|
||||
when: manual
|
||||
extends: .e2e web
|
||||
variables:
|
||||
CYPRESS_SNAPSHOT: 1
|
||||
CYPRESS_updateSnapshots: 1
|
||||
TEST_GROUP: '@group:metadata'
|
||||
|
||||
e2e web all snapshots:
|
||||
when: manual
|
||||
extends: .e2e web
|
||||
variables:
|
||||
CYPRESS_SNAPSHOT: 1
|
||||
CYPRESS_updateSnapshots: 1
|
||||
|
||||
# TODO scheduled jobs against beta chrome channel
|
||||
# TODO scheduled jobs against suite.trezor.io
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ services:
|
||||
entrypoint: []
|
||||
environment:
|
||||
- CYPRESS_SNAPSHOT=$CYPRESS_SNAPSHOT
|
||||
- CYPRESS_updateSnapshots=$CYPRESS_updateSnapshots
|
||||
- CYPRESS_baseUrl=$CYPRESS_baseUrl
|
||||
- CYPRESS_ASSET_PREFIX=$CYPRESS_ASSET_PREFIX
|
||||
- LOCAL_USER_ID=$LOCAL_USER_ID
|
||||
|
||||
@@ -28,6 +28,7 @@ services:
|
||||
network_mode: service:trezor-user-env-unix
|
||||
environment:
|
||||
- CYPRESS_SNAPSHOT=$CYPRESS_SNAPSHOT
|
||||
- CYPRESS_updateSnapshots=$CYPRESS_updateSnapshots
|
||||
- CYPRESS_baseUrl=http://localhost:3000
|
||||
- CYPRESS_defaultCommandTimeout=60000 # on dev server, due to on-demand compilation nature of next.js, we need much longer timeout
|
||||
- DISPLAY=$DISPLAY
|
||||
|
||||
10
docker/docker-suite-snapshots.sh
Executable file
10
docker/docker-suite-snapshots.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
# todo: I am not sure whether locally generated snapshots won't somethimes differ from CI generated, this is to be tested
|
||||
|
||||
xhost +
|
||||
export LOCAL_USER_ID=`id -u $USER`
|
||||
export CYPRESS_SNAPSHOT=1
|
||||
export CYPRESS_updateSnapshots=1
|
||||
|
||||
docker-compose -f ./docker/docker-compose.suite-test.yml up --build --abort-on-container-exit
|
||||
@@ -12,16 +12,23 @@ is the entrypoint for e2e tests. It:
|
||||
- retries tests if needed (see @retry)
|
||||
- reports tests results
|
||||
|
||||
## @tags
|
||||
Each test should be assigned a tag at the top of the test file. Doing so enables run_tests.js script
|
||||
to sort the test files into groups and run them in parallel on CI. At the moment these tags exist:
|
||||
## tags
|
||||
Each test should be assigned a tag at the top of the test file. These allow you to add more fine grained control
|
||||
in run_tests.js.
|
||||
|
||||
At the moment, there are following tags:
|
||||
- @group:[string]
|
||||
- @retry=[number]
|
||||
|
||||
### @group
|
||||
Assigning a @group allows run_tests.js script to sort the test files into groups and run them in parallel on CI. At the moment these groups exist:
|
||||
- `@group:metadata`
|
||||
- `@group:device-management`
|
||||
- `@group:suite`
|
||||
- `@group:onboarding`
|
||||
- `@group:settings`
|
||||
|
||||
## @retry
|
||||
### @retry
|
||||
If there is a test that you for any reason need to retry if it fails you may provide `@retry=2` tag. In this
|
||||
case, test will be ran 3 times in total and count as failed only if all runs fail.
|
||||
|
||||
@@ -44,7 +51,10 @@ Disclaimer: GUI from docker container does not work on mac. Only linux is suppor
|
||||
It is possible to run tests with image snapshots to test for visual regressions. To enable snapshots, use env variable:
|
||||
|
||||
`CYPRESS_SNAPSHOT=1 ./docker/docker-suite-test.sh`
|
||||
|
||||
|
||||
When you need to update image snapshots you have 2 options:
|
||||
- use CI job. This will generate new snapshots in artifacts together with a handy script that updates your snapshots locally. Check the log output.
|
||||
- use `./docker/docker-suite-snapshots.sh`. This does the same as `./docker/docker-suite-test.sh`, the only difference is it won't fail on non-matching snapshots but generate new snapshots.
|
||||
# Old notes (to be removed)
|
||||
|
||||
## Notes on bridge (trezord)
|
||||
|
||||
@@ -8,6 +8,7 @@ const shell = require('shelljs');
|
||||
const { argv } = require('yargs');
|
||||
const fetch = require('node-fetch');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
const TEST_DIR = './packages/integration-tests/projects/suite-web';
|
||||
|
||||
@@ -60,12 +61,13 @@ async function runTests() {
|
||||
CI_COMMIT_SHA,
|
||||
// CI_RUNNER_ID,
|
||||
CI_RUNNER_DESCRIPTION,
|
||||
CYPRESS_updateSnapshots,
|
||||
} = process.env;
|
||||
|
||||
const { stage } = argv;
|
||||
|
||||
if (!TRACK_SUITE_URL) {
|
||||
console.log('[run_tests.js] TRACK_SUITE_URL env not specified. No logs will be uploaded');
|
||||
if (!TRACK_SUITE_URL || CYPRESS_updateSnapshots) {
|
||||
console.log('[run_tests.js] TRACK_SUITE_URL env not specified or CYPRESS_updateSnapshots is set. No logs will be uploaded');
|
||||
}
|
||||
const finalTestFiles = getTestFiles().sort((a, b) => a.localeCompare(b));
|
||||
|
||||
@@ -88,6 +90,7 @@ async function runTests() {
|
||||
duration: 0,
|
||||
stage,
|
||||
records: {},
|
||||
tests: [],
|
||||
};
|
||||
|
||||
for (let i = 0; i < finalTestFiles.length; i++) {
|
||||
@@ -141,6 +144,8 @@ async function runTests() {
|
||||
|
||||
const { totalFailed, totalPending, totalDuration } = runResult;
|
||||
|
||||
const tests = runResult.runs[0].tests;
|
||||
|
||||
console.log(`[run_tests.js] ${testFileName} duration: ${totalDuration}`);
|
||||
log.duration += totalDuration;
|
||||
|
||||
@@ -149,6 +154,7 @@ async function runTests() {
|
||||
if (testRunNumber === allowedRuns) {
|
||||
failedTests += totalFailed;
|
||||
log.records[testFileName] = 'failed';
|
||||
log.tests.push(...tests);
|
||||
console.log(
|
||||
`[run_tests.js] test ${testFileName} finished failing after ${allowedRuns} run(s)`,
|
||||
);
|
||||
@@ -161,6 +167,8 @@ async function runTests() {
|
||||
continue;
|
||||
}
|
||||
|
||||
log.tests.push(...tests);
|
||||
|
||||
if (totalPending > 0) {
|
||||
// log either success or retried (success after retry)
|
||||
log.records[testFileName] = 'skipped';
|
||||
@@ -182,9 +190,7 @@ async function runTests() {
|
||||
}
|
||||
}
|
||||
|
||||
console.log(JSON.stringify(log, null, 2));
|
||||
|
||||
if (TRACK_SUITE_URL) {
|
||||
if (TRACK_SUITE_URL && !CYPRESS_updateSnapshots) {
|
||||
console.log(`[run_tests.js] uploading logs to ${TRACK_SUITE_URL}.`);
|
||||
const response = await fetch(`${TRACK_SUITE_URL}/api/test-records`, {
|
||||
method: 'POST',
|
||||
@@ -199,13 +205,53 @@ async function runTests() {
|
||||
}
|
||||
}
|
||||
|
||||
// beta is only for collecting statistics, so it exits with non-zero code
|
||||
// if there is some runtime error.
|
||||
if (stage === '@beta') {
|
||||
process.exit(0);
|
||||
}
|
||||
console.log('CYPRESS_updateSnapshots', CYPRESS_updateSnapshots);
|
||||
|
||||
console.log(`Browse test results: ${TRACK_SUITE_URL}`);
|
||||
if (CYPRESS_updateSnapshots) {
|
||||
const script = `
|
||||
#!/bin/sh
|
||||
diff_pre=$(git status --porcelain=v1 2>/dev/null | wc -l)
|
||||
if [ $diff_pre -gt 0 ]
|
||||
then
|
||||
echo "You have unstaged changes."
|
||||
exit 1
|
||||
fi
|
||||
mkdir tmp
|
||||
cd tmp
|
||||
wget ${CI_JOB_URL}/artifacts/download
|
||||
unzip download
|
||||
cp -rf packages/integration-tests/projects/suite-web/snapshots ../packages/integration-tests/projects/suite-web
|
||||
cd ../
|
||||
rm -rf ./tmp
|
||||
git status
|
||||
diff_after=$(git status --porcelain=v1 2>/dev/null | wc -l)
|
||||
if [ $diff_after -eq 0 ]
|
||||
then
|
||||
echo "There are no new snapshots."
|
||||
exit 0
|
||||
fi
|
||||
git add .
|
||||
git commit -m "e2e${stage ? `(${stage}):` : ':'} update snapshots"
|
||||
git log -n 2
|
||||
echo "You may now push your changes."
|
||||
`;
|
||||
|
||||
console.log('Generated script to update files locally');
|
||||
console.log(script);
|
||||
|
||||
console.log(`
|
||||
EXECUTE ^^ SCRIPT TO UPDATE SNAPSHOTS THAT CHANGED LOCALLY
|
||||
*******************************************************************
|
||||
|
||||
curl ${CI_JOB_URL}/artifacts/raw/download-snapshots.sh | bash
|
||||
|
||||
*******************************************************************
|
||||
`);
|
||||
|
||||
fs.appendFileSync('download-snapshots.sh', script);
|
||||
} else {
|
||||
console.log(`[run_tests.js] Logs recorded ${TRACK_SUITE_URL}/#/${CI_COMMIT_BRANCH}/${CI_COMMIT_SHA}.`);
|
||||
}
|
||||
|
||||
process.exit(failedTests);
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 78 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 26 KiB |
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:534a83f0c91f24572a17dbe86c4b541ab7e8b9284186929059a7edd4252cba5c
|
||||
size 76160
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e832dbcc5193eadc96c550ffd6cd87cdf96f4a973aca3946f1fde42095f85c46
|
||||
size 34419
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:22fddd1fcea7fb69f8b9f635bf62c660fbcdeafdbdafd822bf30f9c25bcdd1fd
|
||||
size 15562
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:128ff1dbb2f4df5b13bcd7bd628132c81a6f56fd7716f04528940083197b5505
|
||||
size 22791
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7b49201b6639af03c0a6b0a025de83c0253f4da5e9a95077e193437e4defc66a
|
||||
size 22594
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:94e9e36436ff402d33ecc9caa07eeb1410b5abfc5f7533d6f3b6932be44406b9
|
||||
size 34309
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:22fd97547197cdf5dd5c1cdd2a7340d3f2a89655d0c06c5e15e3ea7f5e112720
|
||||
size 22237
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:56e067c6cb90eeb5c52a0d17cbe91477452af52581d6e45480b4b7e2026ed684
|
||||
size 100222
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:42e1a88341b80c4ed96732176482a60c543dd4b692c3499a3808f6406daad3d8
|
||||
size 35364
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:47fe9a84c30a2b6f14e56154596d945ca3f00f9c6f45cdfe37c9cb11f612223a
|
||||
size 30334
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 54 KiB |
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:278b6c48554ac78e142d2cd914022d77a8d4f8a8aba4fffc20faa77134b72682
|
||||
size 57254
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:964f24c46c782fe99c014752fb03e8e61afee25fab9897b3f57f4588723bc9bc
|
||||
size 36235
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:964f24c46c782fe99c014752fb03e8e61afee25fab9897b3f57f4588723bc9bc
|
||||
size 36235
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1e2380f24aae3c279ec8a8cb203c2ce860d3043c83273dd8b9b566e1052c17c3
|
||||
size 42038
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c7f3af71c5bd83467e892bf712d38391568b0c8c79caf1861a1833ff75f6924d
|
||||
size 9835
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:793a86b6003f6a8895999ac24fa5e19f2a5ceb73381d2af501caa510f242558a
|
||||
size 26878
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:72b75c6c1237844f20121f7cf991cf4d0d5269d5b71ee1cc8dad501ea4689101
|
||||
size 27531
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7d83b50706c125cec61d0fc4003e72b5236c51b44defe4e59611cd71e431624b
|
||||
size 17692
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3025e201516f89522fc7f3a90126ce7dab9c559aca87ae400d869336410d6a26
|
||||
size 7852
|
||||
@@ -20,7 +20,7 @@ describe('Backup', () => {
|
||||
cy.getConfirmActionOnDeviceModal();
|
||||
cy.task('pressYes');
|
||||
cy.task('stopEmu');
|
||||
cy.getTestElement('@backup/no-device', { timeout: 20000 });
|
||||
cy.getTestElement('@backup/no-device', { timeout: 30000 });
|
||||
cy.task('startEmu');
|
||||
cy.getTestElement('@backup/error-message', { timeout: 30000 });
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// @group:device-management
|
||||
// @group:wip
|
||||
|
||||
describe('Backup', () => {
|
||||
beforeEach(() => {
|
||||
@@ -16,7 +15,7 @@ describe('Backup', () => {
|
||||
// access from notification
|
||||
cy.getTestElement('@notification/no-backup/button').click();
|
||||
|
||||
cy.getTestElement('@backup').matchImageSnapshot('backup')
|
||||
cy.getTestElement('@backup').matchImageSnapshot('backup-confirm-security-screen')
|
||||
|
||||
cy.getTestElement('@backup/check-item/understands-what-seed-is').click();
|
||||
cy.getTestElement('@backup/check-item/has-enough-time').click();
|
||||
|
||||
@@ -11,7 +11,15 @@ describe('Windows 10 with edge browser ', () => {
|
||||
|
||||
it('Should display unsupported browsers page', () => {
|
||||
cy.prefixedVisit('/');
|
||||
cy.document().its('fonts.status').should('equal', 'loaded');
|
||||
cy.get('html').should('contain.text', 'Your browser is not supported');
|
||||
cy.screenshot();
|
||||
cy.get('img')
|
||||
.should('be.visible')
|
||||
.and($img => {
|
||||
// "naturalWidth" and "naturalHeight" are set when the image loads
|
||||
expect($img[0].naturalWidth).to.be.greaterThan(0);
|
||||
expect($img[1].naturalWidth).to.be.greaterThan(0);
|
||||
});
|
||||
cy.matchImageSnapshot('browser is not supported at all');
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
@@ -11,7 +11,8 @@ describe('iPhone with chrome browser ', () => {
|
||||
|
||||
it('There is no way to connect trezor to iPhone at the moment', () => {
|
||||
cy.prefixedVisit('/');
|
||||
cy.document().its('fonts.status').should('equal', 'loaded');
|
||||
cy.get('body').should('contain.text', 'No WebUSB support');
|
||||
cy.screenshot();
|
||||
cy.matchImageSnapshot('no webusb support');
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
@@ -12,7 +12,8 @@ describe('Windows 7 with outdated chrome ', () => {
|
||||
|
||||
it('Should just display outdated browser', () => {
|
||||
cy.prefixedVisit('/');
|
||||
cy.document().its('fonts.status').should('equal', 'loaded');
|
||||
cy.get('html').should('contain.text', 'Your browser is outdated');
|
||||
cy.screenshot();
|
||||
cy.matchImageSnapshot('chrome is supported but outdated');
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
@@ -11,7 +11,8 @@ describe('Ubuntu with outdated firefox ', () => {
|
||||
|
||||
it('Should just display outdated browser', () => {
|
||||
cy.prefixedVisit('/');
|
||||
cy.document().its('fonts.status').should('equal', 'loaded');
|
||||
cy.get('html').should('contain.text', 'Your browser is outdated');
|
||||
cy.screenshot();
|
||||
cy.matchImageSnapshot('firefox is supported but outdated');
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
@@ -6,27 +6,37 @@ describe('Firmware', () => {
|
||||
cy.viewport(1024, 768).resetDb();
|
||||
});
|
||||
|
||||
it('Firmware outdated static notification should open firmware update modal', () => {
|
||||
it('Firmware outdated notification banner should open firmware update modal', () => {
|
||||
cy.task('startEmu', { wipe: true, version: '2.3.0' });
|
||||
cy.task('setupEmu');
|
||||
cy.task('startBridge');
|
||||
cy.prefixedVisit('/');
|
||||
cy.passThroughInitialRun();
|
||||
cy.matchImageSnapshot('outdated notification banner');
|
||||
cy.getTestElement('@notification/update-firmware/button').click();
|
||||
|
||||
// initial screen
|
||||
cy.getTestElement('@firmware').matchImageSnapshot('initial');
|
||||
cy.getTestElement('@firmware/continue-button').click();
|
||||
|
||||
// check seed screen
|
||||
cy.getTestElement('@modal/close-button').should('be.visible'); // modal is cancellable at this moment
|
||||
cy.getTestElement('@firmware').matchImageSnapshot('check-seed');
|
||||
cy.getTestElement('@firmware/confirm-seed-checkbox').click();
|
||||
cy.getTestElement('@firmware/confirm-seed-button').click();
|
||||
|
||||
// reconnect in bootloader screen (disconnect)
|
||||
cy.getTestElement('@firmware/disconnect-message');
|
||||
cy.getTestElement('@firmware').matchImageSnapshot('disconnect');
|
||||
cy.task('stopEmu');
|
||||
|
||||
// reconnect in bootloader screen (connect in bootloader)
|
||||
cy.getTestElement('@firmware/connect-in-bootloader-message', { timeout: 20000 });
|
||||
cy.getTestElement('@firmware').matchImageSnapshot('reconnect in bootloader');
|
||||
cy.log(
|
||||
'And this is the end my friends. Emulator does not support bootloader, so we can not proceed with actual fw install',
|
||||
);
|
||||
cy.getTestElement('@modal/close-button').click();
|
||||
|
||||
|
||||
});
|
||||
|
||||
it('For latest firmware, update button in device settings should display "Up to date" but still be clickable', () => {
|
||||
|
||||
@@ -44,11 +44,12 @@ describe('Onboarding - firmware update', () => {
|
||||
cy.getTestElement('@onboarding/back-button').click();
|
||||
cy.getTestElement('@firmware/install-button');
|
||||
|
||||
// unrelated. see how fw update reacts to ButtonRequest_FirmwareCheck button request
|
||||
cy.dispatch({
|
||||
type: 'ui-button',
|
||||
payload: { code: 'ButtonRequest_FirmwareCheck', device: getSuiteDevice() },
|
||||
});
|
||||
cy.getTestElement('@suite/modal/confirm-fingerprint-on-device');
|
||||
cy.matchImageSnapshot();
|
||||
cy.matchImageSnapshot('firmware-confirm fingerprint');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -12,10 +12,10 @@ describe('General settings', () => {
|
||||
});
|
||||
|
||||
it('Change fiat', () => {
|
||||
cy.getTestElement('@settings/fiat');
|
||||
cy.getTestElement('@settings/fiat-select/input').click();
|
||||
cy.getTestElement('@settings/fiat-select/option/eur').click();
|
||||
cy.getTestElement('@suite/menu/suite-index').click();
|
||||
cy.getTestElement('@dashboard/index').should('contain', '€0.00')
|
||||
|
||||
cy.getTestElement('@dashboard/index').should('contain', '€0.00');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11,10 +11,12 @@ describe('Log', () => {
|
||||
cy.passThroughInitialRun();
|
||||
});
|
||||
|
||||
it('open log modal', () => {
|
||||
it('there is a dropdown menu in settings that opens modal with application logs', () => {
|
||||
cy.getTestElement('@settings/menu/dropdown').click();
|
||||
cy.getTestElement('@settings/menu/log').click();
|
||||
cy.getTestElement('@log/copy-button');
|
||||
cy.getTestElement('@log').matchImageSnapshot({ blackout: ['[data-test="@log/content"]'] });
|
||||
|
||||
// todo: check that we really copied something;
|
||||
});
|
||||
});
|
||||
|
||||
@@ -15,14 +15,17 @@ describe('Device settings', () => {
|
||||
cy.getTestElement('@settings/device/pin-switch').click({ force: true });
|
||||
cy.task('pressYes');
|
||||
// todo: add support for pin to trezor-user-env. now I may safely test only wrong pin input
|
||||
cy.getTestElement('@pin/input/1').click();
|
||||
cy.getTestElement('@pin/submit-button').click();
|
||||
cy.log('enter 2 digits instead of 1 in the first entry. This way pin is always wrong');
|
||||
cy.getTestElement('@pin/input/1').click();
|
||||
// cy.getTestElement('@pin').matchImageSnapshot('first pin input');
|
||||
cy.getTestElement('@pin/input/1').click();
|
||||
|
||||
cy.getTestElement('@pin/submit-button').click();
|
||||
cy.getTestElement('@pin-mismatch');
|
||||
cy.log('enter 2 digits instead of 1 in the first entry. This way pin is always wrong');
|
||||
cy.getTestElement('@pin/input/1').click();
|
||||
// cy.getTestElement('@pin').matchImageSnapshot('confirm pin input');
|
||||
cy.getTestElement('@pin/input/1').click();
|
||||
|
||||
cy.getTestElement('@pin/submit-button').click();
|
||||
cy.getTestElement('@pin-mismatch').matchImageSnapshot();
|
||||
cy.getTestElement('@pin-mismatch/try-again-button').click();
|
||||
cy.getTestElement('@suite/modal/confirm-action-on-device');
|
||||
cy.task('pressYes');
|
||||
|
||||
@@ -90,7 +90,7 @@ describe('Stories of device connecting', () => {
|
||||
initialized: true,
|
||||
},
|
||||
);
|
||||
cy.getTestElement('@firmware/index');
|
||||
cy.getTestElement('@firmware');
|
||||
});
|
||||
|
||||
it(`seedless device -> show info about seedless`, () => {
|
||||
@@ -122,7 +122,7 @@ describe('Stories of device connecting', () => {
|
||||
cy.getTestElement('@device-invalid-mode/bootloader');
|
||||
});
|
||||
|
||||
it(`undreadable device -> show info about undreadable device, offer switch device`, () => {
|
||||
it(`unreadable device -> show info about unreadable device, offer switch device`, () => {
|
||||
cy.connectDevice({ path: SECOND_DEVICE_PATH, type: 'unreadable' });
|
||||
cy.toggleDeviceMenu();
|
||||
cy.getTestElement(`@switch-device/${SECOND_DEVICE_PATH}/solve-issue-button`).click();
|
||||
|
||||
@@ -1,26 +1,24 @@
|
||||
// @group:suite
|
||||
// @retry=2
|
||||
|
||||
const fixtures = [
|
||||
{
|
||||
visit: '/bridge',
|
||||
should: ['contain', 'Trezor Bridge'],
|
||||
},
|
||||
{
|
||||
visit: '/version',
|
||||
should: ['contain', 'version'],
|
||||
},
|
||||
] as const;
|
||||
|
||||
describe('Static pages', () => {
|
||||
describe('Static pages accessible even without device', () => {
|
||||
beforeEach(() => {
|
||||
cy.viewport(1024, 768).resetDb();
|
||||
});
|
||||
|
||||
fixtures.forEach(f => {
|
||||
it(`test ${f.visit} page is online`, () => {
|
||||
cy.prefixedVisit(f.visit);
|
||||
cy.get('html').should(f.should[0], f.should[1]);
|
||||
it('/bridge', () => {
|
||||
cy.prefixedVisit('/bridge');
|
||||
cy.get('html').should('contain', 'bridge');
|
||||
cy.getTestElement('@bridge').matchImageSnapshot({
|
||||
blackout: ['[data-test="@bridge/loading"]'],
|
||||
});
|
||||
});
|
||||
|
||||
it('/version', () => {
|
||||
cy.prefixedVisit('/version');
|
||||
cy.get('html').should('contain', 'version');
|
||||
cy.getTestElement('@version').matchImageSnapshot({
|
||||
blackout: ['[data-test="@version/commit-hash-link"]'],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -124,7 +124,7 @@ const PinInput = (props: Props) => {
|
||||
}, [pin, onPinSubmit, onPinAdd, onPinBackspace]);
|
||||
|
||||
return (
|
||||
<Wrapper>
|
||||
<Wrapper data-test="@pin">
|
||||
<InputWrapper>
|
||||
<InputPin value={pin} onDeleteClick={() => onPinBackspace()} />
|
||||
</InputWrapper>
|
||||
|
||||
@@ -82,6 +82,7 @@ const Log = (props: Props) => {
|
||||
onCancel={props.onCancel}
|
||||
heading={<Translation id="TR_LOG" />}
|
||||
description={<Translation id="LOG_DESCRIPTION" />}
|
||||
data-test="@log"
|
||||
bottomBar={
|
||||
<ButtonWrapper>
|
||||
<Button variant="secondary" onClick={() => copy()} data-test="@log/copy-button">
|
||||
@@ -97,7 +98,9 @@ const Log = (props: Props) => {
|
||||
</ButtonWrapper>
|
||||
}
|
||||
>
|
||||
<LogWrapper ref={htmlElement}>{log}</LogWrapper>
|
||||
<LogWrapper ref={htmlElement} data-test="@log/content">
|
||||
{log}
|
||||
</LogWrapper>
|
||||
<SectionItem>
|
||||
<TextColumn
|
||||
title={<Translation id="LOG_INCLUDE_BALANCE_TITLE" />}
|
||||
|
||||
@@ -209,7 +209,7 @@ const Firmware = ({ closeModalApp, resetReducer, firmware, device, modal }: Prop
|
||||
}
|
||||
onCancel={onClose}
|
||||
useFixedHeight
|
||||
data-test="@firmware/index"
|
||||
data-test="@firmware"
|
||||
heading={Component.Heading}
|
||||
bottomBar={!modal && <Buttons>{Component.BottomBar}</Buttons>}
|
||||
totalProgressBarSteps={stepsInProgressBar.length}
|
||||
|
||||
@@ -93,7 +93,7 @@ const Settings = ({
|
||||
return (
|
||||
<SettingsLayout data-test="@settings/index">
|
||||
<Section title={<Translation id="TR_LOCALIZATION" />}>
|
||||
<SectionItem>
|
||||
<SectionItem data-test="@settings/language">
|
||||
<TextColumn title={<Translation id="TR_LANGUAGE" />} />
|
||||
<ActionColumn>
|
||||
<ActionSelect
|
||||
@@ -122,7 +122,7 @@ const Settings = ({
|
||||
</ActionColumn>
|
||||
</SectionItem>
|
||||
|
||||
<SectionItem>
|
||||
<SectionItem data-test="@settings/fiat">
|
||||
<TextColumn title={<Translation id="TR_PRIMARY_FIAT" />} />
|
||||
<ActionColumn>
|
||||
<ActionSelect
|
||||
@@ -147,7 +147,7 @@ const Settings = ({
|
||||
</Section>
|
||||
|
||||
<Section title={<Translation id="TR_LABELING" />}>
|
||||
<SectionItem>
|
||||
<SectionItem data-test="@settings/metadata">
|
||||
<TextColumn
|
||||
title={<Translation id="TR_LABELING_ENABLED" />}
|
||||
description={<Translation id="TR_LABELING_FEATURE_ALLOWS" />}
|
||||
@@ -172,7 +172,7 @@ const Settings = ({
|
||||
</ActionColumn>
|
||||
</SectionItem>
|
||||
{metadata.enabled && metadata.provider && (
|
||||
<SectionItem>
|
||||
<SectionItem data-test="@settings/metadata-provider">
|
||||
<TextColumn
|
||||
title={
|
||||
metadata.provider.isCloud ? (
|
||||
@@ -308,7 +308,7 @@ const Settings = ({
|
||||
<Theme />
|
||||
<Analytics />
|
||||
|
||||
<SectionItem>
|
||||
<SectionItem data-test="@settings/storage">
|
||||
<TextColumn
|
||||
title={<Translation id="TR_SUITE_STORAGE" />}
|
||||
description={<Translation id="TR_CLEAR_STORAGE_DESCRIPTION" />}
|
||||
@@ -332,7 +332,7 @@ const Settings = ({
|
||||
</ActionButton>
|
||||
</ActionColumn>
|
||||
</SectionItem>
|
||||
<SectionItem>
|
||||
<SectionItem data-test="@settings/version">
|
||||
<TextColumn
|
||||
title={<Translation id="TR_SUITE_VERSION" />}
|
||||
description={
|
||||
|
||||
@@ -144,6 +144,7 @@ const InstallBridge = (props: Props) => {
|
||||
<Modal
|
||||
heading={<Translation id="TR_TREZOR_BRIDGE_DOWNLOAD" />}
|
||||
description={<Translation id="TR_NEW_COMMUNICATION_TOOL" />}
|
||||
data-test="@bridge"
|
||||
>
|
||||
<Head>
|
||||
<title>Download Bridge | Trezor Suite</title>
|
||||
@@ -162,7 +163,7 @@ const InstallBridge = (props: Props) => {
|
||||
</Version>
|
||||
<StyledImage image="T_BRIDGE_CHECK" />
|
||||
{isLoading ? (
|
||||
<LoaderWrapper>
|
||||
<LoaderWrapper data-test="@bridge/loading">
|
||||
<CenteredLoader size={50} strokeWidth={2} />
|
||||
<P>
|
||||
<Translation id="TR_GATHERING_INFO" />
|
||||
|
||||
@@ -14,7 +14,7 @@ const Line = styled.div`
|
||||
`;
|
||||
|
||||
const Version = () => (
|
||||
<Modal>
|
||||
<Modal data-test="@version">
|
||||
<Wrapper>
|
||||
<P size="small" weight="bold">
|
||||
APPLICATION VERSION
|
||||
@@ -24,7 +24,10 @@ const Version = () => (
|
||||
<P size="small" weight="bold">
|
||||
LAST COMMIT HASH
|
||||
</P>
|
||||
<Link href={`https://github.com/trezor/trezor-suite/commits/${process.env.COMMITHASH}`}>
|
||||
<Link
|
||||
href={`https://github.com/trezor/trezor-suite/commits/${process.env.COMMITHASH}`}
|
||||
data-test="@version/commit-hash-link"
|
||||
>
|
||||
<H2>{process.env.COMMITHASH}</H2>
|
||||
</Link>
|
||||
</Wrapper>
|
||||
|
||||
Reference in New Issue
Block a user