Playwright & Cucumber introduction (1/3)

Tugay Uzinli
Team Rockstars IT
Published in
4 min readMar 23, 2022

Creating a testing framework from scratch can be a difficult task. Researching frameworks and reviewing each one of them to choose the right one can be even harder. There are many frameworks and multiple ways to automate your tests. In this blog we will share our experience with Playwright, a test automation framework by Microsoft.

As Test Automation Engineers we decided to step up the test automation game of an internal project at Team Rockstars IT. Therefore, we researched and reviewed the most popular JavaScript/Typescript frameworks. Based on this we are convinced that Playwright will be the next state-of-the-art framework which will help us achieve our goals.

About Playwright
Playwright is an open source, cross-browser and cross-language (TypeScript, JavaScript, Python, .NET and Java) Node.js library created by Microsoft to automate Chromium (Chrome), Firefox and Webkit. The capabilities of Playwright are quite powerful. Microsoft Playwright is developed by the same team that developed Google Puppeteer, although it is maintained by Microsoft.

Having had plenty of experience in creating automation frameworks and with continuous development, 2000+ issues have been resolved and 700+ created by stack overflow at the time of writing.

Playwright is rapidly building up a community with some big names in the IT industry, such as the likes of Microsoft, Disney, ING and Adobe.

Perks of Playwright
Like we said above, Playwright was created by a team that has plenty of experience in creating Test Automation Tools. Therefore, Playwright is pretty mature, even though it is in the early stages. Two of the benefits of Playwright are speed and performance. These two make Playwright outstanding. Playwright provides Auto-wait API for elements to be ready and Timeout-free to communicate with network requests, which makes timeout events unnecessary. By eliminating timeout events with Timeout-free concept Playwright speeds up automated testing. Playwright provides full API coverage for all modern browsers, it also supports headless and headful execution. The option to run headless tests makes GUI testing less time-consuming, which means quicker test results.

Before diving into Playwright, let’s look at the available frameworks and what Playwright offers that other frameworks do not. We here compare tools with which you can do functional/Regression testing using JS/TS, such as WebDriverIO, Cypress, Protractor and Playwright. Protractor will not be a candidate. As it’s about to be deprecated by the end of this year, it is not taken into consideration here. The below table shows their comparison.

Playwright installation:

To get started with Playwright,

  • Start with installation of node.js.
  • Use any IDE like IntelliJ, Visual Studio code etc.
  • Create folder and open it in the IDE
  • Open a terminal and install playwright with the command below. This creates a node_modules folder in the project folder.

npm Install @playwright/test

  • Run command

npm Install @cucumber/cucumber

  • The above installation sets the stage for a Cucumber-Playwright first testcase. We here use first testcase with typescript.

We have created an example repository. This repository will be used in the next blogs about Playwright & Cucumber

This is our first blog written for Playwright with an introduction and a short how to. Our next blog will involve more focus into Playwright with UI elements, Popups, Windows and tabs. Stay tuned to explore more on Playwright and let us know in the comments on what topics you would like us to blog further on.

About the authors:

Rama Mohan
Rama is a Senior Test Automation Consultant with several years of expertise in the IT industry as a developer-turned-tester.
Having had challenging projects within Banking, Meteorology etc., it is just in the DNA of a Developer / tester to stay
relevantly updated with times.

Tugay Uzinli
Tugay Uzinli has multiple years of experience in Test Automation and User Experience. He has successfully executed projects in the public and private sector as well as web and mobile applications. As a senior test automation engineer Tugay states that each project requires creativity and a broad knowledge of technical possibilities. Therefore, exploring new methods and technologies will have a positive effect on the perspective of the tester.

--

--

Tugay Uzinli
Team Rockstars IT

I’m a senior Test Automation Engineer at Team Rockstars IT. I enjoy testing many things in life like; webapps, applications but also testing new food and drinks