playwright: [Bug]: no trace, video and screenshot in case of a browser crash
Version
1.44.1
Steps to reproduce
This is a floating issue, I don’t know how to reproduce
I have two issues:
- Sometimes test fails with an error ‘Target page, context or browser has been closed’. Looks like, browser is crashed, but I’m not sure, how to debug it?
- If test is failed with this error, then there is no trace, video and screenshot. Is it normal?
[firefox] › test-1-smoke.spec.ts:22:1 › smoke-ip-signal ───────────────────────────────────────
Error: locator.click: Target page, context or browser has been closed
Browser logs:
<launching> /ms-playwright/firefox-1449/firefox/firefox -no-remote -headless -profile /tmp/playwright_firefoxdev_profile-XXXXXXKsSq[84](https://gitlab.xxx/vision_ott/qa/e2e/-/jobs/386796#L84) -juggler-pipe -silent
<launched> pid=119
[pid=119][err] *** You are running in headless mode.
[pid=119][err] JavaScript warning: resource://services-settings/Utils.sys.mjs, line 114: unreachable code after return statement
[pid=119][out] console.warn: services.settings: Ignoring preference override of remote settings server
[pid=119][out] console.warn: services.settings: Allow by setting MOZ_REMOTE_SETTINGS_DEVTOOLS=1 in the environment
[pid=119][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.257459) [GFX1-]: glxtest: libpci missing
[pid=119][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.257459) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.257459) [GFX1-]: glxtest: Unable to open a connection to the X server
[pid=119][out] Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.257459) |[1][GFX1-]: glxtest: Unable to open a connection to the X server (t=0.257459) |[2][GFX1-]: No GPUs detected via PCI
[pid=119][out] (t=0.257459) [GFX1-]: No GPUs detected via PCI
[pid=119][out]
[pid=119][out] console.error: ({})
[pid=119][out]
[pid=119][out] Juggler listening to the pipe
[pid=119][out] console.error: ({})
[pid=119][out] console.error: SearchEngineSelector: "Received empty search configuration!"
[pid=119][out] console.error: SearchEngineSelector: "Received empty search configuration!"
[pid=119][out] console.error: SearchService: "#init: failure initializing search:" ({})
[pid=119][out] console.error: WebExtensions:
[pid=119][out] Message: [Exception... "Failed to get engine data from Remote Settings" nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)" location: "JS frame :: resource://gre/modules/SearchEngineSelectorOld.sys.mjs :: getEngineConfiguration :: line 118" data: no]
[pid=119][out] Stack:
[pid=119][out] getEngineConfiguration@resource://gre/modules/SearchEngineSelectorOld.sys.mjs:118:24
[pid=119][out]
[pid=119][err] JavaScript error: resource://gre/modules/SearchEngineSelectorOld.sys.mjs, line 118: NS_ERROR_UNEXPECTED: Failed to get engine data from Remote Settings
[pid=119][err] JavaScript error: resource://gre/modules/SearchEngineSelectorOld.sys.mjs, line 118: NS_ERROR_UNEXPECTED: Failed to get engine data from Remote Settings
[pid=119][err] JavaScript error: resource://gre/modules/SearchEngineSelectorOld.sys.mjs, line 118: NS_ERROR_UNEXPECTED: Failed to get engine data from Remote Settings
[pid=119][out] console.error: SearchSettings: "_write: Could not write to settings file:" (new Error("cannot write without any engine.", "resource://gre/modules/SearchSettings.sys.mjs", 277))
[pid=119][out] console.error: "Received empty top sites configuration!"
[pid=119][err] JavaScript error: resource://gre/modules/SearchEngineSelectorOld.sys.mjs, line 118: NS_ERROR_UNEXPECTED: Failed to get engine data from Remote Settings
[pid=119][out] console.error: "Received empty top sites configuration!"
[pid=119][out] console.error: (new TypeError("linkMap is undefined", "resource://gre/modules/NewTabUtils.sys.mjs", 2003))
[pid=119][out] console.error: URLBar - Provider.UrlbarProviderSearchTips: ({})
[pid=119][err] JavaScript error: resource://gre/modules/SearchEngineSelectorOld.sys.mjs, line 118: NS_ERROR_UNEXPECTED: Failed to get engine data from Remote Settings
[pid=119][err] JavaScript warning: resource://gre/modules/UpdateService.sys.mjs, line 3[85](https://gitlab.xxx/vision_ott/qa/e2e/-/jobs/386796#L85)7: unreachable code after return statement
[pid=119][out] console.error: URLBar - Provider.UrlbarProviderSearchTips: ({})
[pid=119][err] Exiting due to channel error.
[pid=119][err] Exiting due to channel error.
Call log:
- waiting for locator('id=video-live').locator('..').locator('span')
at /builds/vision_ott/qa/e2e/[pid=119][out] getEngineConfiguration@resource:/gre/modules/SearchEngineSelectorOld.sys.mjs:118:24
at /builds/vision_ott/qa/e2e/tests/test-1-smoke.spec.ts:59:71
Error: locator.click: Target page, context or browser has been closed
at fixtures/signal-set.ts:90
88 | console.log("signalSet fixture cleanup");
89 | //Delete the signal
> 90 | await page.locator("id=Configuration").click();
| ^
91 | await expect(page).toHaveURL(/configuration/);
92 | await fillSearch(page, signalName);
93 | await expect(page.locator(".configurations-column-settings")).toHaveCount(2); // 1st is a header and the signal
at Object.signalSet (/builds/vision_ott/qa/e2e/tests/fixtures/signal-set.ts:90:48)
Error: Target page, context or browser has been closed
Error: ENOENT: no such file or directory, open '/builds/vision_ott/qa/e2e/test-results/.playwright-artifacts-0/4d84c7f257cbb5ff[86](https://gitlab.xxx/vision_ott/qa/e2e/-/jobs/386796#L86)3414c6b211d1c7.zip'
Expected behavior
Trace, video and screenshot are present in case of failed test.
Actual behavior
No trace, no video, no screenshot.
sergey@Sergeys-MacBook-Air pwr4 % ls -laR test-results
total 32
drwxr-xr-x 5 sergey staff 160 Jun 18 01:00 .
drwxr-xr-x 4 sergey staff 128 Jun 18 11:40 ..
-rw-r--r-- 1 sergey staff 96 Jun 18 01:00 .last-run.json
drwxr-xr-x 2 sergey staff 64 Jun 18 00:57 test-1-smoke-smoke-ip-signal-firefox
-rw-r--r-- 1 sergey staff 9489 Jun 18 01:00 test-results.xml
test-results/test-1-smoke-smoke-ip-signal-firefox:
total 0
drwxr-xr-x 2 sergey staff 64 Jun 18 00:57 .
drwxr-xr-x 5 sergey staff 160 Jun 18 01:00 ..
sergey@Sergeys-MacBook-Air pwr4 % ls -laR playwright-report
total 880
drwxr-xr-x 3 sergey staff 96 Jun 18 01:00 .
drwxr-xr-x 4 sergey staff 128 Jun 18 11:40 ..
-rw-rw-r-- 1 sergey staff 450142 Jun 18 01:00 index.html
Additional context
I run tests under gitlab CI, using official docker image mcr.microsoft.com/playwright:v1.44.1-jammy
playwright config:
const { defineConfig, devices } = require('@playwright/test');
module.exports = defineConfig({
testDir: './tests',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: 0,
workers: process.env.CI ? 1 : undefined,
reporter: [
['list'],
['html'],
['junit', { outputFile: "test-results/test-results.xml", includeProjectInTestName: true }],
],
use: {
trace: 'retain-on-first-failure',
screenshot: 'only-on-failure',
video: {
mode: 'retain-on-failure',
size: { width: 1280, height: 720 }
},
},
projects: [
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},
{
name: 'Google Chrome',
use: { ...devices['Desktop Chrome'], channel: 'chrome' },
},
],
});
Environment
System:
OS: Linux 5.4 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
CPU: (4) x64 Common KVM processor
Memory: 4.42 GB / 7.77 GB
Container: Yes
Binaries:
Node: 20.13.1 - /usr/bin/node
Yarn: 1.22.22 - /usr/bin/yarn
npm: 10.5.2 - /usr/bin/npm
Languages:
Bash: 5.1.16 - /usr/bin/bash
npmPackages:
@playwright/test: ^1.44.1 => 1.44.1
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 4
- Comments: 17 (5 by maintainers)
Commits related to this issue
- repro for https://github.com/microsoft/playwright/issues/31358 — committed to svlobanov/playwright-bug-31358 by svlobanov 2 years ago
@svlobanov Thank you for the core dump. Unfortunately, we do not have a symbolized firefox build right now, but we might be able to symbolize it later.
That said, we decided to try and collect traces for situations like a browser crash, so I’ll assign this to the next release and we’ll see what we can do.
I’ve had a similar issue happen to me while setup up playwright in a new project. When running
npx playwright test --ui --headedthe traces appear correctly as the test runs but after it fails the screenshots disappear (along with all information in the timeline). Additionally some commands seem to be missing and instead show a previous step in the trace 🤔Here’s how it looks like in 1.44:
And here’s 1.45: