grafana / k6-docs

The k6 documentation website.
https://grafana.com/docs/k6/latest/
87 stars 222 forks source link

Docs: Replace sync `check` usage with async `check` #1725

Closed andrewslotin closed 1 month ago

andrewslotin commented 2 months ago

Change all, from:

const headerText = await page.locator('h2').textContent();
check(headerText, {
  'header': headerText === 'Welcome, admin!'
});

To:

import { check } from 'https://jslib.k6.io/k6-utils/1.5.0/index.js';

// ...

check(page.locator('h2'), {
  'header': async lo => await lo.textContent() === 'Welcome, admin!'
});
### Tasks
- [ ] grafana/k6-docs#1746
- [ ] grafana/xk6-browser#1448
inancgumus commented 1 month ago

We'll also update the xk6-browser examples/.

Done: https://github.com/grafana/xk6-browser/pull/1448