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

Comments

Projects
None yet
2 participants
@tobias-kuendig
Contributor

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

This comment has been minimized.

Show comment
Hide comment
@DavertMik

DavertMik Sep 13, 2017

Member

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

Member

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

This comment has been minimized.

Show comment
Hide comment
@tobias-kuendig

tobias-kuendig Sep 13, 2017

Contributor

Sure, see #4510

Contributor

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