Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel7

How to run Cypress tests on customer project

  • Easy tutorial how to

    • Download and install Cypress on your computer (3 clicks)

    • Download example tests and library (2 clicks)

    • Run your first test on you project (Change in 2 files)

...

Automation testing - Tutorial

There is an array of benefits to automation testing but it is important to understand that there might also be some limitations which we will tackle on later. For the moment though, we will look at the advantages it presents:

  • End to end automated front-end tests for PriceFx‘s solutions

  • Reduced time spent on regression testing 

  • Increased software application quality 

  • Elimination of manual tasks 

  • Increased user confidence with the solution

  • Testing approach with easy to understand automated tests for non-technical people

Cypress

Cypress is a JavaScript-based end-to-end testing framework that makes writing and maintaining tests easy. It's also great because it can be implemented into PriceFx gitLab CI/CD jobs, which makes the testing process even smoother.

With Cypress, you have the ability to write tests that everyone can understand, which is incredibly helpful for ensuring that everyone on your team is on the same page.

Image Added

You can try your Cypress tests onto your allocated partition using the following information:

Image Added

Example tests

You can download example tests on qa-training-logic REPO from gitLab (as a zip or clone repository for git).
Repository: https://gitlab.pricefx.eu/logic/qa-training-logic
Learn how to connect PriceFx gitLab repo with sourceTree: https://www.awordfromnet.com/access-gitlab-via-sourcetree-updated/
If you are not a friend with git and sourceTree, it is possible to download repo with tests directly as a zip file.

Image Added

To install Cypress the easy way, there are a few steps that you can take.

  • Go to http://cypress.io web site

  • Click on download now (you can download anywhere you want in your computer

  • Unzip your downloaded cypress version

  • Open cypress.exe (on windows or app on mac)

  • Click on select manualy and select your downloaded repo root folder

Info

Only tests in the folder “final“ should work other tests are for inspiration.

Image Added

Run Cypress via command line (optional)

  • Run command in root folder of downloaded repo

    • yarn install or npx yarn install

  • In root folder run this command:

    • node_modules\.bin\cypress run --spec "cypress/integration/final/*" --headless --browser chrome

Image Added
Info

(if it is not working, you need to run: npm install cypress).

  • Better in different folder than in downloaded repo

How to create the first test?

  1. Download Visual Studio Code or any different source code editor

  2. Open „firstTest.spec.js “ test in folder „integration“ (this is folder, where tests are placed)

  3. Now you can see empty Cypress test – your code is written in „it“ place (if you want only one test you can delete space for second test

  4. Now you can write tests

Image Added

To use the library of commands you need to know that they are place in the folder called cypress/support. The reason why you want to use this is because the test creation is faster. The code is in one place so it is easier to maintain. Moreover the test are easy to read.

Image Added
Image Added

Image Added

Tests using library of commands

Image Added

Image Added

How to run it on your test

Image Added

Image Added

Tip

PROS

Warning

CONS

  • E2E tests

  • Reduced time in regression testing

  • Elimination of manual tasks 

  • Increased user confidence with the solution

  • Ease of use for non-technical people

  • Only on UNITY

  • Front end tests could be a little fragile

  • Maintenance of the tests

  • QA person is still needed on the project

How to set up Cypress for your projects

View file
nameCypress_set_up_projects.docx

How to use data extractor tool

View file
nameQA automation - dataExtractorTool.pptx

example file for using data extractor tool

View file
nameexampleTestDataExtractorStructure.spec.js