Skip to content

Browser module doesn't respect navigation error text #4861

@ankur22

Description

@ankur22

Brief summary

If we run the following test:

import { browser } from 'k6/browser';

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

export default async function () {
  const page = await browser.newPage();

  try {
    await page.goto("https://blah.madeupurl.com");
    console.log("test")
  } finally {
    await page.close();
  }
}

It should fail on the page.goto since the DNS cannot be resolved, and therefore we shouldn't see "test" being logged to the console.

At the moment we're not capturing the error text correctly here. We should be checking to see if it is not empty and fail the navigation if it is not empty.

k6 version

NA

OS

NA

Docker version and image (if applicable)

No response

Steps to reproduce the problem

NA

Expected behaviour

Test should fail on page.goto.

Actual behaviour

Test continues on assuming that the page loaded correctly.

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions