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

Failing test generates invalid XML #2004

Closed
AlexKasaku opened this issue Jan 26, 2019 · 9 comments
Closed

Failing test generates invalid XML #2004

AlexKasaku opened this issue Jan 26, 2019 · 9 comments

Comments

@AlexKasaku
Copy link

The following test fails, as expected, but the XML generated as part of the report is invalid:

module.exports = {
    '@tags': ['Google'],
    'Google Test': function (browser) {

      browser
        .url('https://www.google.com')
        .waitForElementVisible('body')
        .expect.element('input[name="btnK"]').value.to.equal('BAD VALUE');

      browser.end();
    }
  };

Generated report:

<?xml version="1.0" encoding="UTF-8" ?>
<testsuites errors="0"
            failures="1"
            tests="1">

  <testsuite name="homepage"
    errors="0" failures="1" hostname="" id="" package="homepage" skipped="0"
    tests="1" time="6.033" timestamp="">
  
    <testcase name="Google Test" classname="homepage" time="6.033" assertions="2">

      <failure message="Expected element &lt;input[name=&#34;btnK&#34;]&gt; to have value equal: &#34;BAD VALUE&#34; - expected �[0;32m&#34;equal &#39;BAD VALUE&#39;&#34;�[0m but got: �[0;31m&#34;Google Search&#34;�[0m">    at Object.Google Test (C:\source\nightwatchtest\cases\homepage.js:10:17)
    at &lt;anonymous&gt;
    at process._tickCallback (internal/process/next_tick.js:160:7)</failure>

    <failure message="    at Object.Google Test (C:\source\nightwatchtest\cases\homepage.js:10:17)">    at &lt;anonymous&gt;
    at process._tickCallback (internal/process/next_tick.js:160:7)</failure>
    </testcase>
  
  </testsuite>
</testsuites>

This XML isn't valid, and as such cannot be parsed

Nightwatch version 1.0.18
Chromedriver 2.45.0

@beatfactor
Copy link
Member

OS?

@AlexKasaku
Copy link
Author

Windows 10

@beatfactor
Copy link
Member

@AlexKasaku So how exactly is the XML not valid? Can you please elaborate?

@egmcdonald
Copy link
Contributor

I am getting this error too. The issue is in the initial failure element. There is an invisible 0x1b on line 20 at character 22. It may not get copied over when I put it in this snippet, but hopefully it will give you more of an indication as to the issue:

<?xml version="1.0" encoding="UTF-8" ?>
<testsuites errors="0"
            failures="1"
            tests="1">

  <testsuite name="testsuitename"
    errors="0" failures="1" hostname="" id="" package="packagename" skipped="0"
    tests="1" time="8.418e-9" timestamp="">
  
    <testcase name="testcasename" classname="testclassname" time="8.418" assertions="4">

    

    

      <failure message="Failed [strictEqual]: (Input A expected to strictly equal input B:
+ expected - actual

- true
+ false) - expected �[0;32m&#34;false&#34;�[0m but got: �[0;31m&#34;true&#34;�[0m">+ expected - actual

- true
+ false
    at Object.testcasename. (/path)</failure>

    <failure message="+ expected - actual">
- true
+ false
    at Object.testcasename. (/path)</failure>
    </testcase>
  

  

  
  </testsuite>
</testsuites>

Nightwatch version: 1.0.18
Operating System: MacOS High Sierra

@beatfactor
Copy link
Member

@egmcdonald so maybe you could submit a PR? Thanks in advance :)

@AlexKasaku
Copy link
Author

Looks like it was lost in the copy + paste, I'll upload the file directly (renamed to TXT for GitHub upload)

CHROME_71.0.3578.98_Windows_NT_homepage.xml.txt

@beatfactor
Copy link
Member

Can you post it inline please?

@AlexKasaku
Copy link
Author

I believe that was the problem? Pasting it inline in GitHub is stripping out the problematic character, as highlighted by @egmcdonald

@egmcdonald
Copy link
Contributor

@beatfactor I have submitted a proposed fix for this issue: #2013

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

No branches or pull requests

3 participants