Categories: AngularJS, Software Development

Screenshots with Selenium WebDriver

Here we learn to use Protractor with Selenium WebDriver providing the functionality to take screenshots.

Update: Andrew Batz has kindly put together an NPM-installable package with the code in this article. Click here to check it out or download it using npm install screenshot-protractor

As I work with SPAs (Single Page Applications) it becomes more obvious that some parts of a web app can only be inspected visually. As part of an end2end test or user acceptance testing, manually checking screenshots is still faster than manual testing. Screenshots at different steps of a process can be put together into a presentation or PDF and presented to clients or other stakeholders to show them that not only is the backend code working, but the frontend looks and feels right.

So here’s a snippet for taking a screenshot with Protractor, which is designed for AngularJS, and an end2end test that uses Jasmine and Protractor:

https://gist.github.com/rudolfolah/60b03873977551bcf68b

When to take screenshots during an end2end test:

  • to inspect the layout/styling
  • to inspect how the site looks across multiple browsers
  • to verify with client/stakeholders that we’re building the right thing
  • to share with other developers when debugging an issue
Categories: Linux, Software Development

PHPUnit Essentials Book Review

PHPUnit Essentials would have come in handy while on a recent contracting gig and on all the other PHP projects I’ve worked on. The book is published by Packt Publishing, the last book I bought from them was on AngularJS and it was a great guide whereas as the O’Reilly book on AngularJS was outdated.

Overall the book was a good read and it’s worth getting as both a guide and a reference.
Continue reading “PHPUnit Essentials Book Review”