-
Notifications
You must be signed in to change notification settings - Fork 676
Snapshot property warnings work incorrectly with helper functions #5449
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
Comments
@favna, Thank you for the example. I've reproduced the issue on my side. |
Thanks for migrating my comment to an issue and trying my sample. Looking forward to see progress here. |
Can this be solved already? Makes looking through logs a nightmare I have to scroll thousands of lines of this useless warning to find what actually failed. At least give an option to disable the warning. |
I set the critical status for this issue. We are trying to find a solution as soon as possible, stay tuned for updates. |
For the team: When the snapshot property promise is resolved, its callsite is saved to a callsite storage. We check this storage in the If the property was not awaited, the |
Hello I have a helper class with a method that asserts a few things and this helper class extends a different helper class because it uses some of its functions. async fillField(field) {
const fieldSelector = await this.getInputSelector(
field.fieldType,
field.fieldKey
)
await t
.expect(fieldSelector.textContent) //this flags the warning
.notContains(field.name, { timeout: 20000 })
//More stuff raises that warning above. targetSelector = await getInputSelector(string data, returns the Selector returned from next function) -> await getTypeSelector(string data, returns the Selector returned from next function) -> await fieldTypeSelector(string data and returns the selector) It is not the case that at each return the data is wrapped in Selector() as it only gets returned as a Selector from fieldTypeSelector() function propogated downward. TestCafe version 1.16.1 |
Using the example code from @Ogurecher I also get the warnings, despite them not being prefixed by
await
.I am honestly baffled how a super hacky method like checking line numbers ever got merged. Not least because autoformatters such as Prettier will force the expect and selector to be on the same line in most cases. Adding a warning of this kind is fine but not with this implementation. I have made a hacky fix by putting my selectors on different lines for now but I hope this is changed in a future release.
Regardless, for me personally it is failing even with selector and expect on the same line and I've forked @Ogurecher 's sample repo and made a reproducable sample: https://github.com/favna/warning-example
Simply run
npm run test
to run testcafe hereOriginally posted by @favna in #5250 (comment)
The text was updated successfully, but these errors were encountered: