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


.NET For Apache Spark Updated
05/11/2020

The .NET bindings for Spark have been updated. The new 1.0 version adds support for .NET apps targeting .NET Standard 2.0 or later, as well as support for Apache Spark DataFrame APIs.



The Most Important Features To Include In An E-Commerce App
27/11/2020

An e-commerce application serves a clear and simple goal. To make it successful, there are several tips to keep in mind when starting a new project. Learn what they are, and create an effective e-comm [ ... ]


More News

square

 



 

Comments




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

Last Updated ( Tuesday, 17 November 2020 )