Skip to content

Commit ba0c511

Browse files
authored
Merge pull request #207 from replayio/filip/dev-456-we-should-have-a-more-opinionated-cypress-setup-guide
simplify cypress github ci docs
2 parents a7551eb + d7aace5 commit ba0c511

File tree

8 files changed

+117
-57
lines changed

8 files changed

+117
-57
lines changed

src/app/learn/examples/cypress-io/page.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ Take a look at the YAML file for the workflow definition. We recommend diving in
1313

1414
- [project repository](https://github.com/replayio-public/overboard)
1515
- [workflow file](https://github.com/replayio-public/overboard/blob/main/.github/workflows/cypress.yaml)
16-
{% /callout %}
16+
17+
{% /callout %}
1718

1819
## Debugging a Cypress test flake on CI
1920

@@ -30,7 +31,8 @@ The replay shown in video [can be found on this link](https://replay.help/cypres
3031
{% callout title="Debugging a flaky test" type="link" %}
3132

3233
- [link to the replay showing flaky Cypress test](https://replay.help/cypress-flake-debug)
33-
{% /callout %}
34+
35+
{% /callout %}
3436

3537
## False positive accessibility check
3638

@@ -44,4 +46,5 @@ You can read about the debugging process in this blogpost. If you want to see th
4446

4547
- [example project](https://github.com/replayio/replay-examples/tree/main/examples/03_accessibility_false_positive)
4648
- [blogpost about the false positive case](https://blog.replay.io/finding-%22false-positive%22-tests-with-replay.io)
47-
{% /callout %}
49+
50+
{% /callout %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
title: GitHub upload action
3+
---
4+
5+
GitHub upload action takes care of uploading your recordings during your CI test runs on GitHub. It enables you to filter the recordings you upload to Replay App.
6+
7+
{% tabs labels=["cypress", "playwright"] %}
8+
{% tab %}
9+
10+
```yaml {% fileName=".github/workflows/e2e.yml" highlight=["15-19"] lineNumbers=true %}
11+
name: End-to-end tests
12+
on: push
13+
jobs:
14+
cypress-run:
15+
runs-on: ubuntu-22.04
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
- name: Install Replay Chromium
20+
run: npx replayio install
21+
- name: Cypress run
22+
uses: cypress-io/github-action@v6
23+
with:
24+
browser: replay-chromium
25+
- name: Upload replays
26+
if: always()
27+
uses: replayio/[email protected]
28+
with:
29+
api-key: ${{ secrets.REPLAY_API_KEY }}
30+
```
31+
32+
{% /tab %}
33+
{% tab %}
34+
35+
```yml {% fileName=".github/workflows/e2e.yml" lineNumbers=true highlight=["19-23"] %}
36+
name: End-to-end tests
37+
on:
38+
pull_request:
39+
push:
40+
branches: [main]
41+
jobs:
42+
e2e-tests:
43+
runs-on: ubuntu-22.04
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v4
47+
# If you're using Yarn or PNPM, use the appropriate install command here
48+
- name: Install dependencies
49+
run: npm ci
50+
- name: Install Replay Chromium
51+
run: npx replayio install
52+
- name: Run Playwright tests
53+
run: npx playwright test --project replay-chromium
54+
- name: Upload replays
55+
if: always()
56+
uses: replayio/[email protected]
57+
with:
58+
api-key: ${{ secrets.REPLAY_API_KEY }}
59+
```
60+
61+
{% /tab %}
62+
{% /tabs %}
63+
64+
{% callout %}
65+
Make sure to set `if: ${{ always() }}` so that this step is always executed, even when the previous step fails.
66+
{% /callout %}
67+
68+
{% quick-links title="Learn more" %}
69+
70+
{% quick-link
71+
title="Upload strategies"
72+
icon="uploadicon"
73+
description="There are different strategies for uploading your replays such as uploading only on test flakes or failures."
74+
href="/reference/ci-workflows/upload-strategies"
75+
/%}
76+
77+
{% /quick-links %}

src/app/reference/replay-teams/okta-integration/page.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,13 @@ Logging in with SSO, is as easy as going to app.replay.io, clicking Sign In with
4141
To make this change, you must have Admin access to your Okta deployment.
4242

4343
1. Find the necessary dialogue to add an App by going to Admin → Applications → Applications. Here’s an example of the screen you should see:
44-
{% figure alt="Elements panel" src="/images/okta-2.webp" height=440 width=870/%}
44+
45+
{% figure alt="Elements panel" src="/images/okta-2.webp" height=440 width=870/%}
4546

4647
2. Click on “Create App Integration”, select “SAML 2.0” and click on Next.
4748
3. In General Settings give the name to the app: “Replay” and click Next.
48-
{% figure alt="Elements panel" src="/images/okta-3.webp" height=440 width=870/%}
49+
50+
{% figure alt="Elements panel" src="/images/okta-3.webp" height=440 width=870/%}
4951

5052
4. Using the configuration info sent from Replay (and referencing the above) fill out the next screen. Here is an example of that screen filled out with example information:
5153

src/app/reference/test-runners/cypress-io/faq/page.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ title: Frequently asked questions
2828

2929
- All logs
3030
- DEBUG=cypress:launcher:browsers RECORD_REPLAY_VERBOSE=1
31-
{% /table %}
31+
32+
{% /table %}
3233

3334
## How do I group tests ran in a matrix or across multiple runners into the same test run?
3435

Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
11
---
2-
title: GitHub actions
2+
title: GitHub actions with Cypress
33
---
44

5-
Cypress team has created its [official GitHub Action](https://github.com/cypress-io/github-action). The action provides dependency installation, built-in caching, and multiple options for advanced workflow configuration.
6-
7-
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
8-
95
{% callout %}
10-
These instructions assume that you have already installed [`@replayio/cypress`](https://www.npmjs.com/package/@replayio/cypress) plugin into your project. [Follow the instructions on this page](/basics/getting-started/record-your-cypress-tests) to learn how to install the plugin.
6+
These instructions assume that you have already [set up your Cypress project](/basics/getting-started/record-your-cypress-tests).
117
{% /callout %}
128

13-
## Using GitHub Actions with `cypress-io/github-action`
14-
15-
When using the Cypress [GitHub Action](https://github.com/cypress-io/github-action), the CI setup requires just a couple of lines of code. For the Cypress run itself, the `replay-chromium` browser needs to be passed in to create recordings.
16-
17-
After test run finishes, an additional step needs to be added to upload all the recordings using `@replayio/action-upload` action.
9+
This example uses [Cypress GitHub Action](https://github.com/cypress-io/github-action) that provides dependency installation, built-in caching, and multiple options for advanced workflow configuration. For recording your test, the `replay-chromium` browser needs to be passed as a browser.
1810

1911
```yaml {% fileName=".github/workflows/e2e.yml" highlight=["11-19"] lineNumbers=true %}
2012
name: End-to-end tests
@@ -33,48 +25,23 @@ jobs:
3325
browser: replay-chromium
3426
env:
3527
REPLAY_API_KEY: ${{ secrets.REPLAY_API_KEY }}
36-
- name: Upload replays
37-
if: always()
38-
uses: replayio/[email protected]
39-
with:
40-
api-key: ${{ secrets.REPLAY_API_KEY }}
4128
```
4229
43-
## Using GitHub Actions without `cypress-io/github-action`
44-
45-
Without using GitHub Actions and running your Cypress tests by calling a script, the main principles stay the same:
30+
Running with Replay browser will create your replays. These are stored locally on your CI and need to be uploaded to Replay app once the test run is finished.
4631
47-
- you need to make sure to pass `REPLAY_API_KEY` to your test run
48-
- add step to your pipeline to upload your replays
32+
{% quick-links title="Learn more" %}
4933
50-
There are a couple of different ways to achieve this. For example, you can update your `package.json` file with a custom script that runs your Cypress tests with Replay Browser
51-
52-
```json {% fileName="package.json" highlight=[3] %}
53-
"scripts": {
54-
"cy:run": "cypress run", // original test script
55-
"cy:run:replay": "cypress run --browser=replay-chromium" // new test script
56-
}
57-
```
34+
{% quick-link
35+
title="Upload strategies"
36+
icon="uploadicon"
37+
description="There are different strategies for uploading your replays such as uploading only on test flakes or failures."
38+
href="/reference/ci-workflows/upload-strategies"
39+
/%}
40+
{% quick-link
41+
title="GitHub upload action"
42+
icon="github"
43+
description="GitHub upload action takes care of uploading your recordings during your CI test runs on GitHub. It enables you to filter the recordings you upload to Replay App."
44+
href="/reference/ci-workflows/github-action-upload"
45+
/%}
5846
59-
Use that new test script instead in your current workflow file, and add the environment variable(s):
60-
61-
```yaml {% fileName=".github/workflows/e2e.yml (partial)" lineNumbers=true highlight=[2] %}
62-
- name: Cypress run
63-
run: npm run cy:run:replay
64-
env:
65-
REPLAY_API_KEY: ${{ secrets.REPLAY_API_KEY }}
66-
```
67-
68-
Add a new step to run after your Cypress tests for uploading the replays:
69-
70-
```yaml {% fileName=".github/workflows/e2e.yml (partial)" lineNumbers=true %}
71-
- name: Upload replays
72-
if: always()
73-
uses: replayio/[email protected]
74-
with:
75-
api-key: ${{ secrets.REPLAY_API_KEY }}
76-
```
77-
78-
{% callout title="Upload strategies" %}
79-
There are different strategies for uploading your replays. For example you can use Replay only when retrying a failed test, or choose to upload recordings from failed tests only. See [docs on upload strategies](/reference/ci-workflows/upload-strategies) to learn more.
80-
{% /callout %}
47+
{% /quick-links %}

src/components/Icon.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ import { PauseIcon } from './icons/PauseIcon'
5555
import { VideocamSharp } from './icons/VideocamSharp'
5656
import { ReduxIcon } from './icons/ReduxIcon'
5757
import { Vercel } from './icons/Vercel'
58+
import { UploadIcon } from './icons/UploadIcon'
5859

5960
export const icons = {
6061
bracketscurly: BracketsCurlyIcon,
@@ -111,6 +112,7 @@ export const icons = {
111112
video: VideocamSharp,
112113
redux: ReduxIcon,
113114
vercel: Vercel,
115+
uploadicon: UploadIcon,
114116
}
115117

116118
export const iconStyles = {

src/lib/navigation.ts

+4
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,10 @@ export const navigation: Record<NavigationNames, NavigationItem[]> = {
309309
title: 'Upload strategies',
310310
href: '/reference/ci-workflows/upload-strategies',
311311
},
312+
{
313+
title: 'GitHub upload action',
314+
href: '/reference/ci-workflows/github-action-upload',
315+
},
312316
],
313317
},
314318
{

vercel.json

+4
Original file line numberDiff line numberDiff line change
@@ -1112,6 +1112,10 @@
11121112
{
11131113
"source": "/test-runners/cypress-io",
11141114
"destination": "/reference/test-runners/cypress-io/overview"
1115+
},
1116+
{
1117+
"source": "/docs/setting-up-a-team-f5bd9ee853814d6f84e23fb535066199#4913df9eb7384a94a23ccbf335189370",
1118+
"destination": "/reference/ci-workflows/generate-api-key"
11151119
}
11161120
],
11171121
"rewrites": [

0 commit comments

Comments
 (0)