Skip to content

Functional automation testing solution using Cypress for Foncia service

Notifications You must be signed in to change notification settings

YIEHOO/Foncia-Cypress-Test

Repository files navigation

Foncia Cypress Test

Functional automation test solution using Cypress for Foncia service

Foncia Cypress Test

Features

  • A front end testing tool built for the modern web
  • A strongly typed programming language that builds on JavaScript, giving better tooling at any scale
  • A tool that supports Behaviour-Driven Development(BDD)
  • POM (Page Object Model) a design pattern, popularly used in test automation that creates Object Repository for web UI elements
  • A custom reporter for use with the Javascript testing framework
  • DDT (Data Driven Testing) a software testing method in which test data is stored in table or spreadsheet format
  • Package manager for code
  • CI/CD frequently deliver apps to customers by introducing automation into the stages of app development

Tech

Foncia Cypress Test uses a number of open source projects to work properly:

  • Cypress - JavaScript End to End Testing Framework
  • Typescript - TypeScript is JavaScript with syntax for types
  • Mochawesome - Custom reporter for use with Javascript
  • Cypress-xpath - Adds XPath command to Cypress.io test runner
  • Cypress-Cucumber-Preprocessor - Provide developers experience and behavior similar to that of Cucumber, to Cypress
  • Webpack-Preprocessor - Cypress preprocessor for bundling JavaScript via webpack
  • YARN - A package manager for code
  • papaparse - The powerful, in-browser CSV parser for big boys and girls

Install and run tests locally

Foncia Cypress Test requires Node.js v16.10+ to run.

Enable YARN to start using the package manager

corepack enable

Install the dependencies and devDependencies.

cd FONCIA-CYPRESS-TEST
yarn install

Run the tests

To run the test on production :

yarn test --env ENV='production'

Additional commands not needed to be run but might be help

To merge mochawesome reports

yarn merge-reports

To generate an HTML report

yarn generate-htmlreport

To convert CSV file to JSON file

yarn convertCSVtoJSON

Install and run tests using Docker

Docker must be installed on the targetted machine to be able to build an image

Create an image of the Cypress project

cd FONCIA-CYPRESS-TEST
docker build -t my-cypress-image:1.0.0 .

Run the tests

To run the test on production :

docker run -i -v $PWD:/my-cypress-project -t my-cypress-image:1.0.0 --spec cypress/e2e/*.feature --env ENV='production'

CI/CD Integration

The Foncia Cypress Test provides a Jenkinsfile that will help setup up a Jenkins Pipeline with the least effort possible.

How to do it?

  1. Create a new Pipeline on Jenkins
  2. Go to 'Advanced Project Options'
  3. Specify 'Pipeline Script from SCM', 'Git', Repository URL, Credentials, Branch
  4. Set 'Script Path' to 'Jenkinsfile'

JenkinsPipelineConfig

Plugins requiered

AnsiColor
HTML Publisher Plugin
NodeJS Plugin

Cypress Dashboard

To access Cypress Dashboard please click on me to see the details

License

MIT

Free Software, Hell Yeah!