playwright-test-commons - v0.8.0
    Preparing search index...

    Function errorCheck

    • Asserts an error status (soft), disposes the response, and optionally checks the error body against a schema.

      Parameters

      • response: APIResponse<unknown>

        the response to check

      • status: number

        the expected HTTP status, e.g. 404

      • options: { schema?: string } = {}

        optional checks on the error body

        • Optionalschema?: string

          schema name for the error body, e.g. "errors/error"

      Returns Promise<unknown>

      the body: parsed JSON if it is JSON, otherwise the raw text

      await errorCheck(await Posts.getPost("does-not-exist"), 404);