Test Suites
Cypress
GitHub Actions

GitHub Actions

Cypress team has created its official GitHub Action (opens in a new tab). The action provides dependency installation, built-in caching, and multiple options for advanced workflow configuration. Using this GitHub Action is optional and some teams prefer their own custom setup. Replay integrates well with both workflows, as shown in examples below

💡

These instructions assume that you have already installed @replayio/cypress (opens in a new tab) plugin into your project. Follow the instructions on this page to learn how to install the plugin.

Using GitHub Actions with cypress-io/github-action

If you’re already using the Cypress’s @cypress-io/github-action (opens in a new tab), modify the step like this:

- name: Cypress run
  uses: cypress-io/github-action@v5
	with:
		# 🙋‍♂️ Specify Replay Chromium
    browser: replay-chromium
	env:
		REPLAY_API_KEY: ${{ secrets.REPLAY_API_KEY }}

Add a new step to run after this Cypress GitHub Action for uploading the replays:

- name: Upload replays
  if: always()
  uses: replayio/action-upload@v0.5.1
  with:
    api-key: ${{ secrets.REPLAY_API_KEY }}

Using GitHub Actions without cypress-io/github-action

If you’re using GitHub Actions and running tests by calling a script, but aren’t using Cypress’s @cypress-io/github-action (opens in a new tab), create a similar script in package.json like this:

"scripts": {
  "cy:run": "cypress run", // original test script
	"cy:run:replay": "cypress run --browser=replay-chromium" // new test script
}

Use that new test script instead in your current workflow file, and add the environment variable(s):

- name: Cypress run
  # run: npm run cy:run 
	run: npm run cy:run:replay
	env:
		REPLAY_API_KEY: ${{ secrets.REPLAY_API_KEY }}

Add a new step to run after this Cypress GitHub Action for uploading the replays:

- name: Upload replays
  if: always()
  uses: replayio/action-upload@v0.5.1
  with:
    api-key: ${{ secrets.REPLAY_API_KEY }}