Skip to content

[Bug]: Cannot choose files for <input type="file" /> when using remote browser #39274

@lhfmartin

Description

@lhfmartin

Version

1.58.1

Steps to reproduce

  1. Clone my repo: https://github.com/lhfmartin/lihkg-snapshot-viewer
  2. git switch feature-use-docker-browser-for-tests
  3. pnpm i
  4. pnpm test
  5. You should see that 3 tests fail with the error TypeError: The "path" argument must be of type string. Received undefined

The error happens on the Github Actions pipeline too: https://github.com/lhfmartin/lihkg-snapshot-viewer/actions/runs/22018054724/job/63622672363

Expected behavior

I expect that the error TypeError: The "path" argument must be of type string. Received undefined will not be thrown

Actual behavior

The tests fail with the error TypeError: The "path" argument must be of type string. Received undefined

Additional context

The error is due to f.path in

const files = localDirectory ? (await platform.fs().promises.readdir(localDirectory, { withFileTypes: true, recursive: true })).filter(f => f.isFile()).map(f => platform.path().join(f.path, f.name)) : localPaths!;

The path attribute in the Dirent object is deprecated a few versions ago and is removed in node.js 24. It should be replaced with parentPath

Environment

System:
    OS: macOS 15.7.1
  Binaries:
    Node: 24.13.1
    npm: 11.8.0
    pnpm: 10.29.3
  Languages:
    Bash: 3.2.57 - /bin/bash
  npmPackages:
    @playwright/test: ^1.58.1 => 1.58.1

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions