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

Case insensitive assertions #1073

Merged

Conversation

Bryce-Stabenow
Copy link
Contributor

I'd like to add the ability for users to use the optional argument of Str::contains() through ->assertSeeIn() and ->assertSee() in order to make case-insensitive assertions.

Why it matters

Currently, ->assertSeeIn() only allows for case sensitive checks. Unfortunately this can cause a problem when comparing an element's innerText. On our site, we have this element:

<span class="whitespace-nowrap uppercase" id="langHeader">en</span>

On Chrome, the innerText of this element is 'EN', but on Safari, it is 'en'. I'd like to only write one time here an assertion so that I can cover both cases instead of having conditional logic for the browser I'll be testing on:

//Chrome, which passes
$browser->assertSeeIn('#langHeader', 'EN')

//Safari, which fails
$browser->assertSeeIn('#langHeader', 'EN')

//Proposed solution, passes on both
$browser->assertSeeIn('#langHeader', 'EN', true)

This won't break any current functionality since we can pass in a default argument which will keep the existing behavior as it is.

@Bryce-Stabenow Bryce-Stabenow marked this pull request as draft January 2, 2024 21:36
@Bryce-Stabenow Bryce-Stabenow marked this pull request as ready for review January 2, 2024 23:12
@taylorotwell taylorotwell merged commit e7c2509 into laravel:7.x Jan 3, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants