browser

package module
v1.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2024 License: AGPL-3.0 Imports: 2 Imported by: 0

README

xk6-browser

Browser automation and end-to-end web testing for k6

An extension for k6 adding browser-level APIs with rough Playwright compatibility.

Github release Build status Go Report Card
Slack channel

Download · Documentation · Community Forum


---

xk6-browser is a k6 extension that supports browser automation through the Chrome Devtools Protocol (CDP). It adds browser-level APIs to interact with browsers and collect frontend performance metrics as part of your k6 tests.

As of k6 version 0.43.0, xk6-browser is now bundled in k6 as an experimental module, and usable without a separate binary or compilation step!

https://user-images.githubusercontent.com/10811379/220158567-cdef7ddc-96c5-41d9-854f-a25c5f67e4b3.mp4

Special acknowledgment to the authors of Playwright and Puppeteer for their trailblazing work in this area. This project is heavily influenced and in some regards based on the code of those projects.

Goals

  • Bring browser automation to the k6 testing platform while supporting core k6 features like VU executors, scenarios, metrics, checks, thresholds, logging, DNS remapping, IP blocklists, etc.
  • Test stability as the top priority by supporting non-flaky selectors combined with auto-waiting for actions just like Playwright.
  • Aim for rough API compatibility with Playwright. The reason for this is two-fold; for one we don't want users to have to learn a completely new API just to use xk6-browser, and secondly, it opens up for using the Playwright RPC server as an optional backend for xk6-browser should we decide to support that in the future.
  • Support for Chromium compatible browsers first, and eventually Firefox and WebKit-based browsers.

See our project roadmap for more details.

Get started

Documentation

Get help

  • If you're having issues installing or running xk6-browser, refer to TROUBLESHOOTING.
  • To get help about usage, report bugs, suggest features, and discuss xk6-browser with other users see SUPPORT.md.
  • Community discussion happens at the xk6-browser forum.

Additional resources

To find out more about xk6-browser or browser testing in general, check out the following links.

Note: since our API is still transitioning, some of the code snippets from the links below might be inaccurate, though the concepts should still be correct. For the latest, refer to our up-to-date API documentation.

Documentation

Overview

Package browser provides an entry point to the browser extension.

Directories

Path Synopsis
Package browser is the browser module's entry point, and initializer of various global types, and a translation layer between Goja and the internal business logic.
Package browser is the browser module's entry point, and initializer of various global types, and a translation layer between Goja and the internal business logic.
Package chromium is responsible for launching a Chrome browser process and managing its lifetime.
Package chromium is responsible for launching a Chrome browser process and managing its lifetime.
Package common provides the main logic of the browser module.
Package common provides the main logic of the browser module.
js
Package js provides JavaScript code that the browser module evaluates on the browser.
Package js provides JavaScript code that the browser module evaluates on the browser.
Package env provides types to interact with environment setup.
Package env provides types to interact with environment setup.
Package k6error contains ErrFatal.
Package k6error contains ErrFatal.
Package k6ext acts as an encapsulation layer between the k6 core and xk6-browser.
Package k6ext acts as an encapsulation layer between the k6 core and xk6-browser.
k6test
Package k6test provides mock implementations of k6 elements for testing purposes.
Package k6test provides mock implementations of k6 elements for testing purposes.
Package keyboardlayout provides keyboard key interpretation and layout validation.
Package keyboardlayout provides keyboard key interpretation and layout validation.
Package log provides logging for the browser module.
Package log provides logging for the browser module.
Package storage provides data storage for the extension and user specific data.
Package storage provides data storage for the extension and user specific data.
Package tests provides integration tests.
Package tests provides integration tests.
ws
Package ws provides a test WebSocket server.
Package ws provides a test WebSocket server.
Package trace provides tracing instrumentation tailored for k6 browser needs.
Package trace provides tracing instrumentation tailored for k6 browser needs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL