Skip to content

vivekbwaj/FrontendAutomationCypress

Repository files navigation

Frontend Automation using

Installation:

  • Install nodejs 12.16.3 lts Link
  • Install Vscode link

Folder Structure

Project Setup:

  • git clone repo
  • npm install

Write Code:

  • Add /// <reference types="Cypress" /> and /// <reference types="../support" /> reference on the top, to get typed reference.
  • Add new spec file with the format TC00*_SampleTest*_spec.js
  • Write functions in PageObjects as E.g login
  • Write helper methods in support/actions.js
  • Write custom commands in support/commands.js [read more] [https://docs.cypress.io/api/cypress-api/custom-commands.html#Syntax]
  • Add type declaration for custom commands in support/index.d.ts
  • Add test data in data/testdata.js
  • Keep mock json files in fixtures/

Configure/update/set Test Environments:

  • Open config and update test environment urls,user,pass and update it to config.js
  • Test environment json files names are case sensitive
  • To run test on specific environment update configFile=uat or configFile=prod

Test:

  • npm run cy:chrome run tests in chrome browser
  • npm run cypress:open for test development and run(Test Watcher is set to false)
  • npm run cy:test run all tests in headless
  • npx cypress run --env configFile=uat --headed --spec 'cypress/integration/TC001_PersonalDemoAccounts.js' To run specific test in chrome

Generate Report Locally:

  • npm run combine-reports to combine mocha json report
  • npm run generate-report to generate html report

Built With

About

A demo framework for UI automation using Cypress

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published