You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The example in the docs above doesn't work if for example the locator has multiple elements - the exception gets swallowed.
You can add
} catch (e: any) {
// if we are testing more than 1 locator we need to show that error message
if (e.message.includes('strict mode')) {
throw e;
}
matcherResult = e.matcherResult;
}
to work around it but I am sure there are other exceptions I am missing by just testing for strict mode.
other example in the same example: #34390
original request for this documentation: #15951 (comment)
issue raised but I was told off for not following the template: #34327
issue raised but I was told off because there are multiple issues with the example and you want seperate bugs: #34350
As I said originally I think making this custom assertion work properly is complicated - I'd prefer playwright exposed a way to do it rather than have a very complicated example.
The text was updated successfully, but these errors were encountered:
Page(s)
https://playwright.dev/docs/next/test-assertions#add-custom-matchers-using-expectextend
Description
The example in the docs above doesn't work if for example the locator has multiple elements - the exception gets swallowed.
You can add
to work around it but I am sure there are other exceptions I am missing by just testing for strict mode.
other example in the same example: #34390
original request for this documentation: #15951 (comment)
issue raised but I was told off for not following the template: #34327
issue raised but I was told off because there are multiple issues with the example and you want seperate bugs: #34350
As I said originally I think making this custom assertion work properly is complicated - I'd prefer playwright exposed a way to do it rather than have a very complicated example.
The text was updated successfully, but these errors were encountered: