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

[BUG] #3142

Closed
PushkarajAwad2 opened this issue Jul 24, 2020 · 1 comment
Closed

[BUG] #3142

PushkarajAwad2 opened this issue Jul 24, 2020 · 1 comment
Assignees

Comments

@PushkarajAwad2
Copy link

PushkarajAwad2 commented Jul 24, 2020

Context:

  • Playwright Version: 1.2.1
  • Operating System: Windows
  • Node version: 10.15.1
  • Browser: Chromium

Code Snippet

 async handleTestEvent(event) {
        if (event.name === 'test_done' && event.test.errors.length > 0) {
            const snapshotPath = `${this.screenshotPath}/${ event.test.parent.name.replace(/\W/g, '-')}_${event.test.name.replace(/\W/g, '-')}` + '_';
            await this.global.page.screenshot({
                path: !!process.env.device ? `${snapshotPath}_${process.env.device}` + '.jpeg' : snapshotPath + '.jpeg',
                fullPage: true,
                type: "jpeg",
            });
        }
    }

Describe the bug

To capture screenshot for failed testcases we added custom environment logic but it is showing blank screenshots.
We have investigated and found, to capture screenshots custom environment is accessing global page instance and we are creating new browser instance for each test case.

To resolve this we used global browser instance, but whenever test cases are failed for some reason or after finishing execution global browser instance itself is getting closed and other test cases are not running.

Also How can we capture screenshot of failed testcases for new browser instance.

Can someone help us to resolve this issue.

@aslushnikov
Copy link
Collaborator

aslushnikov commented Aug 21, 2020

Also How can we capture screenshot of failed testcases for new browser instance.

@PushkarajAwad2 this will be covered by our upcoming testrunner: please keep an eye at #3552

This exact functionality has just landed: #3556

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

3 participants