Hello, folks. First, thank you for this amazing tool.
In the example below, I get the metric per URL only if I set the threshold to https://test.k6.io/my_messages.php
. If I set it to the URL https://test.k6.io
it shows zeroed values.
It is happening in our use case as well, it is not showing metrics for one of our domain.
import { check } from 'k6';
import {browser} from 'k6/browser';
export const options = {
scenarios: {
ui: {
executor: 'shared-iterations',
options: {
browser: {
type: 'chromium',
},
},
},
},
thresholds: {
'browser_web_vital_lcp': ['p(90) < 1000'],
'browser_web_vital_inp{url:https://test.k6.io}': ['p(90) < 80'],
// 'browser_web_vital_inp{url:https://test.k6.io/my_messages.php}': ['p(90) < 100'],
},
};
export default async function() {
const page = await browser.newPage();
try {
// Goto front page, find login link and click it
await page.goto('https://test.k6.io', { waitUntil: 'networkidle' });
await Promise.all([
page.waitForNavigation(),
page.locator('a[href="/my_messages.php"]').click(),
]);
// Enter login credentials and login
await page.locator('input[name="login"]').type('admin');
await page.locator('input[name="password"]').type('123');
// We expect the form submission to trigger a navigation, so to prevent a
// race condition, setup a waiter concurrently while waiting for the click
// to resolve.
await Promise.all([
page.waitForNavigation(),
page.locator('input[type="submit"]').click(),
]);
check(page, {
'header': (await page.locator('h2').textContent()) === 'Welcome, admin!',
});
} finally {
await page.close();
}
}