-
Notifications
You must be signed in to change notification settings - Fork 288
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
Keep browser opened on failure #130
Comments
What do you mean? Right now we just throw (unless you use Or do you want us to have a function on e.g. |
I think it would be better to be able to intercept an error in the test environment. I don’t want to invent another method than « it » and « test ». I could patch them but if every Jest plugin do it, it will become a jungle. So your advice for now is to patch « it » and « test »? |
For now, yeah. You can open up a feature request with jest if you want, but I'm not sure if it'll be accepted. Some examples of the API you envision would be nice :) |
I've tried to wrap « it » with the following function:
The page object is accessible but I'm unable to take a screenshot (page._closed is true at this point). Is there any way around it? |
|
We got an traction on this guys? |
This works great for taking screenshots! thx @celador for typescript users:
|
That works perfectly fine, the only question I have, after I start using that function for screenshots generation, i can't use it.only in tests, getting error |
I suppose it is not chaining methods. Try this https://stackoverflow.com/questions/44446626/run-only-one-test-with-jest |
v25.3.0 (released 15 minutes ago) includes jestjs/jest#9397 which should unblock both this and #131 without hacks. Note that it only works with |
@SimenB is there a solution for this problem as of today? I understand Jest now provides the necessary functionalities but I don't understand if jest-puppeteer makes use of them. |
@Mahanchello you can do the following instead
|
@sjurgis what if page is closed at that time? How can we get the screenshot? |
@rajeshkumarp I guess not. Only wanted to try this solution because I was reluctant to try jest-circus.
|
Why not simply use a very long timer to prevent the browser from closing? |
It will not happen. But we will take a screenshot. |
As suggested in #38, the idea is to intercept a test failure and stop the browser. It is not an easy task and it needs some research. Jest does not provide any API to intercept a test failure, so we have to hack it.
Maybe Jest team could help us to achieve that? @SimenB
#43 could also help to find a solution for this.
The text was updated successfully, but these errors were encountered: