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

Improve text assertions #2236

Merged
merged 3 commits into from
Jun 30, 2023

Conversation

celdrake
Copy link
Contributor

@celdrake celdrake commented Jun 30, 2023

  • When integration tests fail by doing text comparisons, sometimes we use the pattern .should('contain') which doesn't output the expected result. That makes debugging the issue harder.

We should use .should('contain.text') which prints what text it found instead of the expected one.

before after
without-diff with-diff
  • In other cases, we were using .contains(text) to validate the text content. But this is not an assertion, rather it's a selector. I've changed the incorrect uses of .contains to .should('contain.text').

@openshift-ci openshift-ci bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 30, 2023
@celdrake celdrake marked this pull request as ready for review June 30, 2023 10:02
@celdrake celdrake requested a review from a team as a code owner June 30, 2023 10:02
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 30, 2023
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 30, 2023
@openshift-ci
Copy link

openshift-ci bot commented Jun 30, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: celdrake, jgyselov, mareklibra

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ammont82 ammont82 merged commit f75b960 into openshift-assisted:master Jun 30, 2023
15 checks passed
rawagner pushed a commit to rawagner/facet-lib that referenced this pull request Sep 13, 2023
* Improve logging of text check failures

* Display the actual found text on failures

* Fix incorrect use of selectors instead of text assertion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants