From 2824d09c7e27169daadea22bf77684d09a6bde39 Mon Sep 17 00:00:00 2001 From: Andy Balaam Date: Tue, 5 Sep 2023 11:49:53 +0100 Subject: [PATCH 1/3] Document how to match the CI config for Cypress --- README.md | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9916bcb928a..c16d6edc765 100644 --- a/README.md +++ b/README.md @@ -209,7 +209,44 @@ Now the yarn commands should work as normal. ### End-to-End tests -Make sure you've got your Element development server running (by doing `yarn -start` in element-web), and then in this project, run `yarn run test:cypress`. See +Make sure you've got your Element development server running: + +```bash +# Check out element-web from git first! +cd ../element-web +yarn start +``` + +Then in this project: + +```bash +yarn run test:cypress +``` + +Or to choose which tests to run interactively, and see them run in the browser, +try: + +```bash +yarn run test:cypress:open +``` + +See [`docs/cypress.md`](https://github.com/matrix-org/matrix-react-sdk/blob/develop/docs/cypress.md) for more information. + +Note: in some rare cases, tests behave differently between different browsers. +The CI tests for this project use the Chrome browser, so if you see CI failures +for the Cypress tests, but those tests work OK on your local machine, try +running them in Chrome or Chromium like this: + +```bash +yarn run test:cypress --browser=chrome +``` + +(Use `--browser=chromium` if you'd prefer to use Chromium.) + +If you launch the interactive UI you can choose the browser you want to use. To +match the CI setup, choose Chrome. + +You will need to have Chrome or Chromium installed on your system for this to +work. From 83cae3ae846ceb6096432a001e232bb0981fded9 Mon Sep 17 00:00:00 2001 From: Andy Balaam Date: Tue, 5 Sep 2023 11:55:10 +0100 Subject: [PATCH 2/3] Clarify language about needing Chrome --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c16d6edc765..455f74aa588 100644 --- a/README.md +++ b/README.md @@ -248,5 +248,6 @@ yarn run test:cypress --browser=chrome If you launch the interactive UI you can choose the browser you want to use. To match the CI setup, choose Chrome. -You will need to have Chrome or Chromium installed on your system for this to -work. +You will need to have Chrome or Chromium installed on your system to run the +tests inside those browsers, whereas the default is to use Electron, which is +included within the Cypress dependency. From 310dde5af0a375ad416dd26a022df8ec15112f4b Mon Sep 17 00:00:00 2001 From: Andy Balaam Date: Tue, 5 Sep 2023 12:09:35 +0100 Subject: [PATCH 3/3] Move Cypress info into the Cypress-specific docs --- README.md | 44 ++------------------------------------------ docs/cypress.md | 29 ++++++++++++++++++++++++----- 2 files changed, 26 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 455f74aa588..716a084efd2 100644 --- a/README.md +++ b/README.md @@ -209,45 +209,5 @@ Now the yarn commands should work as normal. ### End-to-End tests -Make sure you've got your Element development server running: - -```bash -# Check out element-web from git first! -cd ../element-web -yarn start -``` - -Then in this project: - -```bash -yarn run test:cypress -``` - -Or to choose which tests to run interactively, and see them run in the browser, -try: - -```bash -yarn run test:cypress:open -``` - -See -[`docs/cypress.md`](https://github.com/matrix-org/matrix-react-sdk/blob/develop/docs/cypress.md) -for more information. - -Note: in some rare cases, tests behave differently between different browsers. -The CI tests for this project use the Chrome browser, so if you see CI failures -for the Cypress tests, but those tests work OK on your local machine, try -running them in Chrome or Chromium like this: - -```bash -yarn run test:cypress --browser=chrome -``` - -(Use `--browser=chromium` if you'd prefer to use Chromium.) - -If you launch the interactive UI you can choose the browser you want to use. To -match the CI setup, choose Chrome. - -You will need to have Chrome or Chromium installed on your system to run the -tests inside those browsers, whereas the default is to use Electron, which is -included within the Cypress dependency. +We use Cypress and Element Web for end-to-end tests. See +[`docs/cypress.md`](docs/cypress.md) for more information. diff --git a/docs/cypress.md b/docs/cypress.md index 53c50877ea1..3ef251e9a98 100644 --- a/docs/cypress.md +++ b/docs/cypress.md @@ -1,11 +1,8 @@ # Cypress in Element Web -## Scope of this Document +## Contents -This doc is about our Cypress tests in Element Web and how we use Cypress to write tests. -It aims to cover: - -- How to run the tests yourself +- How to run the tests - How the tests work - How to write great Cypress tests - Visual testing @@ -45,6 +42,28 @@ To launch it: yarn run test:cypress:open ``` +### Matching the CI environment + +In our Continuous Integration environment, we run the Cypress tests in the +Chrome browser. + +In some rare cases, tests behave differently between different browsers, so if +you see CI failures for the Cypress tests, but those tests work OK on your local +machine, try running them in Chrome like this: + +```bash +yarn run test:cypress --browser=chrome +``` + +(Use `--browser=chromium` if you'd prefer to use Chromium.) + +If you launch the interactive UI you can choose the browser you want to use. To +match the CI setup, choose Chrome. + +Note that you will need to have Chrome installed on your system to run the tests +inside those browsers, whereas the default is to use Electron, which is included +within the Cypress dependency. + ### Running with Rust cryptography `matrix-js-sdk` is currently in the