diff --git a/cypress/E2E_TESTING_GUIDE.md b/cypress/E2E_TESTING_GUIDE.md index 37f655e99..a024bba11 100644 --- a/cypress/E2E_TESTING_GUIDE.md +++ b/cypress/E2E_TESTING_GUIDE.md @@ -33,6 +33,8 @@ cy.get('[data-testid="activity"]') Takes the HTML of the visible activity and matches it against the old version. If you need to update the snapshots, remove the outdated one and rerun the tests. +You can also run `npm run cy:record`, and then check the appropriate `git diff`. + ## Should I write an e2e test? E2e tests are very expensive compared to other ones. If you are writing tests for a minor bug, try to write a unit test first. You should write e2e tests for: diff --git a/cypress/e2e/wallet_balance.cy.js b/cypress/e2e/wallet_balance.cy.js index dee9764b3..32813e976 100644 --- a/cypress/e2e/wallet_balance.cy.js +++ b/cypress/e2e/wallet_balance.cy.js @@ -3,7 +3,10 @@ describe('Wallet balance tests', () => { cy.clearDb(); const now = new Date(2024, 11, 5); cy.clock(now); - cy.playback('GET', /explorer/, { toBeCalledAtLeast: 4 }).as('sync'); + cy.playback('GET', /address/, { + toBeCalledAtLeast: 4, + matching: { ignores: ['hostname', 'port'] }, + }).as('sync'); cy.visit('/'); cy.importWallet('DLabsktzGMnsK5K9uRTMCF6NoYNY6ET4Bb'); }); @@ -11,7 +14,7 @@ describe('Wallet balance tests', () => { for (let i = 0; i < 5; i++) { cy.wait('@sync'); } - cy.get('[data-testid="primaryBalance"]').contains('1,297'); + cy.get('[data-testid="primaryBalance"]').contains('0'); for (let i = 0; i < 10; i++) { cy.get('[data-testid="activity"]') diff --git a/cypress/fixtures/e2e/wallet-balance-cy/wallet-balance-tests-calculates-balance-correctly.cy-playback b/cypress/fixtures/e2e/wallet-balance-cy/wallet-balance-tests-calculates-balance-correctly.cy-playback index fc91f00c1..86165a84f 100644 Binary files a/cypress/fixtures/e2e/wallet-balance-cy/wallet-balance-tests-calculates-balance-correctly.cy-playback and b/cypress/fixtures/e2e/wallet-balance-cy/wallet-balance-tests-calculates-balance-correctly.cy-playback differ diff --git a/cypress/snapshots/html/snapshot.html b/cypress/snapshots/html/snapshot.html index c529356ae..66567e073 100644 --- a/cypress/snapshots/html/snapshot.html +++ b/cypress/snapshots/html/snapshot.html @@ -1,4 +1,28 @@ -
Time | Description | Amount | |
---|---|---|---|
11/02/24 | Block Reward | 4.00 PIV |