Skip to content

Commit

Permalink
Rename verify... functions to assert...
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
michalinacienciala committed Jul 27, 2023
1 parent b16c9a0 commit 5ad6ca6
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 47 deletions.
34 changes: 17 additions & 17 deletions e2e-tests/fork-based/transactions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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()
}
)
})
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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()
}
)
})
Expand Down
12 changes: 6 additions & 6 deletions e2e-tests/regular/token-trust.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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()

Expand Down
20 changes: 10 additions & 10 deletions e2e-tests/regular/transactions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -211,7 +211,7 @@ test.describe("Transactions", () => {
*/
await latestSentTx.click()

await transactionsHelper.verifyActivityItemProperties(
await transactionsHelper.assertActivityItemProperties(
"0x0581470a8b62bd35dbf121a6329d43e7edd20fc7",
"0x0581…20fc7",
"0x47745A7252e119431CCF973c0eBD4279638875a6",
Expand All @@ -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
Expand All @@ -263,7 +263,7 @@ test.describe("Transactions", () => {

await latestSentTx.click()

await transactionsHelper.verifyActivityItemProperties(
await transactionsHelper.assertActivityItemProperties(
"0x0581470a8b62bd35dbf121a6329d43e7edd20fc7",
"0x0581…20fc7",
"0x47745A7252e119431CCF973c0eBD4279638875a6",
Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/utils/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -171,7 +171,7 @@ export default class AssetsHelper {
/**
* Assert the bottom wrap.
*/
await this.walletPageHelper.verifyBottomWrap()
await this.walletPageHelper.assertBottomWrap()
}

/**
Expand Down
10 changes: 5 additions & 5 deletions e2e-tests/utils/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 })
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
14 changes: 7 additions & 7 deletions e2e-tests/utils/walletPageHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default class WalletPageHelper {
await this.goToStartPage()
}

async verifyTopWrap(network: RegExp, accountLabel: RegExp): Promise<void> {
async assertTopWrap(network: RegExp, accountLabel: RegExp): Promise<void> {
// TODO: maybe we could also verify graphical elements (network icon, profile picture, etc)?

await expect(
Expand All @@ -89,7 +89,7 @@ export default class WalletPageHelper {
// TODO: verify 'Copy address'
}

async verifyBottomWrap(): Promise<void> {
async assertBottomWrap(): Promise<void> {
await this.popup
.getByLabel("Main")
.getByText("Wallet", { exact: true })
Expand All @@ -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
Expand All @@ -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 })
Expand All @@ -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<void> {
async assertAnalyticsBanner(): Promise<void> {
const analyticsBanner = this.popup.locator("div").filter({
has: this.popup.getByRole("heading", {
name: "Analytics are enabled",
Expand Down Expand Up @@ -181,7 +181,7 @@ export default class WalletPageHelper {
// }) // TODO: delete?
}

async verifyDefaultWalletBanner(): Promise<void> {
async assertDefaultWalletBanner(): Promise<void> {
await expect(
this.popup.getByText("Taho is not your default wallet")
).toBeVisible()
Expand Down

0 comments on commit 5ad6ca6

Please sign in to comment.