You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current implementation of assertSee() / assertSeeIn() / assertDontSee / assertDontSeeIn() support selectors to multiple elements but assume only one element is selected while there are valid/legitimate selector that returns multiple elements.
For example, the content of the first column in a dataTable, ignoring content in other columns: #crudTable > tbody > tr > td:nth-child(1) > span.
I find only the first element is considered and assert on it if it exists.
The asserts do not provide feedback when multiple elements are returned and will be right or wrong depending if the target text is present in the first or in other elements.
After making a macro for additional asserts methods, I found the existing code could be extended to manage these cases relatively easily.
The contribution guide says a "draft" PR will not be reviewed, but I seek opinions on choices available in implementing the changes, I will link to my fork of dusk, or will a Draft PR be useful here since it is referenced in an issue?
As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.
If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.
Hi @crynobone, the PR is closed/delayed for now and that's ok, but I'd really appreciate feedback on the issue (behavior with multiple elements), but also the submitted changes, comments and questions I made regarding the implementation and testing.
I think this would help make valuable contributions to dusk/laravel in the future.
Dusk Version
8
Laravel Version
11.34
PHP Version
8.3
PHPUnit Version
11
Database Driver & Version
No response
Description
The current implementation of assertSee() / assertSeeIn() / assertDontSee / assertDontSeeIn() support selectors to multiple elements but assume only one element is selected while there are valid/legitimate selector that returns multiple elements.
For example, the content of the first column in a dataTable, ignoring content in other columns:
#crudTable > tbody > tr > td:nth-child(1) > span
.I find only the first element is considered and assert on it if it exists.
The asserts do not provide feedback when multiple elements are returned and will be right or wrong depending if the target text is present in the first or in other elements.
After making a macro for additional asserts methods, I found the existing code could be extended to manage these cases relatively easily.
The contribution guide says a "draft" PR will not be reviewed, but I seek opinions on choices available in implementing the changes, I will link to my fork of dusk, or will a Draft PR be useful here since it is referenced in an issue?
flap152#1
Steps To Reproduce
Given this html content:
the following asserts would fail with either a false negative or "element not found"
The text was updated successfully, but these errors were encountered: