pestphp / pestphp/pest

[Bug]: wrapping selectors in [id=""]

Open
#1,506 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
11.7k
Forks
538
Avg merge
4d 11h
Merged PRs (30d)
8

Description

What Happened

It keeps wrapping selectors with [id=""]

How to Reproduce
it('can register on desktop', function () {
    $page = visit('/register')->on()->desktop();
    $page->assertPathIs('/register');
    $page->type('input[placeholder="Enter your business name..."]', 'Acme Inc');
});
SyntaxError: Failed to execute 'querySelectorAll' on 'Document': '[id="input[placeholder="Enter your business name..."]"]' is not a valid selector.

As you can below it exists with the same selector.

document.querySelector('input[placeholder="Enter your business name..."]')
<input type=​"text" placeholder=​"Enter your business name..." class=​"block w-full rounded-md border-0 py-1.5 bg-white text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:​text-gray-400 focus:​ring-2 focus:​ring-inset focus:​ring-indigo-600 disabled:​cursor-not-allowed disabled:​bg-gray-50 disabled:​text-gray-500 disabled:​ring-gray-200 sm:​text-sm sm:​leading-6" value>​
Sample Repository

No response

Pest Version

4.0.4

PHP Version

8.3

Operation System

Windows

Notes

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with the provided Pest test and the selector input[placeholder="Enter your business name..."] on PHP 8.3 and Windows. Trace the selector-handling entry point that produces [id="..."]; done means selector queries remain valid without wrapping an already-complete selector in an id selector.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.