Test Automation With Cypress Intermediate
Tags: Cypress.io
Optimize GUI tests with API calls
Last updated 2022-01-10 | 4.3
- How to optimise Cypress GUI tests using API calls- How to create tests that interact with the application via the operating system level
- Cross-browser testing with Cypress
What you'll learn
* Requirements
* Requirement: git* node (12.14.1)
* NPM (6.13.4)
* and Docker installed on your computer
* Requirement: a computer with at least 2 cores
* and 8GB of RAM
* Recommended: basic knowledge of HTML
* CSS selectors
* JavaScript
* Rest APIs
* command line
* and NPM (node package manager)
* Recommended: Introductory course of test automation from the Talking About Testing school
* Recommended: Basic course of test automation with Cypress from the Talking About Testing school
Description
If you came from our basic Cypress course (or not), take the next step on becoming an expert in test automation with Cypress and broaden your test automation skills.
Cypress is an open-source framework that allows writing automated tests in an easy, fast, and reliable way, all in JavaScript.
Besides that, Cypress is friendly for developers and QA engineers, and it’s not based on Selenium!
This means that, with Cypress, it’s possible to interact with web applications in ways that were not possible before, and this is exactly what you will learn during this course.
In this course, you will learn how to optimize graphical user interface (GUI) tests by making API calls.
During the course, you will learn:
How to set up the application under test (AUT) using Docker
How to set up the test automation project with Cypress
How to create basic GUI (graphical user interface) tests with Cypress
How to create intermediate GUI tests with Cypress (2 pre-conditions)
API testing with Cypress
How to create tests in an optimized way using API calls
How to create tests that interact with the AUT via the operating system level
How to run all tests
Next steps in the journey to learn Cypress
As soon as you're done with the course, you will be able to put all the learnings into practice on your web projects (of your own or related to your work.)
These are the main benefits of enrolling in this course:
An easy project set up
Quick evolution from lesson-to-lesson
GUI and API tests
Automated tests independent of each other
Fast, automated tests
Robust automated tests for reliable test results.
Join us, and excel in your career!
Who this course is for:
- Software developers, QA engineers, and software testers with basic knowledge of test automation
Course content
1 sections • 10 lectures
Setting up the local environment with Docker Preview 08:35
In this lesson you will learn:
How to start the application under test (AUT) using Docker
Some functionalities of the AUT (e.g., changing password, login, access token creation, and addition of an SSH key)
Test project setup with Cypress Preview 14:33
In this lesson you will learn:
How to clone a git project
How to initialize a node project using NPM (node package manager)
How to configure git to ignore files and directories
How to install and initialize a test automation project with Cypress
Understanding the basics of the package.json and package-lock.json files
How to configure a baseUrl with Cypress
How to use variables to keep sensitive data protected and reusable
Note: In recent versions of Cypress (8.x.x+) it may be necessary to set the property chromeWebSecurity: false in the cypress.json file since when using cy.visit() Cypress redirects from http:// localhost to https://localhost.
Basic GUI tests Preview 31:24
In this lesson you will learn:
How to create simple GUI tests for the functionalities of login, logout and project creation
How to structure tests in an organized and standardized way (describe, it, and beforeEach)
An alternative to fixtures (the faker library)
How to create custom commands
How to run a single test in both interactive and headless modes
Intermediate GUI tests Preview 10:07
In this lesson you will learn:
How to create GUI tests for the functionality of issue creation (functionality that depends on a project creation)
The problems of doing everything via GUI
API testing Preview 15:19
In this lesson you will learn:
How to create API tests for the functionalities of project and issue creation
How to organize custom commands for API calls
How to use the access token
cy.request (method, url, body)
Dependencies between API custom commands
Optimizing GUI tests using API calls Preview 05:07
In this lesson you will learn:
How to optimize GUI tests using API calls for the creation of test pre-conditions
How this approach helps on test speed and independence
Tests with many pre-conditions Preview 16:14
In this lesson you will learn:
How to create complex GUI tests for the functionalities of labeling an issue and adding a milestone to an issue
The importance of using API calls for the creation of the state in the application for tests that require many pre-conditions (project, issue, label, and milestone creation)
The importance of testing via GUI only once
Executing commands at the operating system level Preview 11:10
In this lesson you will learn:
How to create tests that interact with the application in the operating system level for the functionality of git clone
How to run assertions on the content of a file
Running all tests Preview 10:50
In this lesson you will learn:
How to run all tests in headless mode using the npm test script
How to run all tests in interactive mode
Cross-browser testing (Chrome, Chrome Canary, Firefox, Edge, Electron)
How to turn off the container
Next steps Preview 07:51
In this class will be discussed:
Practice leads to perfection, and so, I suggest you explore the AUT to practice the new learnings for other functionalities
Data clean up for each test (GUI or API?) Or, would it be worth starting a new and clean Docker image for every execution?
Tests’ parallelization
Other uses for cy.exec()
Eliminating the need for GUI login for all tests (e.g.: Mattermost)
Eliminating the need of a real server for API calls
Another sample project (GitLab Cypress)