- add url and page as env variables to choice where to test and update the others - To pass a variable to a job's service, they have to be declared in the "variables" global -> doesn't work (see: [#37]) - use of the deployed image to do E2E test instead of services of gitlab
44 lines
1.3 KiB
Markdown
44 lines
1.3 KiB
Markdown
# End-to-End and Unit Testing Documentation for Home Monitor
|
||
|
||
## Test Description
|
||
|
||
The Home Monitor project uses Cypress to automate both End-to-End (E2E) and unit tests. These tests ensure that the main features of the application work correctly, both from the user’s and the developer’s perspectives.
|
||
|
||
### Types of Tests
|
||
|
||
- **End-to-End (E2E) Tests**: Simulate real user behavior on the web interface. They check critical user flows, data display, error handling, and the responsiveness of the application.
|
||
- **Unit Tests**: Verify the correct functioning of JavaScript/TypeScript components and functions in isolation.
|
||
|
||
### Test Structure
|
||
|
||
- E2E tests are located in `web-app/cypress/e2e/`
|
||
- Unit tests are located in `web-app/cypress/unit/`
|
||
- Custom commands and global setup are in `web-app/cypress/support/`
|
||
- Cypress configuration is in `web-app/cypress.config.ts`
|
||
|
||
### Example Scenarios Covered
|
||
|
||
- Application loading and display of main sections
|
||
- Control panel functionality (buttons, filters)
|
||
- User, room, and device selection
|
||
- Display and update of measurement charts
|
||
- Handling of error or empty data states
|
||
- Responsive layout for mobile and desktop
|
||
|
||
## How to Run the Tests
|
||
|
||
### Prerequisites
|
||
|
||
- Node.js (v14+)
|
||
- npm or yarn
|
||
- Chrome browser
|
||
|
||
### Install Dependencies
|
||
|
||
```bash
|
||
cd project-softweng/web-app
|
||
npm install
|
||
```
|
||
|
||
### Run unit Tests
|