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

Use clock & tick instead of waituntil #398

Closed
wants to merge 3 commits into from

Conversation

Tbaut
Copy link
Collaborator

@Tbaut Tbaut commented Oct 12, 2023

Small refactor to prevent using waitUntil when we know there's a setTimeout.

@Tbaut
Copy link
Collaborator Author

Tbaut commented Oct 13, 2023

Need to check again, it worked locally, somehow the clock/tick doesn't seem to work well here.

cy.clock()
topMenuItems.connectButton().click()
landingPage.accountsLoader().should('contain', 'Loading accounts')
cy.tick(500)
Copy link
Collaborator

Choose a reason for hiding this comment

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

As I understood from the documentation, it's a method to mock the time. I didn't find any setInterval in our implementation. Isn't it just pending Promise, or am I mistaken?

Copy link
Collaborator Author

@Tbaut Tbaut Oct 13, 2023

Choose a reason for hiding this comment

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

Nope there's a settimeout to go around a bug

// delay the request by 500ms
// race condition see https://github.com/polkadot-js/extension/issues/938
setTimeout(() => {
getaccountList(chainInfo.isEthereum)

So effectively, when the user clicks on the Connect button, the request is fired 500ms after. But because it's in useEffect etc. it may be a lil more. tick(600) or more failed sometimes for me still.

@Tbaut
Copy link
Collaborator Author

Tbaut commented Oct 13, 2023

I'm giving up. The time i spent isn't worth it imho opened #403 to do a small refactor and that's it

@Tbaut Tbaut closed this Oct 13, 2023
@Tbaut Tbaut deleted the tbaut-tick-insteadof-waituntil branch February 12, 2024 13:20
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.

2 participants