Hi,
I have installed the following version of K6: k6-0.53.0-1.x86_64
I have the following code:
import { browser } from 'k6/browser';
import { check } from 'k6';
export const options = {
scenarios: {
ui: {
executor: 'shared-iterations',
options: {
browser: {
type: 'chromium',
},
},
},
},
thresholds: {
checks: ['rate==1.0'],
},
};
export default async function () {
const context = await browser.newContext();
const page = await context.newPage();
try {
await page.goto('https://www.myexampleurl.com',{waitUntil:'networkidle'});
await page.locator('#username').type('aaa');
await page.locator('#password').type('bbbbbb');
await Promise.all([page.waitForNavigation(), page.locator('input[type="submit"]').click()]);
const header = await page.locator('h2').textContent();
check(header, {
header: (h) => h == 'Welcome to',
});
} finally {
await page.close();
}
}
When I navigate to https://www.myexampleurl.com it re-directs to our RHSSO link where one can input username and password and click submit, then it finally lands on https://www.myexampleurl.com.
I run the kode with the following command:
K6_BROWSER_HEADLESS=false k6 run script.js
The test does run, but I get the following error:
ERRO[0026] Failed to load resource: the server responded with a status of 401 (Unauthorized) browser_source=network line_number=0 source=browser stacktrace="<nil>" url="https://rhsso-blahhblah.com/auth/realms/blah/protocol/openid-connect/auth?client_id=tend&redirect_uri=https%3A%2F%2Fblahblaho%2F&state=-1982-46ed-8579-&response_mode=fragment&response_type=code&scope=openid&nonce=-3c9c-4ef4-80d5-"
Any ideas why I get the error?