Skip to content

[Bug]: Error stack traces are truncated when using steps inside POM #40141

@ChernyshovDmitriy

Description

@ChernyshovDmitriy

Version

1.59.1

Steps to reproduce

  1. Create project by npm init playwright@latest
  2. Paste this content of example.spec.ts
import { test } from '@playwright/test';
import { TestModel } from '../test.model';

test('has title', async ({ page }) => {
  await page.goto('https://playwright.dev/');

  const model = new TestModel(page)

  await model.shouldBeCorrect();
});
  1. Create simple test.model.ts which just contains several methods, some of them calls Promise.all and uses test.step functionality
import test, { expect, Locator, Page } from "@playwright/test";

export class TestModel {
    readonly body: Locator
    constructor(page: Page) {
        this.body = page.locator('body')
    }

    async shouldBeValidColor(): Promise<void> {
        await test.step('Check color', async () => {
            await expect(this.body).toHaveCSS('color', 'fffffff');
        });
    }

    async shouldBeCorrect(): Promise<void> {
        await test.step('Check all', async () => {
            await Promise.all([
                this.shouldBeValidColor(),
                this.shouldBeValidColor(),
            ])
        });
    }
}
  1. Try to run test from example.spec.ts

Expected behavior

I expect and previous versions of PW (1.58.0 for example) shows something like this
I want to see whole stack trace includes shouldBeValidColor and shouldBeCorrect methods and line from example.spec.ts where method was called

    at test.model.ts:11:37
    at TestModel.shouldBeValidColor (test.model.ts:10:20)
    at test.model.ts:18:22
    at TestModel.shouldBeCorrect (test.model.ts:16:20)
    at tests/example.spec.ts:9:15

Actual behavior

Error trace was truncated to 3 lines
We don't see that TestModel.shouldBeCorrect was called

    at test2.model.ts:11:37
    at TestModel.shouldBeValidColor (test2.model.ts:10:9)
    at test2.model.ts:17:13

Additional context

No response

Environment

System:
    OS: macOS 26.4
    CPU: (11) arm64 Apple M3 Pro
    Memory: 473.00 MB / 18.00 GB
  Binaries:
    Node: 22.13.1 - /Users/user/.nvm/versions/node/v22.13.1/bin/node
    npm: 11.1.0 - /Users/user/.nvm/versions/node/v22.13.1/bin/npm
  IDEs:
    VSCode: 1.114.0 - /Applications/Visual Studio Code.app/Contents/Resources/app/bin/code
  Languages:
    Bash: 3.2.57 - /bin/bash
  npmPackages:
    @playwright/test: ^1.59.1 => 1.59.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions