Skip to content

Commit

Permalink
Refactor code asserting asset's balance
Browse files Browse the repository at this point in the history
Previous implementation wasn't properly handling cases when the assertion was
not met. In such cases it was silently ending the tests, without reporting any
failures (the failure was visible only in the Playwright report, which wasn't
opened by default).
  • Loading branch information
michalinacienciala committed Jul 24, 2023
1 parent b1d8382 commit c0f9193
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions e2e-tests/utils/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,13 @@ export default class AssetsHelper {
* Assert the token name and make sure the balance equals (or gets updated
* to) the correct value.
*/
const activityLeftContainer = this.popup.locator(".left").filter({
const activityLeftContainer = this.popup.getByTestId("left_wrap").filter({
has: this.popup.locator("span").filter({ hasText: assetSymbol }),
})
await expect(async () => {
const balance = await activityLeftContainer
.getByText(/^(\d|,)+(\.\d{2,4})*$/)
.textContent()
expect(balance).toMatch(expectedBalance)
}).toPass({
const balance = await activityLeftContainer.getByText(
/^(\d|,)+(\.\d{2,4})*$/
)
await expect(balance.getByText(expectedBalance)).toHaveCount(1, {
timeout: 120000,
})

Expand Down

0 comments on commit c0f9193

Please sign in to comment.