laravel / dusk

Laravel Dusk provides simple end-to-end testing and browser automation.
https://laravel.com/docs/dusk
MIT License
1.87k stars 320 forks source link

Require Dusk selectors to adhere to CSS naming rules #1114

Closed pindab0ter closed 1 month ago

pindab0ter commented 1 month ago

Description

This PR fixes issue #1113 by refining the Dusk selector parsing to ensure compatibility with valid CSS class names. Currently, the documentation, PHPDoc, and unit tests do not clearly define which characters are valid for Dusk selectors, leading to potential conflicts when Dusk selectors are combined with other CSS selectors on the same element.

Motivation

The existing documentation and unit tests only uses dashes in Dusk selectors. However, Dusk selectors cannot be used alongside other CSS selectors if they target the same element, which requires them not to be separated by a space. By aligning the Dusk selector parsing with the standards for valid CSS names (as outlined in this Stack Overflow answer), we add support for Dusk selectors to target the same element as other CSS selectors.

Changes

taylorotwell commented 1 month ago

Thanks for your pull request to Laravel!

Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.

If applicable, please consider releasing your code as a package so that the community can still take advantage of your contributions!

pindab0ter commented 1 month ago

Can I get a response that goes into the core issue of the problem this is trying to solve?

This feels like a canned response, as this PR does only changes one line of code and adds two unit test cases.

u01jmg3 commented 1 month ago

@pindab0ter: might be worth flagging to @driesvints ☮️