From 5ad6ca61a9fc2d0ffaeb2819b44ca383e60922e8 Mon Sep 17 00:00:00 2001 From: Michalina Date: Thu, 27 Jul 2023 15:24:31 +0200 Subject: [PATCH] Rename `verify...` functions to `assert...` As we have functionality of verifying assets in the wallet, we recently started to use `assert` nomenclature in the names of the new functions and methods checking certain areas of the wallet. This was done to avoid confusion in the naming. Now we update the older function using the `verify...` prefix, to make the naming consistent across all our test-related files. --- e2e-tests/fork-based/transactions.spec.ts | 34 +++++++++++------------ e2e-tests/regular/token-trust.spec.ts | 12 ++++---- e2e-tests/regular/transactions.spec.ts | 20 ++++++------- e2e-tests/utils/assets.ts | 4 +-- e2e-tests/utils/transactions.ts | 10 +++---- e2e-tests/utils/walletPageHelper.ts | 14 +++++----- 6 files changed, 47 insertions(+), 47 deletions(-) diff --git a/e2e-tests/fork-based/transactions.spec.ts b/e2e-tests/fork-based/transactions.spec.ts index 5809c77f92..ba135222ce 100644 --- a/e2e-tests/fork-based/transactions.spec.ts +++ b/e2e-tests/fork-based/transactions.spec.ts @@ -47,12 +47,12 @@ test.describe("Transactions", () => { * Verify we're on Ethereum network. Verify common elements on the main * page. */ - await walletPageHelper.verifyCommonElements( + await walletPageHelper.assertCommonElements( /^Ethereum$/, false, /^testertesting\.eth$/ ) - await walletPageHelper.verifyAnalyticsBanner() + await walletPageHelper.assertAnalyticsBanner() /** * Verify ETH is visible on the asset list and has the correct balance @@ -76,7 +76,7 @@ test.describe("Transactions", () => { * already selected. Verify elements on the page. Make sure `Continue` * isn't active. */ - await transactionsHelper.verifyUnfilledSendAssetScreen( + await transactionsHelper.assertUnfilledSendAssetScreen( /^Ethereum$/, /^testertesting\.eth$/, "ETH", @@ -112,7 +112,7 @@ test.describe("Transactions", () => { /** * Check if "Transfer" has opened and verify elements on the page. */ - await transactionsHelper.verifyTransferScreen( + await transactionsHelper.assertTransferScreen( "Ethereum", "testertesting\\.eth", "0x47745a7252e119431ccf973c0ebd4279638875a6", @@ -194,12 +194,12 @@ test.describe("Transactions", () => { .first() ).toBeVisible() - await walletPageHelper.verifyCommonElements( + await walletPageHelper.assertCommonElements( /^Ethereum$/, false, /^testertesting\.eth$/ ) - await walletPageHelper.verifyAnalyticsBanner() + await walletPageHelper.assertAnalyticsBanner() } ) }) @@ -230,12 +230,12 @@ test.describe("Transactions", () => { * Verify we're on Ethereum network. Verify common elements on the main * page. */ - await walletPageHelper.verifyCommonElements( + await walletPageHelper.assertCommonElements( /^Ethereum$/, false, /^testertesting\.eth$/ ) - await walletPageHelper.verifyAnalyticsBanner() + await walletPageHelper.assertAnalyticsBanner() /** * Verify KEEP is visible on the asset list and has the correct balance @@ -264,7 +264,7 @@ test.describe("Transactions", () => { * already selected. Verify elements on the page. Make sure `Continue` * isn't active. */ - await transactionsHelper.verifyUnfilledSendAssetScreen( + await transactionsHelper.assertUnfilledSendAssetScreen( /^Ethereum$/, /^testertesting\.eth$/, "KEEP", @@ -300,7 +300,7 @@ test.describe("Transactions", () => { /** * Check if "Transfer" has opened and verify elements on the page. */ - await transactionsHelper.verifyTransferScreen( + await transactionsHelper.assertTransferScreen( "Ethereum", "testertesting\\.eth", "0x47745a7252e119431ccf973c0ebd4279638875a6", @@ -378,12 +378,12 @@ test.describe("Transactions", () => { * Verify we're on Ethereum network. Verify common elements on the main * page. */ - await walletPageHelper.verifyCommonElements( + await walletPageHelper.assertCommonElements( /^Ethereum$/, false, /^testertesting\.eth$/ ) - await walletPageHelper.verifyAnalyticsBanner() + await walletPageHelper.assertAnalyticsBanner() /** * Verify KEEP is visible on the asset list and has the correct balance @@ -412,7 +412,7 @@ test.describe("Transactions", () => { * already selected. Verify elements on the page. Make sure `Continue` * isn't active. */ - await transactionsHelper.verifyUnfilledSendAssetScreen( + await transactionsHelper.assertUnfilledSendAssetScreen( /^Ethereum$/, /^testertesting\.eth$/, "ETH", @@ -470,7 +470,7 @@ test.describe("Transactions", () => { * Verify elements on the page after selecting token. Make sure * `Continue` isn't active. */ - await transactionsHelper.verifyUnfilledSendAssetScreen( + await transactionsHelper.assertUnfilledSendAssetScreen( /^Ethereum$/, /^testertesting\.eth$/, "KEEP", @@ -506,7 +506,7 @@ test.describe("Transactions", () => { /** * Check if "Transfer" has opened and verify elements on the page. */ - await transactionsHelper.verifyTransferScreen( + await transactionsHelper.assertTransferScreen( "Ethereum", "testertesting\\.eth", "0x47745a7252e119431ccf973c0ebd4279638875a6", @@ -589,12 +589,12 @@ test.describe("Transactions", () => { .first() ).toBeVisible() - await walletPageHelper.verifyCommonElements( + await walletPageHelper.assertCommonElements( /^Ethereum$/, false, /^testertesting\.eth$/ ) - await walletPageHelper.verifyAnalyticsBanner() + await walletPageHelper.assertAnalyticsBanner() } ) }) diff --git a/e2e-tests/regular/token-trust.spec.ts b/e2e-tests/regular/token-trust.spec.ts index 45075023bc..5aaf6b9d4c 100644 --- a/e2e-tests/regular/token-trust.spec.ts +++ b/e2e-tests/regular/token-trust.spec.ts @@ -52,12 +52,12 @@ test.describe("Token Trust", () => { /** * Verify we're on Ethereum network. Verify common elements on the main page. */ - await walletPageHelper.verifyCommonElements( + await walletPageHelper.assertCommonElements( /^Ethereum$/, false, account1Name ) - await walletPageHelper.verifyAnalyticsBanner() + await walletPageHelper.assertAnalyticsBanner() /** * Switch to the Polygon network. @@ -341,12 +341,12 @@ test.describe("Token Trust", () => { /** * Make sure `Wallet` page is opened and there are unverified assets shown */ - await walletPageHelper.verifyCommonElements( + await walletPageHelper.assertCommonElements( /^Polygon$/, false, account1Name ) - await walletPageHelper.verifyAnalyticsBanner() + await walletPageHelper.assertAnalyticsBanner() await assetsHelper.assertVerifiedAssetOnWalletPage(/^MATIC$/, "base") await assetsHelper.assertUnverifiedAssetsPresentOnWalletPage() @@ -495,12 +495,12 @@ test.describe("Token Trust", () => { /** * Make sure `Wallet` page is opened and there are unverified assets shown */ - await walletPageHelper.verifyCommonElements( + await walletPageHelper.assertCommonElements( /^Polygon$/, false, account1Name ) - await walletPageHelper.verifyAnalyticsBanner() + await walletPageHelper.assertAnalyticsBanner() await assetsHelper.assertVerifiedAssetOnWalletPage(/^MATIC$/, "base") await assetsHelper.assertUnverifiedAssetsPresentOnWalletPage() diff --git a/e2e-tests/regular/transactions.spec.ts b/e2e-tests/regular/transactions.spec.ts index 770f6fa61f..6c513e1177 100644 --- a/e2e-tests/regular/transactions.spec.ts +++ b/e2e-tests/regular/transactions.spec.ts @@ -44,12 +44,12 @@ test.describe("Transactions", () => { /** * Verify we're on Ethereum network. Verify common elements on the main page. */ - await walletPageHelper.verifyCommonElements( + await walletPageHelper.assertCommonElements( /^Ethereum$/, false, /^testertesting\.eth$/ ) - await walletPageHelper.verifyAnalyticsBanner() + await walletPageHelper.assertAnalyticsBanner() /** * Enable test networks @@ -76,12 +76,12 @@ test.describe("Transactions", () => { .getByText(/^Goerli$/) .last() .click() - await walletPageHelper.verifyCommonElements( + await walletPageHelper.assertCommonElements( /^Goerli$/, true, /^testertesting\.eth$/ ) - await walletPageHelper.verifyAnalyticsBanner() + await walletPageHelper.assertAnalyticsBanner() /** * Verify ETH is visible on the asset list. @@ -105,7 +105,7 @@ test.describe("Transactions", () => { * already selected. Verify elements on the page. Make sure `Continue` * isn't active. */ - await transactionsHelper.verifyUnfilledSendAssetScreen( + await transactionsHelper.assertUnfilledSendAssetScreen( /^Goerli$/, /^testertesting\.eth$/, "ETH", @@ -141,7 +141,7 @@ test.describe("Transactions", () => { /** * Check if "Transfer" has opened and verify elements on the page. */ - await transactionsHelper.verifyTransferScreen( + await transactionsHelper.assertTransferScreen( "Goerli", "testertesting\\.eth", "0x47745a7252e119431ccf973c0ebd4279638875a6", @@ -211,7 +211,7 @@ test.describe("Transactions", () => { */ await latestSentTx.click() - await transactionsHelper.verifyActivityItemProperties( + await transactionsHelper.assertActivityItemProperties( "0x0581470a8b62bd35dbf121a6329d43e7edd20fc7", "0x0581…20fc7", "0x47745A7252e119431CCF973c0eBD4279638875a6", @@ -235,12 +235,12 @@ test.describe("Transactions", () => { /** * Verify elements on the activity screen */ - await walletPageHelper.verifyCommonElements( + await walletPageHelper.assertCommonElements( /^Goerli$/, true, /^testertesting\.eth$/ ) - await walletPageHelper.verifyAnalyticsBanner() + await walletPageHelper.assertAnalyticsBanner() /** * Open latest transaction and verify it's deatils @@ -263,7 +263,7 @@ test.describe("Transactions", () => { await latestSentTx.click() - await transactionsHelper.verifyActivityItemProperties( + await transactionsHelper.assertActivityItemProperties( "0x0581470a8b62bd35dbf121a6329d43e7edd20fc7", "0x0581…20fc7", "0x47745A7252e119431CCF973c0eBD4279638875a6", diff --git a/e2e-tests/utils/assets.ts b/e2e-tests/utils/assets.ts index 1c338ea040..9365a7a7cd 100644 --- a/e2e-tests/utils/assets.ts +++ b/e2e-tests/utils/assets.ts @@ -60,7 +60,7 @@ export default class AssetsHelper { /** * Assert the top wrap. */ - await this.walletPageHelper.verifyTopWrap(network, accountLabel) + await this.walletPageHelper.assertTopWrap(network, accountLabel) /** * Assert the `Back` button. @@ -171,7 +171,7 @@ export default class AssetsHelper { /** * Assert the bottom wrap. */ - await this.walletPageHelper.verifyBottomWrap() + await this.walletPageHelper.assertBottomWrap() } /** diff --git a/e2e-tests/utils/transactions.ts b/e2e-tests/utils/transactions.ts index eeb044f0b3..c6f0ca8435 100644 --- a/e2e-tests/utils/transactions.ts +++ b/e2e-tests/utils/transactions.ts @@ -12,7 +12,7 @@ export default class TransactionsHelper { * This function verifies elements on the unfilled Send Assets form. * Makes sure `Continue` button isn't active. */ - async verifyUnfilledSendAssetScreen( + async assertUnfilledSendAssetScreen( network: RegExp, accountLabel: RegExp, assetSymbol: string, @@ -23,7 +23,7 @@ export default class TransactionsHelper { this.popup.getByRole("heading", { name: "Send Asset", exact: true }) ).toBeVisible() - await this.walletPageHelper.verifyTopWrap(network, accountLabel) + await this.walletPageHelper.assertTopWrap(network, accountLabel) await this.popup .getByRole("button", { name: "Back", exact: true }) @@ -62,13 +62,13 @@ export default class TransactionsHelper { .getByRole("button", { name: "Continue", exact: true }) .click({ force: true }) - await this.walletPageHelper.verifyBottomWrap() + await this.walletPageHelper.assertBottomWrap() } /** * This function verifies elements on the Transfer screen. */ - async verifyTransferScreen( + async assertTransferScreen( regexNetwork: string, // a network in RegEx syntax, with special chars double escaped (e.g. `\\d+`) and without leading `/^` and ending `$/` regexAccountLabel: string, // an account label in RegEx syntax, with special chars double escaped (e.g. `\\d+`) and without leading `/^` and ending `$/` sendToAddressFull: string, @@ -161,7 +161,7 @@ export default class TransactionsHelper { /** * This function verifies asset activity item's details. */ - async verifyActivityItemProperties( + async assertActivityItemProperties( sendFromAddressFull: string, sendFromAddressShortened: string, sendToAddressFull: string, diff --git a/e2e-tests/utils/walletPageHelper.ts b/e2e-tests/utils/walletPageHelper.ts index 25f2ec2476..091899a895 100644 --- a/e2e-tests/utils/walletPageHelper.ts +++ b/e2e-tests/utils/walletPageHelper.ts @@ -64,7 +64,7 @@ export default class WalletPageHelper { await this.goToStartPage() } - async verifyTopWrap(network: RegExp, accountLabel: RegExp): Promise { + async assertTopWrap(network: RegExp, accountLabel: RegExp): Promise { // TODO: maybe we could also verify graphical elements (network icon, profile picture, etc)? await expect( @@ -89,7 +89,7 @@ export default class WalletPageHelper { // TODO: verify 'Copy address' } - async verifyBottomWrap(): Promise { + async assertBottomWrap(): Promise { await this.popup .getByLabel("Main") .getByText("Wallet", { exact: true }) @@ -111,7 +111,7 @@ export default class WalletPageHelper { /** * The function checks elements of the main page that should always be present. */ - async verifyCommonElements( + async assertCommonElements( network: RegExp, testnet: boolean, accountLabel: RegExp @@ -123,7 +123,7 @@ export default class WalletPageHelper { /^\$(\d|,)+(\.\d{1,2})*$/ ) - await this.verifyTopWrap(network, accountLabel) + await this.assertTopWrap(network, accountLabel) await this.popup .getByRole("button", { name: "Send", exact: true }) @@ -148,10 +148,10 @@ export default class WalletPageHelper { .getByTestId("panel_switcher") .getByText("Activity", { exact: true }) .click({ trial: true }) - await this.verifyBottomWrap() + await this.assertBottomWrap() } - async verifyAnalyticsBanner(): Promise { + async assertAnalyticsBanner(): Promise { const analyticsBanner = this.popup.locator("div").filter({ has: this.popup.getByRole("heading", { name: "Analytics are enabled", @@ -181,7 +181,7 @@ export default class WalletPageHelper { // }) // TODO: delete? } - async verifyDefaultWalletBanner(): Promise { + async assertDefaultWalletBanner(): Promise { await expect( this.popup.getByText("Taho is not your default wallet") ).toBeVisible()