Hello,
Is there a way to test multiple concurrent browser sessions for a streaming service?
Here is an example of my current implementation:
import { browser } from 'k6/experimental/browser';
import { check } from 'k6';
export const options = {
scenarios: {
open_model: {
executor: 'shared-iterations',
options: {
browser: {
type: 'chromium',
},
},
},
},
};
export default async function () {
const context = browser.newContext();
const page = context.newPage();
try {
const res = await page.goto('https://website.com');
// checks the response code
check(res, {
'response code was 200': (res) => res.status() === 200,
});
// clicks on the tune in button
const playAudio = page.locator('button[aria-label="tuneInButton"]')
// checks tune in button exists
check(page, {
'Tune in button present': () => page.locator('button[aria-label="tuneInButton"]').isVisible(),
});
playAudio.dispatchEvent('click');
// checks that the button has been clicked
check(page, {
'Tune in button clicked': () => page.locator('button[aria-label="tuneInButton"]').isHidden(),
});
} finally {
page.close();
}
}
if i run it with 1 vus and 1 iteration it works but with multiple vus the test fails mainly because the playAudio button is no longer present and/or page was closed .
I’ve read on a recent post that concurrent browser contexts are not allowed.
So i wonder if there’s any workaround to have multiple browser context with 1 vu for a time period where it would allow me to emulate multiple users at the same time listening to the streaming.
Thanks