Skip to content

[Bug]: Can't access test.slow in onTestBegin #36385

Open
@sarah-gelt

Description

@sarah-gelt

Version

1.52

Steps to reproduce

  1. Add test.slow() inside a test code block, indicating it's a slow test that needs more time to run
  2. In a custom test reporter, access TestCase.annotations or TestResult.annotations in onTestBegin

I used this as a diagnostic in my custom reporter just to log the annotations to see if they were present - we want to use some visual representations in the reporter to indicate slow tests that will take more time to execute

onTestBegin(test: TestCase, result: TestResult) {
    console.log("onTestBegin test.annotations", test.title, test.annotations);
    console.log("onTestBegin result.annotations", test.title, result.annotations);
  }

onTestEnd(test: TestCase, result: TestResult) {
    console.log("onTestEnd test.annotations", test.title, test.annotations);
    console.log("onTestEnd result.annotations", test.title, result.annotations);
}

Expected behavior

The slow annotation to be returned for the indicated slow test case

Actual behavior

The slow annotation is not present in the annotations array in onTestBegin. ℹ In onTestEnd the slow annotation is present, so it seems like it hasn't been discovered yet at test start.

Image

Additional context

Is it possible to ensure test.slow is exposed for onTestBegin via TestCase / TestResult or is there another solution I should be using? For our scenario, we want to indicate visually from the start of execution if the test is expected to be slow/long-running, but right now we can only do so once execution has already completed because it's only returned in annotations during onTestEnd

Environment

System:
    OS: macOS 15.5
    CPU: (10) arm64 Apple M1 Pro
    Memory: 148.00 MB / 16.00 GB
  Binaries:
    Node: 22.14.0 - ~/.nvm/versions/node/v22.14.0/bin/node
    npm: 10.9.2 - ~/.nvm/versions/node/v22.14.0/bin/npm
    pnpm: 10.7.1 - ~/.nvm/versions/node/v22.14.0/bin/pnpm
  IDEs:
    VSCode: 1.100.3 - /usr/local/bin/code
  Languages:
    Bash: 3.2.57 - /bin/bash
  npmPackages:
    @playwright/test: 1.52.0 => 1.52.0 
    playwright-qase-reporter: ^1.2.0-alpha.3 => v1.2.2

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