Description

Main class that provides OOP decorators for Playwright tests with Allure integration.

Exposes the following decorators:

  • @suite(name?) — define a test suite
  • @test(name?) — define a test method
  • @skip() — skip a test/suite
  • @only() — run only this test/suite
  • @slow(...opts) — mark test as slow
  • @extend(params) — extend test fixtures
  • Allure annotations: @label, @link, @id, @epic, @feature, @story, @allureSuite, @parentSuite, @subSuite, @owner, @severity, @tag, @tags, @issue, @description

A singleton instance is created at module level and its decorators are exported directly.

Example

import { suite, test, epic, feature, severity } from '@biorate/playwright';
import { Severity } from 'allure-js-commons';

@suite('Login')
class LoginTest {
@epic('Auth')
@feature('Login')
@severity(Severity.CRITICAL)
@test('should login')
async shouldLogin({ page }: TestArgs) {
await page.goto('/login');
// ...
}
}

Constructors

Properties

allureSuite: any
description: any
epic: any
extend: any
feature: any
id: any
issue: any
label: any
link: any
only: any
owner: any
parentSuite: any
severity: any
skip: any
slow: any
story: any
subSuite: any
suite: any
tag: any
tags: any
test: any

Methods

  • Parameters

    • name: string

    Returns ((target, propertyKey, descriptor) => void)

      • (target, propertyKey, descriptor): void
      • Parameters

        • target: any
        • propertyKey: string
        • descriptor: PropertyDescriptor

        Returns void

    Description

    Allure suite annotation.

  • Parameters

    • value: string

    Returns ((target, propertyKey, descriptor) => void)

      • (target, propertyKey, descriptor): void
      • Parameters

        • target: any
        • propertyKey: string
        • descriptor: PropertyDescriptor

        Returns void

    Description

    Allure description annotation.

  • Parameters

    • epic: string

    Returns ((target, propertyKey, descriptor) => void)

      • (target, propertyKey, descriptor): void
      • Parameters

        • target: any
        • propertyKey: string
        • descriptor: PropertyDescriptor

        Returns void

    Description

    Allure epic annotation.

  • Parameters

    • params: Record<string, any>

    Returns ((target, propertyKey, descriptor) => void)

      • (target, propertyKey, descriptor): void
      • Parameters

        • target: any
        • propertyKey: string
        • descriptor: PropertyDescriptor

        Returns void

    Description

    Decorator to extend test fixtures with custom values.

  • Parameters

    • epic: string

    Returns ((target, propertyKey, descriptor) => void)

      • (target, propertyKey, descriptor): void
      • Parameters

        • target: any
        • propertyKey: string
        • descriptor: PropertyDescriptor

        Returns void

    Description

    Allure feature annotation.

  • Parameters

    • id: string

    Returns ((target, propertyKey, descriptor) => void)

      • (target, propertyKey, descriptor): void
      • Parameters

        • target: any
        • propertyKey: string
        • descriptor: PropertyDescriptor

        Returns void

    Description

    Allure test id annotation.

  • Parameters

    • name: string
    • Optional url: string

    Returns ((target, propertyKey, descriptor) => void)

      • (target, propertyKey, descriptor): void
      • Parameters

        • target: any
        • propertyKey: string
        • descriptor: PropertyDescriptor

        Returns void

    Description

    Allure issue annotation.

  • Parameters

    • name: string
    • value: string

    Returns ((target, propertyKey, descriptor) => void)

      • (target, propertyKey, descriptor): void
      • Parameters

        • target: any
        • propertyKey: string
        • descriptor: PropertyDescriptor

        Returns void

    Description

    Allure label annotation.

  • Parameters

    • url: string
    • name: string
    • Optional type: string

    Returns ((target, propertyKey, descriptor) => void)

      • Parameters

        • target: any
        • propertyKey: string
        • descriptor: PropertyDescriptor

        Returns void

    Description

    Allure link annotation.

  • Returns ((target, ...args) => void)

      • (target, ...args): void
      • Parameters

        • target: any
        • Rest ...args: any[]

        Returns void

    Description

    Decorator that runs only this test or suite.

  • Parameters

    • name: string

    Returns ((target, propertyKey, descriptor) => void)

      • (target, propertyKey, descriptor): void
      • Parameters

        • target: any
        • propertyKey: string
        • descriptor: PropertyDescriptor

        Returns void

    Description

    Allure owner annotation.

  • Parameters

    • name: string

    Returns ((target, propertyKey, descriptor) => void)

      • (target, propertyKey, descriptor): void
      • Parameters

        • target: any
        • propertyKey: string
        • descriptor: PropertyDescriptor

        Returns void

    Description

    Allure parent suite annotation.

  • Parameters

    • severity: string

    Returns ((target, propertyKey, descriptor) => void)

      • (target, propertyKey, descriptor): void
      • Parameters

        • target: any
        • propertyKey: string
        • descriptor: PropertyDescriptor

        Returns void

    Description

    Allure severity annotation.

  • Returns ((target, ...args) => void)

      • (target, ...args): void
      • Parameters

        • target: any
        • Rest ...args: any[]

        Returns void

    Description

    Decorator that skips a test or suite.

  • Parameters

    • Rest ...opts: any[]

    Returns ((target, ...args) => void)

      • (target, ...args): void
      • Parameters

        • target: any
        • Rest ...args: any[]

        Returns void

    Description

    Decorator that marks a test as slow.

  • Parameters

    • story: string

    Returns ((target, propertyKey, descriptor) => void)

      • (target, propertyKey, descriptor): void
      • Parameters

        • target: any
        • propertyKey: string
        • descriptor: PropertyDescriptor

        Returns void

    Description

    Allure story annotation.

  • Parameters

    • name: string

    Returns ((target, propertyKey, descriptor) => void)

      • (target, propertyKey, descriptor): void
      • Parameters

        • target: any
        • propertyKey: string
        • descriptor: PropertyDescriptor

        Returns void

    Description

    Allure sub suite annotation.

  • Parameters

    • tag: string

    Returns ((target, propertyKey, descriptor) => void)

      • (target, propertyKey, descriptor): void
      • Parameters

        • target: any
        • propertyKey: string
        • descriptor: PropertyDescriptor

        Returns void

    Description

    Allure tag annotation.

  • Parameters

    • Rest ...tags: string[]

    Returns ((target, propertyKey, descriptor) => void)

      • (target, propertyKey, descriptor): void
      • Parameters

        • target: any
        • propertyKey: string
        • descriptor: PropertyDescriptor

        Returns void

    Description

    Allure tags annotation (multiple).

  • Parameters

    • Optional name: string

    Returns ((target, propertyKey, descriptor) => void)

      • (target, propertyKey, descriptor): void
      • Parameters

        • target: any
        • propertyKey: string
        • descriptor: PropertyDescriptor

        Returns void

    Description

    Decorator that marks a method as a test.

  • Parameters

    • Class: any

    Returns void

    Description

    Register the static after class method. It is registered as an additional beforeAll (not an afterAll), so it runs before the tests. The guard reads Class.before, so a static after is only registered when a static before is also present.