grafana / xk6-browser

k6 extension that adds support for browser automation and end-to-end web testing via the Chrome Devtools Protocol
https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/browser/
GNU Affero General Public License v3.0
337 stars 42 forks source link

Basic Auth: Redirect doesn't work #1011

Open inancgumus opened 1 year ago

inancgumus commented 1 year ago

Brief summary

The module doesn't let a target page redirect to another page, whether that page is basic-auth protected or not. This issue happens only when we set the httpCredentials option.

xk6-browser version

v1.0.2

OS

macOS 13

Chrome version

Chromium 113.0.5671.0 and Chrome 115.0.5790.170

Docker version and image (if applicable)

No response

Steps to reproduce the problem

  1. Use the following script:
import { sleep } from 'k6';
import { browser } from 'k6/x/browser';

export const options = {
  scenarios: {
    ui: {
      executor: 'shared-iterations',
      options: {
        browser: {
          type: 'chromium',
        }
      },
    },
  }
}

export default async function () {
  const page = browser.newPage({
    "httpCredentials": {
      "username": "admin",
      "password": "password",
    }
  });

  try {
    await page.goto('http://localhost:81/static/redirect.html');
    sleep(5);
  } finally {
    page.close();
  }
}
  1. Run a server with the following static content (at URL http://localhost:81/static/redirect.html):
<html>
<body>
    test redirect
    <script>
        document.location = "http://localhost:81/";
    </script>
</body>
</html>
  1. Run the script.

Expected behaviour

The browser module should redirect to http://localhost:81/.

Actual behaviour

mridiniveni commented 5 months ago

Any update?

inancgumus commented 5 months ago

@mridiniveni This isn't our near-term goal.

Please give the issue description (above) a thumbs-up. So we can prioritize it.