Skip to content

Commit 2eefb17

Browse files
authored
Merge pull request #198 from replayio/explicit-install-instructions-replayio-cypress
Make Replay installation instructions explicit in Cypress docs
2 parents 2d6bf2b + 7b5ecc5 commit 2eefb17

File tree

5 files changed

+38
-24
lines changed

5 files changed

+38
-24
lines changed

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

+19-6
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,35 @@ title: Frequently asked questions
33
---
44

55
## How do I get debug logs?
6+
67
{% table %}
8+
79
- Debug focus
810
- Command
11+
912
---
13+
1014
- Cypress
1115
- `DEBUG=replay:cypress:*`
16+
1217
---
18+
1319
- Replay plugin
1420
- `DEBUG=replay:cypress:plugin`
21+
1522
---
23+
1624
- Replay Browser
1725
- DEBUG=cypress:launcher:browsers RECORD_REPLAY_VERBOSE=1
26+
1827
---
28+
1929
- All logs
2030
- DEBUG=cypress:launcher:browsers RECORD_REPLAY_VERBOSE=1
21-
{% /table %}
31+
{% /table %}
2232

2333
## How do I group tests ran in a matrix or across multiple runners into the same test run?
34+
2435
By default, each invocation of Cypress is grouped into a test run by a UUID generated when the run begins. To group multiple invocations of Cypress into the same run, set `RECORD_REPLAY_METADATA_TEST_RUN_ID` to the same UUID value and that will be used instead of generating a UUID for each.
2536

2637
Below is an example which runs three test suites using a matrix in Github Actions but groups the results into the same test run in Replay:
@@ -47,21 +58,24 @@ test:
4758
node-version: 16
4859
- name: Install dependencies
4960
run: npm ci
61+
- name: Install Replay Chromium
62+
run: npx replayio install
5063
- name: Run
5164
run: npm run test-${{ matrix.product }}
5265
env:
5366
RECORD_REPLAY_METADATA_TEST_RUN_ID: ${{ needs.test-run-id.outputs.testRunId }}
5467
```
5568
5669
## What’s in the `.replay` folder?
57-
`/.replay/runtimes` - this is where the replay browser(s) are installed
70+
71+
`/.replay/runtimes` - this is where the replay browser is installed
5872

5973
`/` - recorded replays are saved locally in the root folder
6074

6175
If you’re trying to cache the browser download, cache `~/.replay/runtimes` or simply cache it before creating replays.
6276

77+
## How do I confirm that the browser is installed correctly
6378

64-
## How do I confirm that the browsers are installed correctly
6579
Run `ls -alR ~/.replay/runtimes` to see the contents of the runtimes folder.
6680

6781
## How do I troubleshoot recordings not being created?
@@ -74,15 +88,14 @@ export default defineConfig({
7488
setupNodeEvents(cyOn, config) {
7589
const on = wrapOn(cyOn)
7690
// ... rest of your plugins-related code
77-
}
78-
}
91+
},
92+
},
7993
})
8094
```
8195

8296
const on = wrapOn(cyOn)
8397

8498
## What other environment variables can I configure?
85-
`REPLAY_SKIP_BROWSER_DOWNLOAD` - keeps browsers from being downloaded and installed during `npm install`
8699

87100
`RECORD_REPLAY_METADATA_TEST_RUN_TITLE` - manually apply a test run title, instead of being inferred from the latest commit
88101

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: GitHub actions
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.
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.
66

77
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
88

@@ -25,6 +25,8 @@ jobs:
2525
steps:
2626
- name: Checkout
2727
uses: actions/checkout@v4
28+
- name: Install Replay Chromium
29+
run: npx replayio install
2830
- name: Cypress run
2931
uses: cypress-io/github-action@v6
3032
with:
@@ -41,10 +43,12 @@ jobs:
4143
## Using GitHub Actions without `cypress-io/github-action`
4244

4345
Without using GitHub Actions and running your Cypress tests by calling a script, the main principles stay the same:
46+
4447
- you need to make sure to pass `REPLAY_API_KEY` to your test run
4548
- add step to your pipeline to upload your replays
4649

4750
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+
4852
```json {% fileName="package.json" highlight=[3] %}
4953
"scripts": {
5054
"cy:run": "cypress run", // original test script

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

+13-14
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,18 @@ Available browsers found on your system are:
3030
- firefox:dev
3131
- firefox:nightly
3232
- electron
33-
- Replay Firefox
3433
```
3534

3635
- This is expected (for now). Check first whether the process exits immediately, chances are the test ends up proceeding as expected!
3736
- While modifying `cypress.config.js`, make sure you’re returning the `config` object in `setupNodeEvents`
38-
- Make sure you’re using the correct browser for your operating system. `replay-chromium` is only supported on linux, whereas `replay-firefox` supports both mac and linux.
39-
- The environment variable `[CYPRESS_INSTALL_BINARY](https://docs.cypress.io/guides/references/advanced-installation)` may be suppressing the browser install step. If it’s set to `0`, make sure to add an explicit workflow step to install the browsers (`npx @replayio/cypress install`)
37+
- Make sure you’re using the correct browser for your operating system. `replay-chromium` is only supported on linux and mac
38+
- The environment variable `[CYPRESS_INSTALL_BINARY](https://docs.cypress.io/guides/references/advanced-installation)` may be suppressing the browser install step. If it’s set to `0`, make sure to add an explicit workflow step to install the browsers (`npx replayio install`)
4039
- Your caching strategy might be keeping our plugin from pulling in the correct browser. Start debugging it by turning off all caching, e.g. `actions/cache`
4140

4241
# How do I use Replay with versions earlier than 10.9?
4342

4443
Replay works best with Cypress 10.9 or later but can be used with Cypress 8 or later with some additional environment configuration:
4544

46-
- `RECORD_ALL_CONTENT` must be set when using `replay-firefox` to record replays
4745
- `RECORD_REPLAY_METADATA_FILE` must be set for either browser to capture metadata about the test run.
4846

4947
When running locally, you can set these variables in your npm scripts so they are set every time:
@@ -58,14 +56,15 @@ When running locally, you can set these variables in your npm scripts so they ar
5856
On CI, you can set these environment variables on the task that runs your tests:
5957

6058
```yaml
61-
# Install NPM dependencies, cache them correctly
59+
- name: Install Replay Chromium
60+
run: npx replayio install
61+
# Install NPM dependencies, cache them correctly
6262
# and run all Cypress tests
6363
- name: Cypress run
6464
uses: cypress-io/github-action@v5
6565
with:
6666
browser: replay-chromium
6767
env:
68-
RECORD_ALL_CONTENT: 1
6968
RECORD_REPLAY_METADATA_FILE: /tmp/replay-metadata
7069

7170
```
@@ -83,7 +82,7 @@ sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.22_amd64.deb
8382

8483
If you’re using DeploySentinel, you may notice that either you are unable to record replays or the replays created do not show the Cypress Panel when you open them. This is caused by environment variables set by our plugin that are not passed on by DeploySentinel.
8584

86-
Fortunately, you can set this manually on the command line or in your CI configuration. Follow the [instructions for running with earlier versions of Cypress](/reference/test-runners/cypress-io/faq) to configure `RECORD_REPLAY_METADATA_FILE` (and `RECORD_ALL_CONTENT` if you’re using Firefox).
85+
Fortunately, you can set this manually on the command line or in your CI configuration. Follow the [instructions for running with earlier versions of Cypress](/reference/test-runners/cypress-io/faq) to configure `RECORD_REPLAY_METADATA_FILE`
8786

8887
```bash
8988
RECORD_REPLAY_METADATA_FILE=/tmp/replay-metadata.json npx run cypress
@@ -96,22 +95,22 @@ When the browser hangs while running a test, it is likely an interaction between
9695
You can run the test in **diagnostic mode** by passing in a mode flag.
9796

9897
```bash
99-
npx @replayio/cypress run --mode diagnostics --level full
98+
npx @replayio/cypress run --mode diagnostics --level full
10099
```
101100

102-
For more information, see [Diagnostic modes](/reference/test-runners/cypress-io/overview)
101+
For more information, see [Diagnostic modes](/reference/test-runners/cypress-io/overview)
103102

104103
We also recommend going for the simplest reproduction which includes running the fewest specs possible and setting a timeout so that the test fails as soon as possible.
105104

106105
You can use the **Cypress timeout** command to set a timeout
107106

108107
```jsx
109-
describe("test spec", () => {
110-
it("test case", () => {
108+
describe('test spec', () => {
109+
it('test case', () => {
111110
// set the timeout to 1min
112-
cy.visit("/login", { timeout: 60000 });
113-
});
114-
});
111+
cy.visit('/login', { timeout: 60000 })
112+
})
113+
})
115114
```
116115

117116
You can set a single spec to run, by using the `--spec` flag

src/app/reference/test-runners/playwright/faq/page.md

-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ Run `ls -alR ~/.replay/runtimes` to see the contents of the runtimes folder.
6666

6767
{% accordion-item title="What other environment variables can I configure?" %}
6868

69-
`REPLAY_SKIP_BROWSER_DOWNLOAD` - keeps browsers from being downloaded and installed during `npm install`
70-
7169
`RECORD_REPLAY_METADATA_TEST_RUN_TITLE` - manually apply a test run title, instead of being inferred from the latest commit
7270

7371
`RECORD_REPLAY_DIRECTORY` - set a custom directory (default: `~/.replay`)

src/app/reference/test-runners/playwright/troubleshooting/page.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Error: ENOENT: no such file or directory, open '/home/runner/.replay/PLAYWRIGHT_
2929
If you’re seeing this error in CI, it’s likely that the replay browser wasn’t installed correctly. The browser should be installed alongside all your other dependencies, but in the case that it’s not, try the following:
3030

3131
1. Disable caching
32-
2. Have an explicit step for installing the replay browser - `npx @replayio/playwright install`
32+
2. Have an explicit step for installing the replay browser - `npx replayio install`
3333

3434
{% /accordion-item %}
3535
{% /accordion %}

0 commit comments

Comments
 (0)