Blog Archive

Wednesday, 1 July 2020

Cypress Testing

Background, Blur, Branch, Detail

Prerequisite for using Cypress.io

Node.js and NPM. Node.js is an open-source, cross-platform, JavaScript runtime environment that executes JavaScript code outside a web browser. NPM is a package manager for the JavaScript programming language. It is the default package manager for the JavaScript runtime environment Node.js.

Advantages of Cypress.io

Open source, free, automatic, scalable end to end testing, easier than selenium.
Tests run inside real browsers instead of a headless browser.
Visibility is considered during the test.
The scripts are readable.

Limitation

Cannot test multiple tabs at the same time.
Cannot test multiple superdomains in the same test.

Where to write your first test?

E.g. cypress > integration > first_test.js

Basic skills


  • textbox input: get the element, test span, input
  • selecting elements by: HTML tags or indexes or CSS classes or data-cy attribute (recommended)
  • aliasing element: basically referring a long element selection as a short referral
  • command results: assert on the element selected with cy.get
  • beforeEach: easy repetition in beginning of each test
  • base URL: specified in a JSON file
  • interactions: double click, check(checkbox), uncheck, select(dropdown), hover over
  • assertions: length, existence, contain, ...
  • retry: some actions will be automatically retied to fight against flakiness
















No comments:

Post a Comment

Software Testing Tools

There are various software testing tools available for QAs to increase efficiency, visibility, accuracy, and ability of their work. The tool...