Closed borecz closed 1 year ago
I haven't seen that before ? I'm interested Gleb how it can be fixed :)
Thanks
Well, I will open an issue for Cypress team, it is weird not to allow overwriting commands like cy.get
Thanks for the quick 👀 if there's anything I can do to help please let me know :)
Ask on Cypress discord about itSent from my iPhoneOn Dec 7, 2022, at 08:01, EstefanÃa Fdez @.***> wrote: Thanks for the quick 👀 if there's anything I can do to help please let me know :)
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>
done @bahmutov ! I will let you know and also try to ask about it in the ambassador meeting today.
Any update on this problem @bahmutov? it still doesn't work with cypress 12.1.0
@estefafdez this is blocked by Cypress itself and can be fixed if the test runner allows https://github.com/cypress-io/cypress/issues/25078
When does Cypress-if plugin will be compatible with Cypress version 12.0.1, I am not to update Cypress version to latest one.
@sumankMSI please see the blocking issue. I know it is frustrating, i cannot upgrade my projects to v12 to use cypress-map and cypress-if :( Either Cypress allows overwriting queries, or someone comes up with an alternative implementation for cypress-if and opens a pull request here, and I will quickly merge it if it works
Looks like yesterday's 12.6.0 release of Cypress added the ability to override queries.
It is now possible to overwrite query commands using
Cypress.Commands.overwriteQuery
. Addressed in #25078.
I am still experiencing this issue after upgrading to Cypress v12.6.0
Any news on this?
No progress, v12.6.0 added query overwrite but removed some other things so I still don’t understand how to change the behavior Sent from my iPhoneOn Feb 22, 2023, at 06:47, Aleksandar Veselinovic @.***> wrote: Any news on this?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>
Thx for an answer @bahmutov , I appreciate it. Will keep watching on this issue
Same here
Cypress updates are available frequently but unfortunately major add-ons, not works(cypress-if). It is time to think that we will go for a new update or fix the bug. The fix is essential otherwise it might not possible to use the latest version.
Indeed, even with the latest version it still doesn't work.
Guys, just read the reply from Gleb, it's not yet done, of course it won't work with the latest version of Cypress.
I have the same issue, cypress version v12.6.0. any update??
@cmesav be patient bro, we're all waiting.
hey @bahmutov, how is this issue going? the new version (12.8.0) was just released today. Thanks!
hey @bahmutov, how is this issue going? the new version (12.8.0) was just released today. Thanks!
Same Cypress-if issue as previous.
people, be patient and stop asking Gleb about the status, if you want to help - create a merge request, or look at the progress at Pull requests, while this issue is open that means there is no fix yet
update: @bahmutov described a great workaround for conditional testing in this article https://glebbahmutov.com/blog/upgrade-cypress-v9-to-v12/
When will this be fixed?
@Fruehwirth it will be fixed when Cypress internal code supports it, so far I could not figure out a hack to make it work
Hope this helps someone 🙃 I really needed the conditional existence for my tests and the workaround suggested here by using .should(Cypress._.noop)
was breaking Cypress's retry mechanism, but this aproach, using MutationObserver
and a 2 Promises race worked for me:
const _waitForElement = (document, CSSselector) => {
const throwOnTimeout = new Promise((_, reject) =>
setTimeout(() => {
const _errMsg = `WARNING: Timeout - Optional element [ ${CSSselector} ] not present, continuing...`
cy.log(_errMsg)
reject(new Error(_errMsg))
}, Cypress.config('defaultCommandTimeout'))
)
const getElement = new Promise(resolve => {
if (document.querySelector(CSSselector)) {
return resolve(document.querySelector(CSSselector))
}
const observer = new MutationObserver(mutations => {
if (document.querySelector(CSSselector)) {
resolve(document.querySelector(CSSselector))
observer.disconnect()
}
})
observer.observe(document.body, {
childList: true,
subtree: true
})
})
return Promise.race([getElement, throwOnTimeout])
}
and consumed it like this:
cy
.document()
.then($doc => {
return _waitForElement($doc, CSSselector)
.then(elem => elem)
.catch(error => { console.log(error) })
})
.then(elem => {
if (elem)
// handle found element
})
Good morning everyone, do we have an estimate for when Cypress will be operational again? I need this condition for my automation, and depending on the situation, I might need to find another solution!
I promise if someone opens a pull request with a fix for Cypress v12, I will merge it immediately as soon as the tests pass.
@bahmutov With Cypress v12.15.0 think all we need is to merge your PR now?! I just replaced the overwrite
with overwriteQuery
locally and it worked!
I still cannot figure out how to fix it, but I don't have much time for it
Hey guys, I could get it to run for Cypress 12.17.1 and Angular 16.1.5. All your tests are passing, all of our tests too (from simple to complex ones).
I already created a branch locally, but I don't have access to push it. Can you add me to the contributers, so I can create a PR for this?
Many thanks in advance!
FMuellerBK
I think, you should be able to raise a PR after creating fork like below example- https://github.com/bahmutov/cypress-if/pull/19
FMuellerBK
I think, you should be able to raise a PR after creating fork like below example- #19
Yes, you're right. Just created the PR. Thanks for your help!
:tada: This issue has been resolved in version 1.10.5 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Gleb's update
Everyone, it is not up to me - Cypress internal command API has changed a lot and it is problematic for me to do the same functionality right now. I have played with newer Cypress versions trying to find a way to implement the same feature in the PR https://github.com/bahmutov/cypress-if/pull/62 but without any success. If anyone can achieve it and fix it, I will happily merge your PR and release the new version.