Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interacting with page.getBy*non-existing element hangs instead of throwing #7309

Open
6 tasks done
kettanaito opened this issue Jan 20, 2025 · 1 comment · May be fixed by #7312
Open
6 tasks done

Interacting with page.getBy*non-existing element hangs instead of throwing #7309

kettanaito opened this issue Jan 20, 2025 · 1 comment · May be fixed by #7312

Comments

@kettanaito
Copy link
Contributor

Describe the bug

When using userEvent + page.getBy* and providing a selector that doesn't exist on the page, the test hangs forever instead of throwing "Element by this selector not found".

Reproduction

Reproduction repository: https://github.com/kettanaito/vitest-locator-issue

Actual behavior

 FAIL   chromium  src/App.test.tsx > fills in the email field
Error: Test timed out in 15000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".

System Info

System:
    OS: macOS 15.2
    CPU: (24) arm64 Apple M2 Ultra
    Memory: 90.80 GB / 128.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.13.0 - /usr/local/bin/node
    npm: 10.9.2 - /usr/local/bin/npm
    pnpm: 9.15.3 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 132.0.6834.83
    Safari: 18.2
  npmPackages:
    vitest: ^3.0.2 => 3.0.2

Used Package Manager

npm

Validations

@kettanaito
Copy link
Contributor Author

In the light of actionTimeout change, I would strongly ask you to reconsider a better default. A test failing due to timeout and a test failing due to me trying to access an element that doesn't exist are two different debugging experiences. Perhaps, actionTimeout should be set to the suite's timeout and throw first, before the generic timeout error.

@kettanaito kettanaito linked a pull request Jan 20, 2025 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant