Skip to content

Commit

Permalink
Use soft assertions when expecting snackbar
Browse files Browse the repository at this point in the history
There is a bug in the wallet which manifests with the snackbar with the action's
status not displaying after that action. This happens sporadically and does not
mean that the action wasn't successful. We want to be notified when the bug
occurs, but we don't want it to block execution of the subsequent steps. That's
why we use the soft assertions.
  • Loading branch information
michalinacienciala committed Nov 16, 2023
1 parent 68eb3ec commit f0441b1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
12 changes: 6 additions & 6 deletions e2e-tests/fork-based/transactions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ test.describe("Transactions", () => {
* Confirm there is "Transaction signed, broadcasting..." snackbar visible
* and there is no "Transaction failed to broadcast" snackbar visible.
*/
await expect(
popup.getByText("Transaction signed, broadcasting...").first(),
).toBeVisible() // we need to use `.first()` because sometimes Playwright catches 2 elements matching that copy
await expect
.soft(popup.getByText("Transaction signed, broadcasting...").first())
.toBeVisible() // we need to use `.first()` because sometimes Playwright catches 2 elements matching that copy
await expect(
popup.getByText("Transaction failed to broadcast."),
).toHaveCount(0)
Expand Down Expand Up @@ -478,9 +478,9 @@ test.describe("Transactions", () => {
* Confirm there is "Transaction signed, broadcasting..." snackbar visible
* and there is no "Transaction failed to broadcast" snackbar visible.
*/
await expect(
popup.getByText("Transaction signed, broadcasting...").first(),
).toBeVisible() // we need to use `.first()` because sometimes Playwright catches 2 elements matching that copy
await expect
.soft(popup.getByText("Transaction signed, broadcasting...").first())
.toBeVisible() // we need to use `.first()` because sometimes Playwright catches 2 elements matching that copy
await expect(
popup.getByText("Transaction failed to broadcast."),
).toHaveCount(0)
Expand Down
20 changes: 11 additions & 9 deletions e2e-tests/regular/token-trust.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,9 @@ test.describe("Token Trust", () => {
/**
* Confirm there is `Asset removed from list` snackbar visible.
*/
await expect(
popup.getByText("Asset removed from list").first(),
).toBeVisible({ timeout: 5000 })
await expect
.soft(popup.getByText("Asset removed from list").first())
.toBeVisible({ timeout: 5000 })

/**
* Make sure `Wallet` page is opened and there are unverified assets
Expand Down Expand Up @@ -367,9 +367,11 @@ test.describe("Token Trust", () => {
/**
* Confirm there is `Asset added to list` snackbar visible.
*/
await expect(popup.getByText("Asset added to list").first()).toBeVisible({
timeout: 5000,
})
await expect
.soft(popup.getByText("Asset added to list").first())
.toBeVisible({
timeout: 5000,
})

/**
* Confirm asset's details are opened. Ensure there are fields related to
Expand Down Expand Up @@ -436,9 +438,9 @@ test.describe("Token Trust", () => {
/**
* Confirm there is `Asset removed from list` snackbar visible.
*/
await expect(
popup.getByText("Asset removed from list").first(),
).toBeVisible({ timeout: 5000 })
await expect
.soft(popup.getByText("Asset removed from list").first())
.toBeVisible({ timeout: 5000 })

/**
* Make sure `Wallet` page is opened and there are unverified assets
Expand Down
6 changes: 3 additions & 3 deletions e2e-tests/regular/transactions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ test.describe("Transactions", () => {
* Confirm there is "Transaction signed, broadcasting..." snackbar visible
* and there is no "Transaction failed to broadcast" snackbar visible.
*/
await expect(
popup.getByText("Transaction signed, broadcasting...").first(),
).toBeVisible() // we need to use `.first()` because sometimes Playwright catches 2 elements matching that copy
await expect
.soft(popup.getByText("Transaction signed, broadcasting...").first())
.toBeVisible() // we need to use `.first()` because sometimes Playwright catches 2 elements matching that copy
await expect(
popup.getByText("Transaction failed to broadcast."),
).toHaveCount(0)
Expand Down

0 comments on commit f0441b1

Please sign in to comment.