Cypress Tests on CI Pipeline
MD
R
MarkdownGuide for running Cypress automated tests in continuous integration environments. Covers setup, configuration, and best practices for reliable test execution in CI/CD pipelines.
- Dockerfile
# Build
# FROM mhart/alpine-node:10 AS builder
FROM cypress/browsers:node12.18.3-chrome83-ff77 AS builder
WORKDIR /project
COPY package.json package.json
COPY package-lock.json package-lock.json
COPY check-node-version.js check-node-version.js
RUN npm config set unsafe-perm true
RUN npm ci
COPY . .
# RUN npm run cypress:run
RUN node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build --prod=true
# Server
FROM nginx:1.15.4-alpine
WORKDIR /var/www
COPY --from=builder /project/dist/codingcloud/ .
RUN ls -laht
ENV NODE_ENV=production
ENV PORT=3700
COPY nginx/nginx.conf /etc/nginx/nginx.conf
EXPOSE $PORT
- Package.json
"cypress:open": "npx cypress open",
"cypress:run": "concurrently \"ng serve --configuration=cypress\" \"wait-on http-get://localhost:4200 && npx cypress run\" --kill-others --success first",
- Angular enviromment (environment.cypress.ts)
export const environment = {
production: false,
tenant: 'Development',
apiUrl: 'staging...',
hmr: false,
};
Created on 8/20/2021