Hi everyone,
I’m new to xk6-browser and am currently facing some issues while using it in a xk6-browser GitHub action to conduct a load test with over 100 VUs (max 300) performing various interactions like button clicks to navigate the site.
The issues seem to occur once there are more than 100 VUs as the test would then fail. At the moment, I’m not clear as to why that specific threshold causes panic internal error failures. Browsing the community forum hasn’t quite revealed an answer/solution (maybe I’m just missing something).
Below that number, the tests can successfully execute to the end with multiple VUs and without a panic error failure. The script used is as follows:
/* global __ENV:false */
import { check } from 'k6';
import exec from 'k6/execution';
import { chromium } from 'k6/x/browser';
// GitHub Action secret with the URL of the site to load test.
const SITE = __ENV.load_test_site;
// GitHub Action secret with email:password pairing in a comma-separated string.
const USERS = __ENV.load_test_users.split( ',' );
export let options = {
scenarios: {
load_testing: {
executor: 'per-vu-iterations',
exec: 'load_test',
vus: USERS.length,
iterations: 1,
},
},
};
export function load_test() {
const browser = chromium.launch(
{
headless: true,
}
);
const page = browser.newPage();
page
.goto( SITE, { waitUntil: 'load' } )
.then( () => {
const user = USERS[exec.vu.idInTest - 1].split( ':' );
page.locator( '#user_login' ).type( user[0] );
page.locator( '#user_pass' ).type( user[1] );
// Wait for asynchronous operations to complete.
return Promise.all( [
page.waitForNavigation(),
page.locator( '#wp-submit' ).click(),
] ).then( () => {
check( page, {
'Logged in and on the homepage.': page.locator( 'h1.search__title' ).textContent().trim() === 'Homepage',
} );
} );
} ).then( () => {
return Promise.all( [
page.locator( 'a[href="/url1"]' ).click(),
] ).then( () => {
check( page, {
'Navigated to URL 1 page.': page.locator( 'h1.heading-1' ).textContent().trim() === 'URL 1 page',
} );
} );
} ).then( () => {
return Promise.all( [
page.locator( 'a[href="/url2"]' ).click(),
] ).then( () => {
check( page, {
'Navigated to URL 2 page.': page.locator( 'h1.heading-1' ).textContent().trim() === 'URL 2 page',
} );
} );
} ).then( () => {
// Switch pages using the navigation.
return Promise.all( [
page.locator( 'div.dropdown-wrapper > button.trigger-dropdown' ).click(),
page.locator( 'div.dropdown-menu > button:first-child' ).click(),
] ).then( () => {
check( page, {
'Navigated to URL 3 page.': page.locator( 'h1.heading-1' ).textContent().trim() === 'URL 3 page',
} );
} );
} ).then( () => {
// Attempt to search for something.
page.locator( '#search-header' ).type( 'Account' );
return Promise.all( [
page.locator( 'div.wp-block-search__inside-wrapper > button[type="submit"]' ).click(),
] ).then( () => {
// Check if the search results page.
check( page, {
'Navigated to Search results page.': page.locator( 'div.search-results-content' ),
} );
} );
} ).finally( () => {
page.close();
browser.close();
} );
}
The different panic internal errors I observed can be seen in the image below.
Any pointers on how to resolve them would be greatly appreciated.