Redirects not working in grafana cloud performance testing

What happened?

Redirects do seem to be timing out on K6 Cloud. We have tests that get redirected to a homepage. The homepage redirection constantly timeouts. When the test is executed locally (from same region) the test works.

We have tried the following code

await Promise.all([
page.click(selector, {timeout: timeout ?? this.defaultTimeout });,
page.waitForNavigation({timeout: timeout ?? this.defaultTimeout })
]);

Generates the following error

2025-04-02 20:24:09.404
[portal_smoke:1:0] Error thrown: waiting for navigation: timed out after 1m0s

We have also tried sequential awaits without wait for navigation, wating for an know element to appear

await page.click(selector, {timeout: timeout ?? this.defaultTimeout });,
await page.waitForSelector(navselector, {timeout: timeout ?? this.defaultTimeout });

And the waitforselector timesout

What did you expect to happen?

Redirect to not timeoout. When the test is execite from a local host there are no timeouts. All URLs used by the test are public.

Did this work before?

No

How do we reproduce it?:

  1. Execute the “Risk Map Smoke Tests” linked above
  2. View errors in logs,

Is the bug inside a dashboard panel?

No

If the bug is inside a dashboard panel, please use the “Get help” feature. Select Dashboard in order to Download the panel and attach the data file to this ticket form.

Environment (with versions):

  • Grafana version: Grafana cloud trial
  • Operating system: Linux
  • Browser: Chromium
  • Datasource version(s) (prometheus, graphite, etc.): Grafana cloud trial
  • Plugins: n/a

We have reproduced this locally with the K6 docker images.

When running our tests with the grafana/k6:master-with-browser image we can reproduce the issue.

When running our tests with the grafana/k6:latest-with-browser image the issue goes away.

Hi @brianflynn,

Thanks for the detailed issue.

So the page should redirect to the homepage when a specific element is clicked on. Does the whole page navigate to the homepage, or does an iframe within the page navigate to the homepage? I’ve seen a similar issue recently with iframes, that’s why i’m wondering whether it’s an iframe that navigates.

await Promise.all([
    page.click(selector, {timeout: timeout ?? this.defaultTimeout });,
    page.waitForNavigation({timeout: timeout ?? this.defaultTimeout })
]);

I would expect this to work when a click occurs. Have you tried working with the following?:

    await page.click(selector, {timeout: timeout ?? this.defaultTimeout });
    await page.locator(navselector).waitFor();

When running our tests with the grafana/k6:master-with-browser image we can reproduce the issue.

When running our tests with the grafana/k6:latest-with-browser image the issue goes away.

This is very interesting, it sounds like we may have a regression in the master branch of k6. I would like to run the test script so that I can replicate the issue locally. Would you be comfortable sharing the full script as well as any credentials I may need to get it to work? You should be able to DM me these details.

Best,
Ankur

Hi Ankur, thanks for the response. we tried await page.locator(navselector).waitFor(); and the error persists. The tests are running on a granfan cloud instance would that help for debugging?