Skip to content

[Feature]: Make setBoxedStackPrefixes official #38818

Closed

Description

@mmkal

🚀 Feature Request

Hello! After some digging I found boxedStackPrefixes is responsible for not showing certain files in HTML output, traces etc. We have some library code that wraps waitFor to add some extra wait conditions that are specific to our app. In order to not have 90% of the wait expressions have the same line in the HTML output (callWaitFor(...args) sort of thing), we're using

setBoxedStackPrefixes([
  path.dirname(require.resolve("@playwright/test/package.json")),
  path.dirname(require.resolve("playwright/package.json")),
  path.dirname(require.resolve("playwright-core/package.json")),
  import.meta.filename,
]);

But

  1. This isn't documented
  2. It isn't typed
  3. I don't know for sure we're really using it right
  4. I don't know if it will disappear or change some day

So it would be great if it were made an official feature!

Example

No response

Motivation

Improve the UX of debugging tests when using helpers like

async function waitForAccountingForLoadingUI(locator: Locator) {
   // wait for UI to be fully loaded, can take a while
   return locator.waitFor()
}

Activity

  1. Skn0tt commented on Jan 19, 2026

    @Skn0tt
    Contributor

    Hi! Have you tried using boxed steps or boxed fixtures instead?

  2. mmkal commented on Jan 28, 2026

    @mmkal
    Author

    Simon Knott (@Skn0tt) ah I didn't know about that feature. It looks helpful but requires using test.step, so not exactly the same thing as what we're doing right now. Maybe with some refactoring it could be made to work, but the setBoxStackPrefix function is just what we want and already exists. Any reason not to add types/docs?

  3. Skn0tt commented on Jan 28, 2026

    @Skn0tt
    Contributor

    It's an implementation detail and not meant for public usage. Give test.step a shot!

  4. mmkal commented on Jan 28, 2026

    @mmkal
    Author

    I'll try it. I am thinking we might run in to trouble because what we're really doing is hooking into waitFor and similar methods on the Locator prototype to wait for any loading UI to disappear. This has been greeat for us because it lets us have extremely aggressive timeouts, and only allow for >1s for things to appear when there's a spinner or similar (which incentivises us to improve the product by showing "pending" UI when appropriate to make playwright tests pass reliably).

    But there are quite a few hacks - and it may not be possible to shove test.step in the middle of them. I'll have a try though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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