Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remaining watch account ui tests #446

Merged
merged 10 commits into from
Dec 1, 2023
Merged

Conversation

asnaith
Copy link
Member

@asnaith asnaith commented Nov 30, 2023

closes #378

A couple of new tests to cover the last remaining watch account scenarios on the issue.

})
// store details of the displayed addresses for later comparison
multisigPage.accountHeader().within(() => {
accountDisplay.addressLabel().should('be.visible').invoke('text').as('headerPureAddress')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been searching for a way to achieve the same, in an easier to read way. I've always found aliases pretty convoluted, with the @ etc.

This is nice and generic, but can't we just compare it to what we expect? After all this is all just testing that the pure (and down the file the multisig) address is the same isn't it? It would make this test easier to read and maintain IMHO.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I preferred about using the aliases is that when we were inspecting the UI and watching via the pure we were dynamically grabbing and storing whatever data was displayed (without caring, just knowing this is the view when a pure is watched) and then only asserting when we watch via the multisig that the displayed details are the same as what we saw previously.

I've updated now to compare using the static values as requested but this means we are now first asserting on the display when watching a pure key (already covered in other tests) and then again the displayed data when watching a multisig key, a trivial difference that probably makes no change in execution time but it's less of a well-written test in my opinion. We break test writing conventions of only asserting after the point of change (but admittedly we do this all the time especially with should('be.visible') checks because we have to 😄).

Ultimately if it reads better I guess that matters more but I wanted to explain my view. I still think cypress alias will have their place when checking dynamic data but perhaps it makes less sense when values are static like this (and I do agree the @ syntax is a little odd!).

Copy link
Collaborator

@Tbaut Tbaut Dec 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe with my PR using the exact same code, this reads even better, this is how I was thinking about this test originally. Sure it's a bit dumb and we're checking twice the same things (now not repeated, but in a function) but how we arrived at this state is different, and that's what matters.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep this reads well, thanks :)

packages/ui/cypress/tests/watched-accounts.cy.ts Outdated Show resolved Hide resolved
packages/ui/cypress/tests/watched-accounts.cy.ts Outdated Show resolved Hide resolved
packages/ui/cypress/tests/watched-accounts.cy.ts Outdated Show resolved Hide resolved
packages/ui/cypress/tests/watched-accounts.cy.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@Lykhoyda Lykhoyda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Thank you!

Copy link
Collaborator

@Tbaut Tbaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation, I totally get you. I def think it makes sense in some places, but it really felt too much here. BTW I created #450 that makes it so that we don't repeat the exact same test twice. if you're ok with it, please merge it first, then you can merge this one.

@Tbaut Tbaut merged commit a004307 into main Dec 1, 2023
6 checks passed
@Tbaut Tbaut deleted the asnaith/last-watched-account-tests branch December 1, 2023 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write tests to validate watch accounts
3 participants