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

#1780 verify the whole text in $.shouldHave(text), not a substring #1783

Merged
merged 10 commits into from
Aug 3, 2022

Conversation

asolntsev
Copy link
Member

@asolntsev asolntsev commented Apr 25, 2022

Given a html:

<div id="hello"> / World / </div>

Before this change:

  $("#hello").shouldHave(text(" / World / ")); // ok
  $("#hello").shouldHave(text("World")); // ok

After this change:

  $("#hello").shouldHave(text(" / World / ")); // ok
  $("#hello").shouldHave(text("World")); // NOK
  $("#hello").shouldHave(partialText("World")); // ok

See #1780

@asolntsev asolntsev added this to the 6.5.0 milestone Apr 25, 2022
@asolntsev asolntsev self-assigned this Apr 25, 2022
@asolntsev asolntsev marked this pull request as draft April 25, 2022 20:21
@asolntsev asolntsev force-pushed the feature/#1780-match-full-text branch 2 times, most recently from 5bc94e9 to c1840d3 Compare April 27, 2022 16:34
@asolntsev asolntsev marked this pull request as ready for review April 27, 2022 16:34
@asolntsev asolntsev force-pushed the feature/#1780-match-full-text branch from c1840d3 to ae51de7 Compare April 30, 2022 21:59
@asolntsev asolntsev modified the milestones: 6.5.0, 6.6.0 May 17, 2022
@asolntsev asolntsev removed this from the 6.6.0 milestone Jun 6, 2022
@asolntsev asolntsev force-pushed the feature/#1780-match-full-text branch 3 times, most recently from 6ae06bd to 8b2a5b3 Compare June 26, 2022 10:04
@sonarcloud
Copy link

sonarcloud bot commented Jun 26, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 6 Code Smells

No Coverage information No Coverage information
4.1% 4.1% Duplication

+ fix existing integration tests that assumed that `$.shouldHave(text)` checks a substring
* the text might be "Item #1" or "Updated Item #1" depending on browser speed
* the full text should be "x (1)" meaning "1 change". And it seems to work stabely in all browsers.
it should work equally well independently on user locale
otherwise, the page cannot be loaded in 200 ms sometimes.
@asolntsev asolntsev force-pushed the feature/#1780-match-full-text branch from 8b2a5b3 to ef497bb Compare August 3, 2022 16:02
... to keep backward compatibility. Let's change it to FULL_TEXT in a next major release 7.0.0
@asolntsev asolntsev force-pushed the feature/#1780-match-full-text branch from 53f0547 to 7a9f42a Compare August 3, 2022 19:39
@asolntsev asolntsev added this to the 6.7.0 milestone Aug 3, 2022
@sonarcloud
Copy link

sonarcloud bot commented Aug 3, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@asolntsev asolntsev merged commit ac0a54e into master Aug 3, 2022
@asolntsev asolntsev deleted the feature/#1780-match-full-text branch August 3, 2022 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Method $.shouldHave(text) should verify the whole text (not a substring)
1 participant