This project contains automated tests for the Pipedrive application using Cypress.
- Node.js (v18 or higher)
- npm (comes with Node.js)
- A Pipedrive account with valid credentials
- Git
- Docker (for Docker-based testing)
├── cypress/
│ ├── e2e/ # Test files
│ │ └── Pipedrive/
│ │ └── Web/ # Web application tests
│ │ ├── pages/ # Page Object Models
│ │ │ ├── ContactPage.js
│ │ │ └── LoginPage.js
│ │ └── tests/ # Test Specifications
│ │ ├── 01_login_test.cy.js
│ │ └── 02_contact_test.cy.js
│ ├── fixtures/ # Test data
│ ├── reports/ # Test reports
│ │ └── mochawesome/ # Mochawesome reports
│ ├── screenshots/ # Test failure screenshots
│ └── videos/ # Test execution recordings
├── .github/
│ └── workflows/ # GitHub Actions workflows
│ └── github-workflow.yml # GitHub Actions workflow for Docker-based testing
├── node_modules/ # Project dependencies
├── cypress.config.js # Cypress configuration
├── cypress.env.json # Cypress environment variables
├── Dockerfile # Docker configuration
├── docker-compose.yml # Docker Compose configuration
├── .dockerignore # Docker ignore file
├── Jenkinsfile # Jenkins pipeline configuration
├── reporter-config.json # Mochawesome reporter configuration
├── run-cypress-docker.sh # Docker helper script
├── run-tests.sh # Local test execution helper
├── test-workflow.sh # CI/CD test workflow helper
├── package.json # Project metadata and scripts
├── package-lock.json # Dependency lock file
└── README.md # Project documentation
- Clone the Repository:
git clone <repository-url>
cd Cypress-Automation- Install Dependencies:
# Install all dependencies
npm ci
# Verify Cypress installation
npx cypress verify- Environment Setup:
Create a
cypress.env.jsonfile in the root directory:
{
"email": "your-pipedrive-email",
"password": "your-pipedrive-password",
"BASE_URL": "https://app.pipedrive.com"
}- Verify Installation:
# Open Cypress Test Runner
npx cypress open
# Run a test in headless mode
npx cypress run- Docker Desktop installed and running
- Using npm Scripts:
# Run all tests in Chrome
npm run docker:test:chrome
# Run specific test file
npm run docker:test:login
# Run tests in all browsers
npm run docker:test:all- Using Docker Directly:
# Run tests using the official Cypress Docker image
docker run --rm \
-v "${PWD}:/e2e" \
-w /e2e \
-e CYPRESS_BASE_URL=$CYPRESS_BASE_URL \
-e CYPRESS_EMAIL=$CYPRESS_EMAIL \
-e CYPRESS_PASSWORD=$CYPRESS_PASSWORD \
cypress/included:12.17.4 \
--browser chrome \
--reporter mochawesome \
--reporter-options reportDir=cypress/reports/mochawesome,overwrite=false,html=false,json=true- Viewing Test Results: Test results, screenshots, and videos will be available in your local project directory as they are mounted as volumes.
The project uses GitHub Actions for CI/CD with Docker support. The workflow includes:
- Node.js setup with caching
- Dependency installation
- Test execution in Docker
- Report generation
- Artifact upload
The GitHub workflow (.github/workflows/github-workflow.yml) performs the following steps:
-
Checkout Code:
- Clones the repository
- Sets up the working directory
-
Node.js Setup:
- Installs Node.js v18
- Configures npm caching for faster builds
- Installs project dependencies
-
Directory Setup:
- Creates necessary directories for reports
- Sets up permissions for test artifacts
- Prepares the environment for test execution
-
Test Execution:
- Runs Cypress tests in Docker container
- Uses the official Cypress Docker image
- Configures Mochawesome reporter
- Handles test failures gracefully
-
Report Generation:
- Merges test reports from multiple runs
- Generates HTML reports using Mochawesome
- Creates a dummy report if no tests are executed
- Verifies report generation success
-
Artifact Management:
- Uploads test reports as artifacts
- Archives screenshots on test failures
- Saves test execution videos
- Sets retention period for artifacts
The workflow runs automatically on:
- Push to main/master branches
- Pull requests to main/master branches
- Manual workflow dispatch
- Scheduled runs (if configured)
Add these secrets to your GitHub repository:
CYPRESS_BASE_URL: Pipedrive application URLCYPRESS_EMAIL: Pipedrive login emailCYPRESS_PASSWORD: Pipedrive login password
The workflow generates and uploads the following artifacts:
- Mochawesome HTML reports
- Test failure screenshots
- Test execution videos
- Debug logs and error reports
The project includes Jenkins pipeline configuration (Jenkinsfile) with the following features:
- Docker-based test execution
- Automated test execution
- Report generation
- Artifact archiving
- Failure notifications
-
Prerequisites:
- Jenkins server with Docker plugin installed
- Docker installed on Jenkins agent
- Node.js installed on Jenkins agent
-
Configuration:
- Create a new Pipeline job
- Point to the repository containing this project
- Set the pipeline script to use the Jenkinsfile
- Configure environment variables:
CYPRESS_EMAIL: Pipedrive login emailCYPRESS_PASSWORD: Pipedrive login passwordCYPRESS_BASE_URL: Pipedrive application URL
-
Pipeline Stages:
- Checkout: Get the code from the repository
- Build Docker Image: Build the Docker image for testing
- Create Reports Directory: Set up directories for reports
- Run Cypress Tests: Execute tests in Docker
- Generate Reports: Create test reports
- Post Actions: Archive artifacts and handle success/failure
The project includes several helper scripts:
run-cypress-docker.sh: Docker-based test executionrun-tests.sh: Local test execution helpertest-workflow.sh: CI/CD workflow helper
# Run all tests in Chrome
npm run test:chrome
# Run specific test file
npx cypress run --spec "cypress/e2e/Pipedrive/Web/tests/01_login_test.cy.js"
# Open Cypress Test Runner
npx cypress openTests run automatically on:
- Push to main/master/test branches
- Pull requests to main/master/test branches
- Manual workflow dispatch
- Jenkins pipeline execution
# Generate reports
npm run generate:report
# Merge multiple reports
npm run merge:reports
# Generate all reports
npm run generate:all-reports- HTML reports:
cypress/reports/mochawesome/ - Screenshots:
cypress/screenshots/ - Videos:
cypress/videos/
-
Test Organization:
- Tests are organized by feature
- Page Object Model pattern for better maintenance
- Each test file focuses on a specific feature
-
Data Management:
- Use fixtures for test data
- Environment variables for sensitive data
- Separate test data from test logic
-
Reporting:
- Mochawesome reports for detailed test results
- Screenshots on test failures
- Video recordings for debugging
-
CI/CD Integration:
- Automated test execution
- Report generation and archiving
- Failure notifications
-
Docker Issues:
- Ensure Docker is running
- Check volume mounting permissions
- Verify environment variables
-
Test Failures:
- Check test reports
- Review screenshots
- Verify selectors
- Check application state
-
CI/CD Issues:
- Verify GitHub secrets
- Check workflow logs
- Ensure proper permissions
- Check Jenkins configuration
- Cypress Debug Logs:
DEBUG=cypress:* - Network Logs: Chrome DevTools
- Test Reports: Mochawesome
- Screenshots:
cypress/screenshots
- Update dependencies:
npm update- Clean reports:
npm run clean:reports- Verify tests:
npx cypress verify- Follow Git flow branching model
- Use meaningful commit messages
- Keep feature branches updated
- Regular merges to main branch
For issues or questions:
- Check troubleshooting guide
- Review test reports
- Check CI/CD logs
- Create GitHub issue
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests locally
- Submit a pull request
This project is licensed under the ISC License.