Testing Strategy
Relevant source files
The following files were used as context for generating this wiki page:
- README.md
- apps/gauzy-e2e/src/integration/ProposalsTest.ts
- apps/gauzy-e2e/src/integration/TimesheetsTest.ts
- apps/gauzy-e2e/src/integration/AddTasksTest.ts
- apps/gauzy-e2e/src/support/step_definitions/ManageInterviewsCriterionsTest/ManageInterviewsCriterionsTest.ts
- apps/gauzy-e2e/src/support/step_definitions/ReportsTest/ReportsTest.ts
- apps/gauzy-e2e/src/integration/SettingsFeaturesTest.ts
- packages/mcp-server/README.md
- apps/mcp/README.md
The Ever Gauzy platform employs a multi-layered testing strategy to ensure code quality, feature correctness, and system stability. The strategy is centered around a comprehensive End-to-End (E2E) testing suite built with Cypress, complemented by unit and integration tests managed within an Nx monorepo. This approach allows for isolated testing of individual packages as well as full-application testing that simulates real user workflows.
Testing is integrated into the development lifecycle, with commands available to run tests for specific applications or packages. The use of Docker Compose for environment setup ensures that tests are run in a consistent and reproducible manner, closely mirroring demo and production environments.
Sources: README.md, packages/mcp-server/README.md
End-to-End (E2E) Testing
The primary method for ensuring application quality is through E2E tests located in the apps/gauzy-e2e directory. These tests are designed to validate complete user flows and feature interactions from the user interface down to the backend.
Sources: apps/gauzy-e2e/src/integration/ProposalsTest.ts, apps/gauzy-e2e/src/integration/TimesheetsTest.ts
Framework and Tools
The E2E testing suite is built upon a foundation of modern and robust JavaScript tools.
| Tool | Purpose |
|---|---|
| Cypress | The core E2E testing framework for browser automation and assertions. |
| TypeScript | Provides static typing for test files, improving code quality and maintainability. |
| Cypress Cucumber Preprocessor | Enables writing tests in a Behavior-Driven Development (BDD) style using Gherkin syntax (Given, When, Then). |
| Faker.js | Generates realistic and dynamic test data (e.g., names, emails, URLs) for each test run. |
Sources: apps/gauzy-e2e/src/integration/ProposalsTest.ts:3, apps/gauzy-e2e/src/support/step_definitions/ManageInterviewsCriterionsTest/ManageInterviewsCriterionsTest.ts:10
E2E Test Architecture
The E2E test suite is highly structured, following best practices like the Page Object Model (POM) and Behavior-Driven Development (BDD) to create tests that are readable, maintainable, and scalable.
The following diagram illustrates the directory structure and component relationships within the apps/gauzy-e2e application.
This diagram shows how E2E test suites use BDD steps, which are implemented using Page Objects and Custom Commands to interact with the UI.
Sources: apps/gauzy-e2e/src/integration/AddTasksTest.ts, apps/gauzy-e2e/src/support/step_definitions/ManageInterviewsCriterionsTest/ManageInterviewsCriterionsTest.ts
Key Components
- Integration (
src/integration): Contains the main test files, organized by feature (e.g.,ProposalsTest.ts,TimesheetsTest.ts). These files define the test suites usingdescribe()and individual test cases usingit(). - Step Definitions (
src/support/step_definitions): Implements the logic for BDD steps defined in feature files. These files bridge the gap between human-readable Gherkin syntax and the underlying test automation code. - Page Object Model (
src/support/Base/pages): Encapsulates the UI elements and interaction logic for each page or component of the application. This separates test logic from UI implementation details, making tests less brittle. - Page Data (
src/support/Base/pagedata): Stores static test data, such as default values or configuration, keeping it separate from the test logic. - Custom Commands (
src/support/commands.ts): Defines reusable functions for common sequences of actions, such as logging in (CustomCommands.login) or creating prerequisite data (CustomCommands.addProject).
Sources: apps/gauzy-e2e/src/integration/ProposalsTest.ts, apps/gauzy-e2e/src/support/step_definitions/ReportsTest/ReportsTest.ts
E2E Test Execution Flow
A typical E2E test follows a standard flow: setup, execution, and verification. Many tests cover the full CRUD (Create, Read, Update, Delete) lifecycle for a given feature.
The sequence diagram below shows the interactions during the "Add new proposal" test case.
This diagram details the sequence of operations for an E2E test, from logging in to creating and verifying a new proposal.
Sources: apps/gauzy-e2e/src/integration/ProposalsTest.ts:33-55
Unit and Integration Testing
While E2E tests cover the application as a whole, the repository is also set up for unit and integration testing at the package level. This is managed by the Nx build system. Packages like mcp-server have their own dedicated test suites.
The primary tool for this level of testing appears to be Jest, as suggested by the presence of a jest.config.ts file in the project root.
Commands to run these tests are standardized through Nx:
yarn nx test <project-name>: Runs tests for a specific project (e.g.,mcp-server).yarn seed: Can be used to populate the database with initial data before running tests.yarn seed:all: Generates a large amount of fake data for more extensive testing scenarios.
Sources: README.md, packages/mcp-server/README.md, apps/mcp/README.md
MCP Server Testing
The mcp-server and mcp applications have a specific testing focus:
- Unit Tests: Developers are encouraged to write unit tests for new functionality.
- Test Command: The
mcpapp includes a--testcommand-line flag to validate the connection to the Gauzy API and then exit, serving as a quick smoke test. - Tool Suite: The
mcp-serveritself contains a "Testing & Diagnostics" tool suite for checking API connectivity and server capabilities.
Sources: packages/mcp-server/README.md, apps/mcp/README.md
Test Environments
The project utilizes Docker and various deployment environments to facilitate testing across different stages.
- Local Development: Developers can run the API and UI locally using
yarn start. A local database (SQLite by default) can be seeded with test data. - Docker Compose:
docker-composeis used to spin up environments that include the application and its dependencies (PostgreSQL, Redis, etc.). This is ideal for running E2E tests in a clean, controlled environment. - Staging Environment: A
stagebranch is deployed to a staging server (stage.gauzy.co), which is used to test releases before they go to production. - Demo Environment: The
developbranch is deployed to a demo server (demo.gauzy.co), which is reset daily. This provides a public-facing environment for manual testing and demonstration.
Sources: README.md
Summary
The testing strategy for Ever Gauzy is comprehensive, leveraging a powerful E2E suite with Cypress for validating user-facing features and workflows. This is supported by a BDD approach and the Page Object Model for maintainability. At a lower level, unit and integration tests are managed by Nx, ensuring individual packages are reliable. The entire strategy is underpinned by consistent, containerized environments provided by Docker, and integrated into a CI/CD pipeline with distinct demo and staging environments for thorough validation before production releases.