Skip to content

Commit

Permalink
[cypress] Update doc for cypress.config.[dist].mjs
Browse files Browse the repository at this point in the history
After PR joomla#43676 '[4.4] Move the Cypress Tests to ESM' the cypress config file is renamed to `.mjs`.
This PR is for updating README and architecture pictures.
  • Loading branch information
muhme committed Jun 25, 2024
1 parent cbec9f9 commit f4f322d
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 106 deletions.
18 changes: 9 additions & 9 deletions tests/System/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ It is simplified to offer an initial understanding. Detailed explanations follow

![System Tests Architecture](images/system-tests.svg)

On the left, **Cypress** is running as a [Node.js](https://nodejs.org/) application. The file **`cypress.config.js`** is used to configure settings and preferences for running the System Tests in your environment.
On the left, **Cypress** is running as a [Node.js](https://nodejs.org/) application. The file **`cypress.config.mjs`** is used to configure settings and preferences for running the System Tests in your environment.

In the middle, the **Cypress Test Runner** controls a **Browser** with the **Joomla** application running HTML, CSS, and JavaScript. Also running in the browser context are the **Database Commands**, the **API commands** and the npm packages **[joomala-cypress](https://github.com/joomla-projects/joomla-cypress/)** and
**[smtp-tester](https://www.npmjs.com/package/smtp-tester)**.
Expand Down Expand Up @@ -52,10 +52,10 @@ npm ci
```
3. Create the Cypress configuration file from the distribution template.
```
cp cypress.config.dist.js cypress.config.js
cp cypress.config.dist.mjs cypress.config.mjs
```
4. Adjust the parameter `baseUrl` in the `cypress.config.js` file, it should point to the Joomla base URL.
5. Adapt the env variables in the file `cypress.config.js`, they should point to the site, user data and database environment. Ensure that the `smtp_port` is not in use on your system.
4. Adjust the parameter `baseUrl` in the `cypress.config.mjs` file, it should point to the Joomla base URL.
5. Adapt the env variables in the file `cypress.config.mjs`, they should point to the site, user data and database environment. Ensure that the `smtp_port` is not in use on your system.


## Running System Tests
Expand Down Expand Up @@ -107,7 +107,7 @@ which are numbered and described below.
interacting with the file system.
5. Joomla on the Web Server interacts with the **Database** as it normally would, without running any tests.
6. System Tests has Cypress custom **Database Commands** (described later) to interact with the database.
7. The file `cypress.config.js` is read by **Cypress** and used to configure settings and preferences for running the System Tests in your environment.
7. The file `cypress.config.mjs` is read by **Cypress** and used to configure settings and preferences for running the System Tests in your environment.
8. The Joomla installation is initiated by the test spec [Installation.cy.js](integration/install/Installation.cy.js),
which is the first test executed in the overall test suite.
This test spec deletes the Joomla configuration file, and since the `configuration.php` file no longer exists,
Expand All @@ -127,7 +127,7 @@ The used npm package "Helpers for using Cypress with Joomla for testing" **[joom
> see [tests/System/support/commands.js](/tests/System/support/commands.js).
The **[smtp-tester](https://www.npmjs.com/package/smtp-tester)** npm package creates an SMTP server that listens
on the `smtp_port` specified in `cypress.config.js` during test runtime.
on the `smtp_port` specified in `cypress.config.mjs` during test runtime.
This server accepts connections, receives emails, and provides the capability to check the received emails during the test.

> [!IMPORTANT]
Expand Down Expand Up @@ -301,14 +301,14 @@ sudo CYPRESS_CACHE_FOLDER=$HOME/.cache/Cypress npx cypress run

If the used SMTP server port is already in use you will see an error like:
```
Your configFile threw an error from: cypress.config.js
Your configFile threw an error from: cypress.config.mjs
We stopped running your tests because your config file crashed.
Error: listen EADDRINUSE: address already in use :::1025
```

:point_right: Configure a different, unused port in the `cypress.config.js` file as `smtp_port`.
:point_right: Configure a different, unused port in the `cypress.config.mjs` file as `smtp_port`.


### Timeout Error on Slow Machines
Expand All @@ -319,7 +319,7 @@ If you encounter the following error while running the System Tests on slow mach
AssertionError: Timed out retrying after 4000ms: Expected to find element
```

:point_right: You can increase the default 4 second waiting time in the cypress.config.js file:
:point_right: You can increase the default 4 second waiting time in the cypress.config.mjs file:

```JavaScript
module.exports = {
Expand Down
Binary file modified tests/System/images/system-tests-interactions.odg
Binary file not shown.
Binary file modified tests/System/images/system-tests-interactions.pdf
Binary file not shown.
Loading

0 comments on commit f4f322d

Please sign in to comment.