lukas-reineke / protractor-zephyr-reporter

Generates Zephyr for Jira test executions using zapi for protractor tests.
MIT License
1 stars 5 forks source link

PopsicleError: Unhandled response type: application/xml; #12

Open Jveyrat opened 6 years ago

Jveyrat commented 6 years ago

Hello,

I've tried to setup this plugin on my Protractor project. When launching my tests, there's an error relative to Popsicle.

{ PopsicleError: Unhandled response type: application/xml
    at Request.error (C:\Workspace\test-ccp-protractor\node_modules\popsicle\src\request.ts:91:12)
    at C:\Workspace\test-ccp-protractor\node_modules\popsicle\src\plugins\common.ts:141:25
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
  cause: undefined,
  code: 'EPARSE',
  popsicle:
   Request {
     Url:
      Url {
        protocol: 'https:',
        slashes: true,
        auth: null,
        host: 'agile.toto.com',
        port: null,
        hostname: 'agile.toto.com',
        hash: null,
        search: '?state=active',
        query: [Object],
        pathname: '/jira/rest/api/2/board/1149/sprint',
        path: '/jira/rest/api/2/board/1149/sprint?state=active',
        href: 'https://agile.toto.com/jira/rest/api/2/board/1149/sprint?state=active' },
     rawHeaders:
      [ 'Content-Type',
        'application/json',
        'Accept',
        '*/*',
        'User-Agent',
        'Popsicle (https://github.com/blakeembrey/popsicle)',
        'Content-Length',
        '2',
        'Authorization',
        'Basic xxx',
        'Accept-Encoding',
        'gzip,deflate' ],
     middleware: [ [Function], [Function], [Function], [Function] ],
     opened: true,
     aborted: false,
     uploaded: 1,
     downloaded: Infinity,
     timeout: 0,
     method: 'GET',
     body: '{}',
     events: { abort: [Array] },
     transport:
      { use: [Array],
        abort: [Function: abort],
        open: [Function: open] },
     _promise: Promise { <rejected> [Circular] },
     _raw:
      ClientRequest {
        domain: null,
        _events: [Object],
        _eventsCount: 3,
        _maxListeners: undefined,
        output: [],
        outputEncodings: [],
        outputCallbacks: [],
        outputSize: 0,
        writable: true,
        _last: true,
        upgrading: false,
        chunkedEncoding: false,
        shouldKeepAlive: false,
        useChunkedEncodingByDefault: false,
        sendDate: false,
        _removedConnection: false,
        _removedContLen: false,
        _removedTE: false,
        _contentLength: null,
        _hasBody: true,
        _trailer: '',
        finished: true,
        _headerSent: true,
        socket: [Object],
        connection: [Object],
        _header: 'GET /jira/rest/api/2/board/1149/sprint?state=active HTTP/1.1\r\nContent-Type: application/json\r\nAccept: */*\r\nUser-Agent: Popsicle (https://github.com/blakeembrey/popsicle)\r\nContent-Length: 2\r\nAuthorization: Basic anVsaWVuLnZleXJhdEByaWNoZW1v
bnQuY29tOkQ3M01OUCQx\r\nAccept-Encoding: gzip,deflate\r\nHost: agile.toto.com\r\nConnection: close\r\n\r\n',
        _onPendingData: [Function: noopPendingOutput],
        agent: [Object],
        socketPath: undefined,
        timeout: undefined,
        method: 'GET',
        path: '/jira/rest/api/2/board/1149/sprint?state=active',
        _ended: true,
        res: [Object],
        aborted: undefined,
        timeoutCb: null,
        upgradeOrConnect: false,
        parser: null,
        maxHeadersCount: null,
        [Symbol(outHeadersKey)]: [Object] },
     uploadLength: 2,
     uploadedBytes: 2,
     downloadLength: null,
     downloadedBytes: 209 } }
{ PopsicleError: Unhandled response type: application/xml
    at Request.error (C:\Workspace\test-ccp-protractor\node_modules\popsicle\src\request.ts:91:12)
    at C:\Workspace\test-ccp-protractor\node_modules\popsicle\src\plugins\common.ts:141:25
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
  cause: undefined,
  code: 'EPARSE',
  popsicle:
   Request {
     Url:
      Url {
        protocol: 'https:',
        slashes: true,
        auth: null,
        host: 'agile.toto.com',
        port: null,
        hostname: 'agile.toto.com',
        hash: null,
        search: '',
        query: {},
        pathname: '/jira/rest/api/2/board/1149/version',
        path: '/jira/rest/api/2/board/1149/version',
        href: 'https://agile.toto.com/jira/rest/api/2/board/1149/version' },
     rawHeaders:
      [ 'Content-Type',
        'application/json',
        'Accept',
        '*/*',
        'User-Agent',
        'Popsicle (https://github.com/blakeembrey/popsicle)',
        'Content-Length',
        '2',
        'Authorization',
        'Basic xxx',
        'Accept-Encoding',
        'gzip,deflate' ],
     middleware: [ [Function], [Function], [Function], [Function] ],
     opened: true,
     aborted: false,
     uploaded: 1,
     downloaded: Infinity,
     timeout: 0,
     method: 'GET',
     body: '{}',
     events: { abort: [Array] },
     transport:
      { use: [Array],
        abort: [Function: abort],
        open: [Function: open] },
     _promise: Promise { <rejected> [Circular] },
     _raw:
      ClientRequest {
        domain: null,
        _events: [Object],
        _eventsCount: 3,
        _maxListeners: undefined,
        output: [],
        outputEncodings: [],
        outputCallbacks: [],
        outputSize: 0,
        writable: true,
        _last: true,
        upgrading: false,
        chunkedEncoding: false,
        shouldKeepAlive: false,
        useChunkedEncodingByDefault: false,
        sendDate: false,
        _removedConnection: false,
        _removedContLen: false,
        _removedTE: false,
        _contentLength: null,
        _hasBody: true,
        _trailer: '',
        finished: true,
        _headerSent: true,
        socket: [Object],
        connection: [Object],
        _header: 'GET /jira/rest/api/2/board/1149/version HTTP/1.1\r\nContent-Type: application/json\r\nAccept: */*\r\nUser-Agent: Popsicle (https://github.com/blakeembrey/popsicle)\r\nContent-Length: 2\r\nAuthorization: Basic anVsaWVuLnZleXJhdEByaWNoZW1vbnQuY29tOkQ3
M01OUCQx\r\nAccept-Encoding: gzip,deflate\r\nHost: agile.toto.com\r\nConnection: close\r\n\r\n',
        _onPendingData: [Function: noopPendingOutput],
        agent: [Object],
        socketPath: undefined,
        timeout: undefined,
        method: 'GET',
        path: '/jira/rest/api/2/board/1149/version',
        _ended: true,
        res: [Object],
        aborted: undefined,
        timeoutCb: null,
        upgradeOrConnect: false,
        parser: null,
        maxHeadersCount: null,
        [Symbol(outHeadersKey)]: [Object] },
     uploadLength: 2,
     uploadedBytes: 2,
     downloadLength: null,
     downloadedBytes: 197 } }
Started
FTypeError: body.findIndex is not a function
    at popsicle.request.use.then (C:\Workspace\test-ccp-protractor\node_modules\protractor-zephyr-reporter\src\zephyr-service.js:118:36)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

Do you have any idea where this comes from?

@lukas-reineke sorry about the wall of text for the error message. You should put it onto a JSON formatter to have a better view.

lukas-reineke commented 6 years ago

Please watch out that you don't post your Authorization headers next time.

Your Jira endpoint is returning XML. Which probably means you are not reaching the Jira server. Maybe check your Proxy settings. Try calling the endpoint with curl to see what you get back.

This is a problem with your network, so I can't really help you, but if you have any questions feel free to ask.

Jveyrat commented 6 years ago

Thanks for your fast return! After checking, I am indeed behind a corporate proxy. Is there any way to set some proxy settings inside the conf.js file or any tuto to make this plugin work behind a corporate proxy?

lukas-reineke commented 6 years ago

You should be able to set a proxy in your npm config. I think the reporter should just use it as well then... not sure though

npm config set proxy http://proxy.url.com:8080
npm config set https-proxy http://proxy.url.com:8080

or create a file in your home / project directory called .npmrc and add

proxy=http://proxy.url.com:8080
https-proxy=http://proxy.url.com:8080
Jveyrat commented 6 years ago

Thanks a lot, I will keep you update on any progress!

lukas-reineke commented 5 years ago

Hey @Antracot , you'll need to give me a bit more information what response did you get?