Instructor: sometimes, it can be helpful to save out screenshots when tests fail. This makes it easy to see what the test was working with at the time the error happened. We can test this out inside of our NAV loads correctly test. We'll add this if check, where we'll check the length to equal three.
We screenshot the page. Then, we'll update our test to be three. Perfect. Now, this test should fail, because we still have four LIs in our app.
Now, it will save a screenshot to our directory called, "Screenshot.png." If we run our test script in our terminal, we can watch our test fail, as well as watch for our screenshot to be added to our directory here.
As you can see, the test failed because it had four LIs. We can configure our screenshot method to take on some other configurations. Some of them are full page as a bool, quality as a number 0through 100, and clip as an object. Full page, when it's true, it takes a screenshot of the full scrollable page. Its default is false. Quality is the quality of the image 0to 100.
Then, clip takes an object which specifies a clipping region of a page to screenshot. Now, we can also make a PDF of the page by doing page.pdf. Then, it itself can have some configurations like scale, format, and margin. Now, scale is a number, and it refers to the web page rendering.
The default is one. Format is referring to paper format. If it's set, it takes priority over any width or height options that is passed to it. The default is letter. Margin, which is referring to the paper margins...