© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2021
S. ShuklaPractical WebDriverIOhttps://doi.org/10.1007/978-1-4842-6661-8_10

10. Assertions

Shashank Shukla1  
(1)
Mandla, India
 

In automation, validations in test scripts are also called assertions . Some WebdriverIO assertions were covered in Chapter 4 (i.e., element APIs). Node.js has a built-in assertion library that is called with const assert = require('assert'). No installation is required. However, you can implement more powerful assertions with the user-friendly Chai Assertion Library in your framework. Install Chai using npm install chai -save--dev at a terminal.

Once installed, import the Chai Assertion Library using statement const assert = require('chai').assert ...

Get Practical WebDriverIO: Learn to Automate Effectively Using WebDriverIO APIs now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.