Xk6-playwright output summary and influxdb extensions

Hi @eyeveebe

I am trying to use GitHub - wosp-io/xk6-playwright: k6 extension that adds support for browser automation and end-to-end web testing using playwright-go for web performance testing and build the binaries like -

xk6 build v0.42.0 --with GitHub - grafana/xk6-output-influxdb: k6 extension for InfluxDB v2 --with GitHub - wosp-io/xk6-playwright: k6 extension that adds support for browser automation and end-to-end web testing using playwright-go

and now try to run


import pw from 'k6/x/playwright';

export function webtest() {
    pw.launch()
    pw.newPage()
    pw.goto("https://www.google.com/")
    pw.waitForSelector("input[title='Search']", {state: 'visible'})
    pw.type("input[title='Search']", "how to measure real user metrics with the xk6-playwright extension for k6?")
  
    //print out real user metrics of the google search page
    console.log(`First Paint: ${pw.firstPaint()}ms`)
    console.log(`First Contentful Paint: ${pw.firstContentfulPaint()}ms`)
    console.log(`Time to Minimally Interactive: ${pw.timeToMinimallyInteractive()}ms`)
    console.log(`First Input Delay: ${pw.firstInputDelay()}ms`)
  
    pw.kill()
}

with command -

K6_INFLUXDB_ORGANIZATION=“” K6_INFLUXDB_TOKEN=“” ./k6 run -o xk6-influxdb=https://ip:8088/k6_performance script.js

but its not doing anything and terminate immediately without any error

Hi @vish_s02

I split the thread from https://community.k6.io/t/xk6-browser-result-output-in-influxdb/5696as those seem separate topics.

The script on their documentation actually gets stuck in pw.waitForSelector("input[title='Search']", {state: 'visible'}). And the test ends after the duration you set. This example probably worked on an older google search page, but not anymore?

I tried the script below, with our ecommerce test site:

export default function () {
    pw.launch()
    pw.newPage()
    pw.goto("http://ecommerce.k6.io/")
    pw.waitForSelector("input[id='woocommerce-product-search-field-0']", { state: 'visible' })
    pw.type("input[id='woocommerce-product-search-field-0']", "logo")

    //print out real user metrics of the google search page
    console.log(`First Paint: ${pw.firstPaint()}ms`)
    console.log(`First Contentful Paint: ${pw.firstContentfulPaint()}ms`)
    console.log(`Time to Minimally Interactive: ${pw.timeToMinimallyInteractive()}ms`)
    console.log(`First Input Delay: ${pw.firstInputDelay()}ms`)

    pw.kill()
}

And I do get the summary when running ./xk6-playwright run script.js. And we also see the INFO logs.


          /\      |‾‾| /‾‾/   /‾‾/   
     /\  /  \     |  |/  /   /  /    
    /  \/    \    |     (   /   ‾‾\  
   /          \   |  |\  \ |  (‾)  | 
  / __________ \  |__| \__\ \_____/ .io

  execution: local
     script: scripts/script.js
     output: -

  scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
           * default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)

INFO[0003] First Paint: 1447ms                           source=console
INFO[0003] First Contentful Paint: 1447ms                source=console
INFO[0003] Time to Minimally Interactive: 0ms            source=console
INFO[0003] First Input Delay: 0ms                        source=console

running (00m02.9s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [======================================] 1 VUs  00m02.9s/10m0s  1/1 iters, 1 per VU

     data_received........: 0 B 0 B/s
     data_sent............: 0 B 0 B/s
     iteration_duration...: avg=2.89s min=2.89s med=2.89s max=2.89s p(90)=2.89s p(95)=2.89s
     iterations...........: 1   0.345118/s
     vus..................: 1   min=1      max=1
     vus_max..............: 1   min=1      max=1

The extension GitHub - wosp-io/xk6-playwright: k6 extension that adds support for browser automation and end-to-end web testing using playwright-go is a community one, so you should probably address the maintainers for concrete help on how this works, or to contribute to it (update the docs, etc). The k6 team is working on the xk6-browser extension.

Cheers!