Skip to content

hasTouch option in newContext for the Browser class is ignored and is always on #4436

Open
@ankur22

Description

@ankur22

In PW, if hasTouch is set to false when creating the newContext then when we use page.touchscreen.tap(5,5,) it will error with:

touchscreen.tap: hasTouch must be enabled on the browser context before using the touchscreen.

If hasTouch is set to true, then using tap will work as expected.

In xk6-browser setting hasTouch doesn't seem to make a difference and tap works if the value of hasTouch is set to true or false.

This is the test code i worked with and expect an error to match the PW behaviour, but it currently works:

import { sleep } from 'k6';
import launcher from 'k6/x/browser';

export default function () {
  const browser = launcher.launch('chromium', {
      headless: false,
  });
  browser.newContext({
    hasTouch: false,
  });
  const cc = browser.contexts();
  const page = cc[0].newPage();
  const res = page.goto('https://google.com');
  page.touchscreen.tap(5,5);

  sleep(10);
  browser.close();
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions