Loading testing for UI using Playwright


Recently I came to k6 (and to this new world of performance and loading testing).

I have a project that currently uses Playwright for the UI (e2e tests), and I want to use my existing tests for loading testing.

I was trying the new version of types/k6 with my current solution of Playwright (using POM), but I got an issue.

I passed the page object to my page classes, and this is the error.-

Argument of type 'import("/Users/my.username/Documents/Projects/my_tests/node_modules/@types/k6/experimental/browser").Page' is not assignable to parameter of type 'import("/Users/my.username/Documents/Projects/my_tests/node_modules/playwright-core/types/types").Page'.
  Type 'Page' is missing the following properties from type 'Page': addInitScript, $eval, $$eval, exposeBinding, and 36 more.ts(2345)

In my page classes, I’m passing a parameter to a constructor of type Page (of Playwright).

I want to load test the different workflows I have, with multiple users (maybe my goal is wrong).

This is a sample project I did, with different workflows, trying to demonstrate what I want to do in my real project.

Thanks in advance for your help. Have a great day! :smiley:

Sorry, I forgot to add the final approach about what I want to do (using the demo repo).-

import { browser } from 'k6/experimental/browser';

import { SLLoginPage } from '../pages/SLLoginPage';
import { SLProductPage } from '../pages/SLProductsPage';

let slLoginPage: SLLoginPage;
let slProductPage: SLProductPage;

export const options = {
    scenarios: {
        login: {
            executor: 'constant-vus',
            exec: 'login',
            vus: 1

export async function login() {
    const context = browser.newContext();
    const page = context.newPage();

    try { 
        slLoginPage = new SLLoginPage(page);
        slProductPage = new SLProductPage(page);

        await slLoginPage.goTo();
        await slLoginPage.fillLoginForm(process.env.USERNAME as string, process.env.PASSWORD as string);
        await page.waitForURL('**/dashboard', { timeout: 3000 });
} finally {

Hi @ArCiGo,

Thanks for opening the thread.

So you have some existing tests that are written to work with Playwright. You have a k6 test that is trying to work the existing Playwright tests. You create a k6 page and pass it as a constructor which is expecting a page which should match the Playwright definition. What were you expecting? What happens if you allow any type instead of a specific type in the constructor?

The k6 page type isn’t going to be compatible with the page type that Playwright expects since the k6 page doesn’t implement all the methods as Playwright has implemented them.