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
[Cypress][docu] tests/System/README.md revised in 5 points (joomla#44660)
* tests/System/README.md revised in 5 points
* Added paragraph 'Config commands' with missing description for `config_setParameter`
* Added web server configuration with `rewrite_module` and directory's `AllowOverride` (needed after adding SEF tests)
* Added JBT as sample for Docker integration
* Unified heading to have only first word and proper nouns to start with upercase letter
* Using 'Joomla System Tests' as proper noun and replaced different writings (e.g. CMS System Tests)
* Linked to the official Joomla Docker containers
* Revert to title case in capitalisation

19
19
20
-
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.
20
+
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 Joomla System Tests in your environment.
21
21
22
22
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
@@ -26,19 +26,32 @@ The **Joomla** CMS server software is depicted on the right. It runs with PHP on
26
26
several key components: the public **User-Frontend**, the administrator **Admin-Backend**, the **API**, and the **Web-Installer**. These components and their interactions will be detailed later in the document.
27
27
The file **`configuration.php`** is used to configure settings for Joomla server software.
28
28
29
-
Joomla uses a **Database**, and the System Tests do as well.
29
+
Joomla uses a **Database**, and the Joomla System Tests do as well.
30
30
31
31
32
32
## Installation
33
33
34
-
Joomla System Tests work on different operating systems such as macOS, desktop Linux distributions like Ubuntu,
35
-
and Windows (using WSL 2 or a framework like Laragon). They also work well with Docker containers.
36
-
You will need a Web Server and a database like MariaDB running.
34
+
Joomla System Tests are compatible with various operating systems, including macOS, desktop Linux distributions like Ubuntu, and Windows (using WSL 2 or frameworks like Laragon).
35
+
They are fully compatible with the official [Joomla Docker containers](https://hub.docker.com/_/joomla).
36
+
37
+
To run these tests, you will need a web server (e.g. Apache) and a database (e.g. MariaDB).
38
+
Ensure the web server is configured to load the `rewrite_module` and allow directory overrides. For example, in Apache:
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.
59
72
60
73
61
-
## Running System Tests
74
+
## Running Joomla System Tests
62
75
63
76
After installation, you can start the Joomla System Tests with headless Cypress. The test suite starts with Joomla Web-Installer as the first test step.
64
77
```
@@ -86,34 +99,35 @@ npx cypress run --spec 'tests/System/integration/{administrator,site,api,plugins
86
99
> npm run cypress:open
87
100
> ```
88
101
89
-
If you are running System Tests, you will see `console.log()` outputs from Cypress Tasks in the Node.js environment. If you would like to see `console.log()` output from the browser in headless mode as well, you can use the Electron web browser and set the following environment variable:
102
+
If you are running Joomla System Tests, you will see `console.log()` outputs from Cypress Tasks in the Node.js environment. If you would like to see `console.log()` output from the browser in headless mode as well, you can use the Electron web browser and set the following environment variable:
90
103
```
91
104
export ELECTRON_ENABLE_LOGGING=1
92
105
npm run cypress:run --browser electron
93
106
```
94
107
95
108
96
-
## Software Architecture – More Detailed
109
+
## Software Architecture Details
97
110
98
-
Since many interactions in System Tests are involved, the following image illustrates 10 simplified interactions,
111
+
Since Joomla System Tests involve many interactions, the following image illustrates 10 simplified interactions,
99
112
which are numbered and described below.
100
113
101
-

114
+

102
115
103
116
1. **Cypress** starts the **Browser** and runs **Cypress Test Runner** to control Joomla running in the browser and access the DOM.
104
117
2. **Joomla** software running in the browser sends requests to the **Web Server** and receives responses just as it would during normal use, even without tests.
105
118
3. The Cypress custom **API commands** (described later) interact with the Joomla **API** on the Web Server.
106
119
4. Cypress **Tasks** are used to execute code within the Cypress Node.js context. These tasks are triggered by the Cypress Test Runner, which runs in the browser, and are typically used for operations like
107
120
interacting with the file system.
108
121
5. Joomla on the Web Server interacts with the **Database** as it normally would, without running any tests.
109
-
6. System Tests has Cypress custom **Database Commands** (described later) to interact with the database.
110
-
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.
122
+
6. Joomla System Tests has Cypress custom **Database Commands** (described later) to interact with the database.
123
+
7. The file `cypress.config.mjs` is read by **Cypress** and used to configure settings and
124
+
preferences for running the Joomla System Tests in your environment.
111
125
8. The Joomla installation is initiated by the test spec [Installation.cy.js](integration/install/Installation.cy.js),
112
126
which is the first test executed in the overall test suite.
113
127
This test spec deletes the Joomla configuration file, and since the `configuration.php` file no longer exists,
114
128
the following Joomla Web-Installer call starts the installation process, including database creation.
115
129
To ensure that this initial test spec runs correctly, the `installation` folder must not be deleted,
116
-
allowing the System Tests to be executed multiple times.
130
+
allowing the Joomla System Tests to be executed multiple times.
117
131
After the Joomla Web-Installer completes, [Installation.cy.js](integration/install/Installation.cy.js)
118
132
modifies some parameters in the `configuration.php` file, such as SMTP settings or the API `$secret`.
119
133
9. Joomla Web-Installer creates `configuration.php` file. For security reasons, the file mask is set to read-only (444).
@@ -178,7 +192,7 @@ The following code in a test executes the writing file task with parameters:
178
192
### Commands
179
193
180
194
We are using [custom commands](https://docs.cypress.io/api/cypress-api/custom-commands) to enhance Cypress
181
-
with reusable code snippets for the System Tests.
195
+
with reusable code snippets for the Joomla System Tests.
182
196
These commands can be used to create objects in the database or to call the API.
183
197
Since Cypress doesn't support namespaces for commands, we prefix them in the function name.
184
198
Therefore, a Database Command always starts with `db_`, and an API command with `api_`.
@@ -221,7 +235,7 @@ The following commands are available and are served by the file [tests/System/su
221
235
-**db_updateExtensionParameter** – Sets the parameter for the given extension
222
236
223
237
224
-
#### API commands
238
+
#### API Commands
225
239
226
240
The API commands make API requests to the CMS API endpoint `/api/index.php/v1`.
227
241
They are asynchronous and must be chained like:
@@ -240,6 +254,23 @@ The following commands are available and are served by the file
240
254
-**api_responseContains** – Checks if the given attribute in the response contains the specified value
241
255
242
256
257
+
#### Config Commands
258
+
259
+
There is a single config command provided by the file
0 commit comments