Skip to content

Catch failed assertions #1560

Closed
Closed
@doronnac

Description

@doronnac

Hi everyone,

[tl;dr] I need a way to catch failed assertions in order to take a screenshot with Selenium.

I'm trying out ava as a test runner for e2e tests with Selenium. No arguments are passed to ava and I'm using test.serial, with each file having its own webdriver instance (so different browser per file).

One of the requirements I need to fulfill is to take a screenshot whenever an assertion fails, then call driver.quit() (file's instance, async) to close the browser. This has to happen before process.quit() is called (if at all).

My understanding is that ava provides no way of checking an assertion status as it completes.

It might be worth noting that I also tried Tape, and could get assertion status with the help of createStream method and pipe'ing the stream to both stdout and a tap parser. Maybe the same can be applied to ava when --tap flag is used?

Thanks a lot.

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