From the course: Advanced Selenium: Automation Frameworks
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Testing with wdio: Assertions - Selenium Tutorial
From the course: Advanced Selenium: Automation Frameworks
Testing with wdio: Assertions
- [Instructor] Now that the form is all filled out, let's write some assertions to ensure that each field has the right value. We've imported the Chai expectations library. We'll be using the should expectation style. In your own projects you can choose between should, expect, and assert expectation styles. You can learn more about it on the Chai website, chaijs.com. In the Atom editor, let's go ahead and make some room at the bottom of the test case, then copy the selector for the name field. Now we'll go ahead and call the getValue method, invoking .should handles Chai expectations. When we add Chai to the configuration, the should object is available as a property on pretty much every object. We'll invoke the equal method off of the should object. And there we go. We're keeping it fairly simple here for now, but Chai supports a very fluent language of expectations. You can learn more about them on the Chai website…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.