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

`see` assertion fails when source code contains `<` in JS code #4509

Closed
tobias-kuendig opened this issue Sep 13, 2017 · 2 comments
Closed

`see` assertion fails when source code contains `<` in JS code #4509

tobias-kuendig opened this issue Sep 13, 2017 · 2 comments

Comments

@tobias-kuendig
Copy link
Contributor

@tobias-kuendig tobias-kuendig commented Sep 13, 2017

When asserting $I->canSee('XYZ'); in an acceptance test using PhpBrowser the assertion returns false even though the page contains XYZ.

The problem in my case was that my page contained code simillar to the following:

<script>
    if (a <= b) {
        // ...
    }
</script>
<p>XYZ</p>

When the getNormalizedResponseContent gets called, all HTML tags are removed with strip_tags. strip_tags interprets the <= itself as a start tag and removes everything that follows the operator. Because of this problem the XYZ text cannot be found since it is removed from the response content.

I suggest removing the script tags manually before using strip_tags. For possible solutions see https://stackoverflow.com/a/22782081.

@DavertMik
Copy link
Member

@DavertMik DavertMik commented Sep 13, 2017

Interesting issue and looks like a nice solution. Could you prepare a patch and a test for this case?

@tobias-kuendig
Copy link
Contributor Author

@tobias-kuendig tobias-kuendig commented Sep 13, 2017

Sure, see #4510

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.