Alternative to invoke
if you need to assert a function that returns a promise
#25107
-
Hello Cypress team and community! We have some tests that assert that some IndexedDB databases are created: cy.window()
.its('indexedDB')
.invoke('databases')
.should('deep.include', { name: 'MyDb', version: 1 }) It worked in v9 but it stopped working in v12. I assume that the reason for it is a breaking change where The PR suggests to use cy.window()
.then((win) => win.indexedDB.databases())
.should('deep.include', { name: 'MyDb', version: 1 }) The problem here is that I also tried to use aliases cy.window()
.then((win) => win.indexedDB.databases())
.as('@dbs')
cy.get('@dbs').should('deep.include', { name: 'MyDb', version: 1 }) I'm out of ideas here and I would really like to any solution that asserts a function that returns a promise 🙏 Tagging @BlueWinds here. Maybe you can help 🙏 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Yeah, we don't have any commands that currently support retry-ability and promises at the same time. A couple of options:
Not the cleanest thing, but something like this should work (I have not run the above code, probably contains mistakes). |
Beta Was this translation helpful? Give feedback.
Yeah, we don't have any commands that currently support retry-ability and promises at the same time. A couple of options:
Not the cleanest thing, but something li…