How to Empower ‘Continuous Testing’ with Puppeteer
Send me Nitor Infotech's Monthly Blog Newsletter!
×
Software Product Engineering Services Company
  • Company
    • About
    • Leadership
    • Partnership
  • Resource Hub
  • Blog
  • Contact
Software Product Engineering Services Company
Add more content here...
Artificial intelligence Big Data Blockchain and IoT
Business Intelligence Cloud and DevOps Digital Transformation
Healthcare IT Manufacturing Mobility
Product Modernization Software Engineering Thought Leadership
Aastha Sinha Abhijeet Shah Abhishek Suranglikar
Abhishek Tanwade Ajinkya Pathak Amol Jadhav
Ankita Kulkarni Antara Datta Anup Manekar
Chandra Gosetty Chandrakiran Parkar Dr. Girish Shinde
Gaurav Mishra Gaurav Rathod Harshali Chandgadkar
Madhavi Pawar Milan Pansuriya Minal Doiphode
Mohit Agarwal Mohit Borse Nalini Vijayraghavan
Neha Garg Omkar Ingawale Omkar Kulkarni
Pranit Gangurde Prashant Kamble Priya Patole
Ravi Agrawal Robin Pandita Rohini Wwagh
Sachin Saini Sadhana Sharma Sambid Pradhan
Sanjeev Fadnavis Saurabh Pimpalkar Shardul Gurjar
Shravani Dhavale Shubham Kamble Shubham Muneshwar
Sidhant Naveria Sujay Hamane Tejbahadur Singh
Tushar Sangore Vasishtha Ingale Veena Metri
Vidisha Chirmulay
Software Engineering | 02 May 2019 |   10 min

How to Empower ‘Continuous Testing’ with Puppeteer

When it comes to automation, Selenium is the only tool in the open source space, which relies on executing JavaScript inside the browser. It has largely helped companies achieve good coverage of automation. However, in a large number of cases, there are concerns due to its flakiness, synchronization, and speed. This is now changing with rise of Node platform and JavaScript based apps. New development frameworks with inbuilt support of testing libraries (For e.g.: Jest for React, Protractor for Angular) are the order of the day. In addition, the libraries for end-to-end UI testing are surfacing, namely, PhantomJS, Puppeteer, Cypress, PollyJS. Among these, Puppeteer has opened up new possibilities with exposure to Chrome Dev Tools API. Today when it comes to automated web testing, Selenium & Puppeteer are two names that come to the fore. Although the latter is making all the noise for the right reasons. Puppeteer is a Node library used to enable Chrome browser testing. In other words, Puppeteer runs headless Chrome or Chromium instances by default, which is why they are always mentioned in tandem. Furthermore, according to Cloudtech, 75% of SMBs and 69% of organizations polled believe that by 2020, 80% of their applications (or more) will be SaaS based. With dominant use of SAAS based applications, Puppeteer-based testing holds a vital place. What exactly is Puppeteer? Puppeteer provides a simple API to control Chromium instances. Through Puppeteer, common tasks such as typing inputs, clicking buttons, testing usability of web pages, and even web scraping can be carried out easily. Puppeteer is a Chrome team official platform, and uses the Chrome Remote Debug Protocol, just as with Chrome Devtools. This library supports modern JavaScript syntax available in Google Chrome. How can you get started?

Installation

To use Puppeteer in your project, run: npm i puppeteer# or “yarn add puppeteer”

Note: When you install Puppeteer, it downloads a recent version of Chromium (~170MB Mac, ~282MB Linux, ~280MB Win), a guaranteed API fit.

Environment Variables

Puppeteer looks for certain environment variables to aid its operations. If Puppeteer doesn’t find them in the environment during the installation step, a lower cased variant of these variables will be used from the npm config.

  • HTTP_PROXY, HTTPS_PROXY, NO_PROXY – Use this to define HTTP proxy settings and to download & run Chromium
  • PUPPETEER_SKIP_CHROMIUM_DOWNLOAD – Do not download bundled Chromium during installation step
  • PUPPETEER_DOWNLOAD_HOST – Overwrite URL prefix used to download Chromium Note: this includes protocol and might even include path prefix. Defaults to https://storage.googleapis.com.
  • PUPPETEER_CHROMIUM_REVISION – Specify a certain version of Chromium you’d like Puppeteer to use.
  • PUPPETEER_EXECUTABLE_PATH – Specify an executable path to be used in puppeteer.launch. See puppeteer.launch([options]) on how the executable path is inferred. BEWARE: Puppeteer is only guaranteed to work with the bundled Chromium, use at your own risk.

Puppeteer-core

Since version 1.7.0, we publish the puppeteer-core package, a version of Puppeteer that does not download Chromium by default. npm i puppeteer-core# or “yarn add puppeteer-core” Puppeteer-core is intended to be a lightweight version of Puppeteer. You can use it either to launch an existing browser installation or to connect to a remote one. It is important to check that the version of puppeteer-core you install is compatible with the browser you intend to connect. See puppeteer vs puppeteer-core. What are the Features? While Puppeteer’s ability to launch a headless browser is one feature that has gained it some fame, that is not the only feature which makes it awesome. Puppeteer has a couple of other features that make it useful, let’s take a quick look at some of them. Easy Automation: While there are other tools that can be used for web automation, Puppeteer comes out on top. This is because it works best for one browser only – the Headless Chrome browser, therefore it carries out web automation tasks in the most efficient way possible. Puppeteer is also compatible with popular unit testing libraries such as Mocha and Jasmine. Screenshot Testing: This is a vital feature for any automated web testing task. Screenshots help keep track of the result of interactions with elements on a web page. Libraries such as Puppeteer-screenshot tester also exist in Puppeteer that allow the comparing of screenshots generated while testing. Besides generating test screenshots, Puppeteer can also help generate PDFs from tested web pages. Performance Testing: Chrome provides DevTools that allows the recording of the Performance Timeline of web pages, and Puppeteer takes advantage of this too. With Puppeteer, timeline traces of websites can be captured to examine performance issues. Due to the Puppeteer’s high-level API control over Chrome Developers Tools Protocol, it gives users the ability to control service workers and test caching of websites. Conclusion: Puppeteer is the start of a new era in Automated Testing. The success of Puppeteer with Chrome cannot be reduced only to its efficiency; the fact that it is Google-backed is also the reason why it has been accepted and recognized globally. Additionally, this software offers a high-level API to control the Chrome browser via the DevTools protocol. Leveraging Puppeteer for automation, we can develop solutions to solve problems, whether it is for quality assurance, productivity enhancements or data aggregation. The foundation of success in today’s digital world lies in successful adoption of agile principles and DevOps processes, which are in turn dependent on faster and reliable feedback from testing pipeline. At Nitor Infotech, we have helped clients achieve success in continuous testing through 70% of automation using Puppeteer. To know more about Puppeteer based testing please contact us.

Related Topics

Artificial intelligence   Big Data   Blockchain and IoT   Business Intelligence   Cloud and DevOps   Digital Transformation   Healthcare IT   Manufacturing   Mobility   Product Modernization   Software Engineering   Thought Leadership  
<< Previous Blog Next Blog >>

Anup Manekar

Associate Director

Anup is an accomplished Tech-Functional Manager with 13+ years of experience and proven expertise in software design, development and testing on various technology platforms and business domains.

   

You may also like

Beyond the Obvious: 9 Mantras for Customer Comfort

It takes two to tango they say, that is true in more ways than one, every human relationship is a story of mutuality. We start our journey with very obviously mutual relationships, I say obvious be...
Read Blog


Virtualization vs. Cloud Computing: What’s the Difference?

At a time when the word ‘virtual’ features on the first page of our dictionaries (our vocabularies), the concept of virtualization in the world of cloud computi...
Read Blog


User Acceptance Testing (UAT): Explained

Have you heard of “user acceptance testing”? We are sure your answer would be "Yes" if you are involved in any part of the SDLC (Software Development Life Cycle). “It’s All About the User”...
Read Blog


Subscribe to our monthly newsletter!

We'll keep you in the loop with everything that's trending in the tech world.

Services

    Modern Software Engineering


  • Idea to MVP
  • Quality Engineering
  • Product Engineering
  • Product Modernization
  • Reliability Engineering
  • Product Maintenance

    Enterprise Solution Engineering


  • Idea to MVP
  • Strategy & Consulting
  • Enterprise Architecture & Digital Platforms
  • Solution Engineering
  • Enterprise Cognition Engineering

    Digital Experience Engineering


  • UX Engineering
  • Content Engineering
  • Peer Product Management
  • RaaS
  • Mobility Engineering

    Technology Engineering


  • Cloud Engineering
  • Cognitive Engineering
  • Blockchain Engineering
  • Data Engineering
  • IoT Engineering

    Industries


  • Healthcare
  • Retail
  • Manufacturing
  • BFSI

    Company


  • About
  • Leadership
  • Partnership
  • Contact Us

    Resource Hub


  • White papers
  • Brochures
  • Case studies
  • Datasheet

    Explore More


  • Blog
  • Career
  • Events
  • Press Releases
  • QnA

About


With more than 15 years of experience in handling multiple technology projects across industries, Nitor Infotech has gained strong expertise in areas of technology consulting, solutioning, and product engineering. With a team of 700+ technology experts, we help leading ISVs and Enterprises with modern-day products and top-notch services through our tech-driven approach. Digitization being our key strategy, we digitally assess their operational capabilities in order to achieve our customer's end- goals.

Get in Touch


  • +1 (224) 265-7110
  • marketing@nitorinfotech.com

We are Social 24/7


© 2022 Nitor Infotech All rights reserved

  • Terms of Usage
  • Privacy Policy
  • Cookie Policy
x
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it. Accept Cookie policy