Microsoft Releases Playwright Test Runner
Written by Kay Ewbank   
Monday, 16 November 2020

Microsoft has released a preview version of Playwright Test Runner, a zero config cross-browser tool providing end-to-end testing for web apps. Features include browser automation for Playwright, Jest-like assertions and built-in support for TypeScript.

Playwright is a Node.js library to automate Chromium, Firefox and WebKit with a single API. It is built to enable reliable cross-browser web automation for single page apps and progressive web apps. There's also a Playwright for Python under development.

playwright

By using the Playwright API, you can write JavaScript code to create new browser pages, navigate to URLs and then interact with elements on a page. When used along with a test runner, Playwright can be used to automate user interactions to validate and test web applications.

Test runners are tools that take a set of unit tests and settings, execute the tests and creates a report of the test results on the console or in log files.

The Playwright API lets you create end-to-end tests that can be run automatically on web browsers. Microsoft says Playwright is better because it delivers reliable, timeout-free automation, whereas traditional automated tests rely on sleep timeouts to manage asynchronous complexity, leading to unpredictable failures.

Playwright automatically waits for the UI to be ready, so tests are reliable to execute and simpler to author. Playwright uses an event-driven architecture that can listen to precise browser events like DOM changes, network requests and page navigations.

Playwright already worked with existing  JavaScript test runners, and comes with examples of how to use it with Jest / Jasmine, AVA, and Mocha. 

The new test runner offers Jest-like assertions and has built-in support for TypeScript. It makes use of the Folio customizable test framework. Jest is a JavaScript testing framework, and Folio can be used to build your own test frameworks, and forms the foundation for the Playwright test runner.

Microsoft says it has been using the Playwright test runner in preview after it has been in use internally within Microsoft for several months. The test runner has describe, expect, and it, functions.

It and describe are used to write test functions. You can run a single test with it.only and skip a test with it.skip

const { it, describe } = require("@playwright/test");
describe("feature foo", () => {
  it("is working correctly", async ({ page }) => {
    // Test function
  });
});

Expect is used to check that values meet certain conditions via 'matchers' that can be used to validate results. Tests can be run on single or multiple browsers and with flags to generate screenshot on test failures.

Playwright Test Runner is available now on GitHub.

playwright

More Information

Playwright Test On GitHub

Related Articles

JS Test goes open source  

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on, Twitter, Facebook or Linkedin.

Banner


Python Is TIOBE Language of the Year Again
06/01/2021

The moment we've been anticipating for months has arrived. TIOBE has announced its Language of the Year for 2020 and, as predicted, it is Python. This is a historic first as Python is the only languag [ ... ]



Jacob Ziv Awarded IEEE Medal of Honor For Data Compression
18/01/2021

This year's IEEE Medal of Honor has been awarded to Jacob Ziv, who, with  Abraham Lempel, created two lossless compression methods (LZ-77 and LZ-78) which are the basis of a wide range  [ ... ]


More News

square

 



 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Tuesday, 17 November 2020 )