From the course: Angular: Testing and Debugging

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Solution: Testing filter input

Solution: Testing filter input - Angular Tutorial

From the course: Angular: Testing and Debugging

Start my 1-month free trial

Solution: Testing filter input

(upbeat music) - [Narrator] Okay, here's my solution for the challenge. Keep in mind that my solution and your solution may be different and that's okay. I added a new method in the page object called get input. It looks for input elements using the by dot CSS method, and returns the element locator using the element function. In the spec file, I made a new describe block called filter input. I nested this block inside our existing describe block which is great for organizing the test reports. I made two new properties, one called input of type element finder, and the other called items of type element array finder. In the callback for the before each block, I assign the return value of page dot get input to the input property. And I assigned the value of page dot get list items to the items property. This next line is where the magic happens. Right here. I call input dot send keys and pass in the string davis. The send keys method is one of several ways you can interact with Dom…

Contents