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

Fail the test from another thread #10

Open
vmachacek opened this issue Sep 14, 2024 · 1 comment
Open

Fail the test from another thread #10

vmachacek opened this issue Sep 14, 2024 · 1 comment

Comments

@vmachacek
Copy link

vmachacek commented Sep 14, 2024

Hello, I had this question here and I put together sample runnable project here

I have a callback from browser which is orchestrated by playwright - this callback is to report error which happens in the app. Once that happens I know for sure I want to fail the test to save resources. How can I do that?

More specifically I want to fail the test from this line here

@OsirisTerje
Copy link
Member

You need to send that back , e.g. create an Error property in your BrowserFactory, Fill that property from inside your handler, and then Assert on that property in your test. You can of course also use other methods, but in essence, you need to get the information out of the handler.

Dependent on what more you're using this for, it could be wise to perhaps make BrowserFactory a non-static object.

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

No branches or pull requests

2 participants