You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: documentation/develop.md
+92-2
Original file line number
Diff line number
Diff line change
@@ -115,7 +115,7 @@ And start using your nodejs debugger client (like the Chrome Devtools). See http
115
115
You may run the tests using one of these commands:
116
116
-`yarn test` to run all the tests
117
117
-`yarn test:smoke` to run the minimal test checking Grist can open, create and edit a document
118
-
-`yarn test:nbrowser` to run the end-to-end tests
118
+
-`yarn test:nbrowser` to run the end-to-end tests (⚠️ see warning below)
119
119
-`yarn test:client` to run the tests for the client libraries
120
120
-`yarn test:common` to run the tests for the common libraries shared between the client and the server
121
121
-`yarn test:server` and `yarn test:gen-server` to run the backend tests depending on where the feature you would like to test resides (respectively `app/server` or `app/gen-server`)
@@ -126,9 +126,99 @@ Also some options that may interest you:
126
126
-`GREP_TESTS="pattern"` in order to filter the tests to run, for example: `GREP_TESTS="Boot" yarn test:nbrowser`
127
127
-`VERBOSE=1` in order to view logs when a server is spawned (especially useful to debug the end-to-end and backend tests)
128
128
-`SERVER_NODE_OPTIONS="node options"` in order to pass options to the server being tested,
129
-
for example: `SERVER_NODE_OPTIONS="--inspect --inspect-brk" GREP_TESTS="Boot" yarn test:nbrowser`
129
+
for example: `SERVER_NODE_OPTIONS="--inspect --inspect-brk" GREP_TESTS="Boot" yarn test:nbrowser`
130
130
to run the tests with the debugger (you should close the debugger each time the node process should stop)
131
131
132
+
## End-to-end tests
133
+
134
+
End-to-end tests work by simulating user mouse clicks and keyboard inputs in an actual chrome browser. By default, running `yarn test:nbrowser` opens a new browser window where automated "user" interactions happen.
135
+
136
+
### Headless mode
137
+
138
+
You can use the `MOCHA_WEBDRIVER_HEADLESS` env var to start the tests in headless mode, meaning a browser window won't be opened:
139
+
140
+
```
141
+
MOCHA_WEBDRIVER_HEADLESS=1 yarn run test:nbrowser
142
+
```
143
+
144
+
Running in headless mode allows you to run the tests in background, without the risk of automated tests catching window focus while you are doing something else.
145
+
146
+
Running in normal mode helps you understand better what happens when writing or debugging tests.
147
+
148
+
### Browser version issues
149
+
150
+
End-to-end tests are run in the GitHub CI with a specific _Chrome_ version that is known to run the tests smoothly.
151
+
152
+
⚠️ A current issue is that tests don't run properly with _Chrome for Testing_ binaries, or with _Chrome_ starting with version 134.
153
+
154
+
**If you don't have any tests randomly failing while running them locally: great! You can move on.**
155
+
156
+
Otherwise, you should make sure that the local test suite uses _Chrome v132_ or _Chrome v133_, and not a _Chrome for Testing_ variant.
157
+
158
+
In order to do that, you can use an env var to let the script know about a specific chrome binary to use. For example, if your Chrome (v132 or 133) path is `/usr/bin/google-chrome`:
159
+
160
+
```
161
+
TEST_CHROME_BINARY_PATH="/usr/bin/google-chrome" yarn run test:nbrowser
162
+
```
163
+
164
+
#### Using an older Chrome version than the one you have already installed
165
+
166
+
You might already have Chrome v134+ installed and feel stuck!
167
+
168
+
One solution is to build yourself a docker container matching what the GitHub actions does. Meaning, with node, python etc, an integrated Chrome v133 binary, and run tests inside that container.
169
+
170
+
Another solution on Linux, is to just install an old Chrome version on your system directly.
171
+
172
+
A simple trick is to install an old Chrome _Beta_ binary, in order to not mess with your current Chrome install.
173
+
174
+
#### Debian-based distro
175
+
176
+
You can do the same as the `buildtools/install_chrome_for_tests.sh` script, but target an old version of Chrome _Beta_ like this:
0 commit comments