Comment on page
Canceling Runs
Cancelling Cypress and Playwright CI tests runs
Runs that are currently in progress can be cancelled using the dashboard controls or via an API call.
Cancelling a run can be useful for:
- preventing a run from timing out
- optimizing usage of your CI provider resources
- reducing the number of recorded tests
Please note: Cancelling a run cannot be undone
In-progress runs can be cancelled by clicking the "Cancel Run" button in the Runs Feed view.

Cancelling cypress tests run from Runs Feed view
You can also cancel a run when from the Run Details view.

Cancelling cypress tests run from Run Details view

Example of a run cancelled by a dashboard user
You can programmatically cancel a run via the
PUT runs/:runId/cancel
HTTP API call. For example, here is an example of curl
command that cancels a particular runcurl --location --request PUT 'https://api.currents.dev/v1/runs/:runId/cancel' \
--header 'Authorization: Bearer <currents API token>'
By using the API call you can extend the - for example:
- cancel a run after CI pipeline is stopped/cancelled
- cancel a run when a particular condition is met, e.g.:
- based on the results (e.g. encountering a particular error message), send the cancellation request
- cancel a run when a certain number of failed tests are detected (it is natively supported via Fail Fast Strategy)
If you have Fail Fast Strategy activated for a project, runs cancelled because of fail-fast strategy will be marked with a special badge:

Example of a run cancelled by fail-fast strategy
You can automatically cancel Currents runs (cypress and playwright) when cancelling GitHub Actions workflow using cancel-run-gh-action.
# Run all Currents tests
- name: Run Cypress on Currents.dev
uses: cypress-io/github-action@v4
with:
command: npx cypress-cloud run --record --parallel --browser chrome --key ${{ secrets.CURRENTS_RECORD_KEY }} --ci-build-id ${{ github.repository }}-${{ github.run_id }}-${{ github.run_attempt}}
- name: Cancel the run if the workflow is cancelled
if: ${{ cancelled() }}
uses: currents-dev/cancel-run-gh-action@v1
with:
api-token: ${{ secrets.CURRENTS_API_KEY }}
github-run-id: ${{ github.run_id }}
github-run-attempt: ${{ github.run_attempt }}
The example above uses a GitHub Actions repository secret named
CURRENTS_API_KEY.
For creating a new API secret please refer to API Keys.After the step is enabled, cancelling a GitHub Actions workflow will trigger cancellation:

Example of a cancellation step
The associated Currents run will be cancelled with the corresponding notes:

Cancelling a run affects in-progress and pending tests, as well as integrations and run analytics.
- the run will be marked as "Cancelled", depending on the test's status, it can also become "Failed" or "Passed". See Run Status.
- in-progress tests will run to completion, the dashboard will accept their result
- attempts to start a new test for a cancelled run would fail with the error message
Run is cancelled
- Cancelled runs are excluded from Runs Duration Insights
- Cancelled runs are excluded from Test / Spec Size Insights
- Tests recorded as part of a cancelled run are still included in Tests Insights charts
- Only fully recorded tests consume your organization's test records limit.
- Cancelled runs do consume your organization's runs limit (for organizations on deprecated runs-based plans)
- Commit status checks will display
Cancelled by <username>
message - Commit status check outcome will be set according to the last known run status, for example
- if no failed tests were recorded before the cancellation, the status check outcome will be a
success
- otherwise, the status check outcome will be a
failure

Cancelling cypress tests run - GitHub commit status message
- Currents will post a new PR comment with
Cancelled by <username>
message - PR comment details will be set according to the last known run status

Cancelling cypress tests run - GitHub PR comment
- Currents will post a cancellation notification with the last known run results

Cancelling cypress tests run - Slack message example

Cancelling cypress tests run - MS Teams example
- A new HTTP POST request will be emitted with the last known run results. and event type
RUN_CANCELED
See HTTP Webhooks for details.
Last modified 1mo ago