10 Advanced Protractor topics

 

This chapter covers

  • Protractor configuration files
  • Screenshot testing
  • Debugging tests

Protractor is a powerful tool, and, like any powerful tool, you can use it in more creative ways than you’ll find written in the manual. As developers working on Protractor, we’ve found that people tend to ask about certain common scenarios. Some common questions are “How do I extend Protractor’s behavior with plugins?” and “How do I create screenshots when my tests fail?” We’ve collected our best tips for working with Protractor in this chapter to help you get the most out of your end-to-end tests. You can find the examples in this chapter at http://mng.bz/83kr.

10.1 Configuration file in depth

Protractor provides many knobs and levers that change how it launches based on configuration options. In chapter 8, you used one way to run Protractor tests. You started Protractor from the command line, using a Chrome instance running on your own machine. This configuration is fine for testing during development, but what if you need to test on a different browser or a set of browsers? How can you set up tests to run in a continuous integration environment without a GUI?

10.1.1 Driver provider options

10.1.2 Desired capabilities

10.1.3 Plugins

10.1.4 Environment variables

10.2 Screenshot testing

10.2.1 Taking screenshots

10.2.2 Taking screenshots on test failure

10.2.3 Comparing screenshots

10.3 Experimental debugging features

10.3.1 WebDriver logs

10.3.2 Highlight delay

10.3.3 Blocking proxy

10.4 The control flow and debugging with Chrome DevTools

10.4.1 Asynchronous functions and promises

10.4.2 The WebDriver control flow

10.4.3 The future: async/await

10.4.4 Using Chrome DevTools

Summary

sitemap