storybookjs / test-runner

🚕 Turn stories into executable tests
https://storybook.js.org/docs/writing-tests/interaction-testing
MIT License
229 stars 72 forks source link

Feature: Run postVisit on failures #494

Open yannbf opened 2 months ago

yannbf commented 2 months ago

Closes #

What I did

Experiment for allowing postVisit to be run on failures so you can do things like:

const config: TestRunnerConfig = {
  async postVisit(_page, context) {
    if(context.hasFailure) {
      console.log('problems!', context)
    }
  },
}

Checklist for Contributors

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

Checklist for Maintainers

📦 Published PR as canary version: 0.19.2--canary.494.7268a7d.0
:sparkles: Test out this PR locally via: ```bash npm install @storybook/test-runner@0.19.2--canary.494.7268a7d.0 # or yarn add @storybook/test-runner@0.19.2--canary.494.7268a7d.0 ```