-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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]: Failing tests have a trace with no images and with steps missing #31541
Comments
I can reproduce that failTestNoTrace.spec reproduces no trace in 1.45 but produces one in 1.44. |
I was about to create a bug for the same issue myself. I am facing the same issue just without the use of base class. I've done some investigation and I think its even more straightforward - the issue might lie in the fact that it creates context and doesn't save it. It used to work just fine, but its no longer working. I have an example repository here based on default playwright tutorial examples For me, workaround is pretty straightforward - just save Context outside of beforeAll and then close it. This works with Basically this used to work let page: Page;
//This used to work just fine
test.beforeAll(async ({ browser }) => {
// Same thing - no longer works as well
// const context = await browser.newContext();
// page = await context.newPage();
page = await (await browser.newContext()).newPage();
});
test("get started link", async () => {
await page.goto("https://playwright.dev/");
// Click the get started link.
await page.getByRole("link", { name: "Get started" }).click();
// Expects page to have a heading with the name of Installation.
await expect(
page.getByRole("heading", { name: "Installationnn" })
).toBeVisible();
}); Now I need to do this let page: Page;
let context: Context;
test.beforeAll(async ({ browser }) => {
context = await browser.newContext();
page = await context.newPage();
});
test("get started link", async () => {
await page.goto("https://playwright.dev/");
// Click the get started link.
await page.getByRole("link", { name: "Get started" }).click();
// Expects page to have a heading with the name of Installation.
await expect(
page.getByRole("heading", { name: "Installationnn" })
).toBeVisible();
});
test.afterAll("Cleanup", async () => {
await page.close();
await context.close();
});
|
Retaining traces in the following scenarios: - browser crash; - manual `browser.close()`; - implicit `browser.close()` from the `browser` fixture upon test end. This does not affect the library, where `browser.close()` will not retain the trace and will close the browser as fast as possible. References #31541, #31535, #31537.
I can verify that this bug (by the original reporter) is fixed in @beta and should be available in v1.45.2 soon. |
Version
1.45.1
Steps to reproduce
Clone https://github.com/cstlh/playwright-trace-issue
Run
npm -i
Run
npx playwright test
Open report
Check test that is failing and is using baseTest.ts has a mostly empty trace and most steps are missing
Check that failed test that is not using baseTest.ts, but instead using @playwright/test directly has all trace information
Check that passed test using baseTest.ts has full trace and steps
Additional steps:
npm i -D @playwright/test@1.43.1
Expected behavior
I expected that the whole trace is present in all failing tests
Actual behavior
Traces are mostly empty in failed tests
Additional context
I have tried the same setup in 1.43 and 1.44 and everything was working fine, this started failing for me when I tried to update the version to 1.45 and 1.45.1
Environment
System: OS: macOS 14.4.1 CPU: (8) arm64 Apple M2 Memory: 1004.56 MB / 24.00 GB Binaries: Node: 20.11.1 - /usr/local/bin/node npm: 10.8.0 - /usr/local/bin/npm pnpm: 9.4.0 - /usr/local/bin/pnpm IDEs: VSCode: 1.90.2 - /usr/local/bin/code Languages: Bash: 3.2.57 - /bin/bash npmPackages: @playwright/test: ^1.45.1 => 1.45.1
The text was updated successfully, but these errors were encountered: