Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Node.js Blueprints

You're reading from   Node.js Blueprints Develop stunning web and desktop applications with the definitive Node.js

Arrow left icon
Product type Paperback
Published in Jun 2014
Publisher
ISBN-13 9781783287338
Length 268 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Krasimir Stefanov Tsonev Krasimir Stefanov Tsonev
Author Profile Icon Krasimir Stefanov Tsonev
Krasimir Stefanov Tsonev
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Common Programming Paradigms FREE CHAPTER 2. Developing a Basic Site with Node.js and Express 3. Writing a Blog Application with Node.js and AngularJS 4. Developing a Chat with Socket.IO 5. Creating a To-do Application with Backbone.js 6. Using Node.js as a Command-line Tool 7. Showing a Social Feed with Ember.js 8. Developing Web App Workflow with Grunt and Gulp 9. Automate Your Testing with Node.js 10. Writing Flexible and Modular CSS 11. Writing a REST API 12. Developing Desktop Apps with Node.js Index

Testing with a headless browser


So far we learned how to test our code. We can write a module, class, or library, and if it has an API, we can test it. However, if we need to test a user interface, it gets a little bit complex. Frameworks such as Jasmine and Mocha can run the code we write but can't visit a page, click a button, or send a form; at least, not alone. For such testing, we need to use a headless browser. A headless browser is a web browser without a user interface. There is a way to control it programmatically and perform actions such as accessing DOM elements, clicking on links, and filling forms. We are able to do the same things as we use a real browser. This gives us a really nice instrument to test the user interface. In the next few pages, we will see how to use a headless browser.

Writing the subject of our test

In order to explore the possibilities of such testing, we need a simple site. Let's create two pages. The first one will contain an input field and a button. The...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime