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

docs: add guide about debugging Playwright Python #5

Merged
merged 2 commits into from
Aug 14, 2020

Conversation

mxschmitt
Copy link
Member

@mxschmitt mxschmitt commented Aug 9, 2020

Currently its hard to debug Playwright Pytest tests on bots when they are failing until screencast is not ready. Many users in the Jest world use such a feature for debugging the tests or getting insights why something is not working when they are failing on the bots.

This implementation is opt-in and will create a screenshot when a test is failing, in the future we can add a screencast recording for each test in the folder too.

Blocked by upstream: microsoft/playwright-python#166

I think we could also add a --breakpoint-on-error flag e.g. which will start a REPL once a test is failing. Also opt-in. Then the user can interact with the browser via the headful instance or via the REPL.

@mxschmitt mxschmitt force-pushed the feature/screenshot-if-failing branch from cf0723c to 87cdda6 Compare August 9, 2020 11:03
@pavelfeldman
Copy link
Member

I'm not a huge fan of taking a screenshot on failure. We should instead do the video and dom snapshots. Would not want screenshot on failure to be adopted - would make the right solution harder to discover.

@mxschmitt mxschmitt force-pushed the feature/screenshot-if-failing branch from 87cdda6 to 0957255 Compare August 10, 2020 18:31
@mxschmitt mxschmitt force-pushed the feature/screenshot-if-failing branch from 0957255 to 66d3323 Compare August 10, 2020 18:32
@mxschmitt mxschmitt changed the title feat: make a screenshot if a test is failing docs: add guide about debugging Playwright Python Aug 10, 2020
@coveralls
Copy link

coveralls commented Aug 10, 2020

Pull Request Test Coverage Report for Build 202919278

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 86.17%

Totals Coverage Status
Change from base Build 196369317: 0.0%
Covered Lines: 81
Relevant Lines: 94

💛 - Coveralls

README.md Outdated
@@ -115,6 +115,26 @@ def test_visit_admin_dashboard(page: Page):
# ...
```

## Debugging

To pause the Pytest test execution and interact with the browser via the developer tools or call Playwright interactively, you can use the `breakpoint()` statement in your code to get a [pdb](https://docs.python.org/3/library/pdb.html) inline REPL.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth noting that should be started as headful.

@mxschmitt mxschmitt merged commit be019f3 into main Aug 14, 2020
@mxschmitt mxschmitt deleted the feature/screenshot-if-failing branch August 15, 2020 07:48
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

Successfully merging this pull request may close these issues.

3 participants