You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a normal SuperTest test one can save out the response to perform later assertions on or save the data for more complicated tests. When I try that it appears the response comes back as a @nightwatch_element instead so it doesn't appear that it is possible. Could that be added?
module.exports={'can do a test': ({ supertest })=>{constresponse=supertest.request('https://petstore.swagger.io/v2').get('/store/inventory/').expect(200).expect('Content-Type',/json/).end(()=>{});expect(response.status).to.equal(200);},};
┌ ────────────────── × default: petStore.js ───────────────────────────────────────────────────────────────────────────────────┐
│ │
│ │
│ [Pet Store] Test Suite │
│ ──────────────────────────────────────────── │
│ – can do a test │
│ ✖ TypeError │
│ Cannot read properties of undefined (reading '@nightwatch_element') │
│ │
│ Error location: │
│ C:\Projects\nightwatchTutorials\apiTesting\test\petStore.js: │
│ ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– │
│ 8 |.end(() => {}); │
│ 9 | │
│ 10 | expect(response.status).to.equal(200); │
│ 11 | }, │
│ 12 | }; │
│ ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– │
│ │
│ Stack Trace : │
│ at NightwatchAPI.expect (C:\Users\Mr\AppData\Roaming\npm\node_modules\nightwatch\lib\api\_loaders\static.js:233:62) │
│ at globalExpect (C:\Users\Mr\AppData\Roaming\npm\node_modules\nightwatch\lib\testsuite\index.js:311:29) │
│ at Object.can do a test (C:\Projects\nightwatchTutorials\apiTesting\test\petStore.js:10:5) │
│ at Context.call (C:\Users\Mr\AppData\Roaming\npm\node_modules\nightwatch\lib\testsuite\context.js:476:35) │
│ at TestCase.run (C:\Users\Mr\AppData\Roaming\npm\node_modules\nightwatch\lib\testsuite\testcase.js:58:31) │
│ at Runnable.__runFn (C:\Users\Mr\AppData\Roaming\npm\node_modules\nightwatch\lib\testsuite\index.js:745:80) │
│ at Runnable.run (C:\Users\Mr\AppData\Roaming\npm\node_modules\nightwatch\lib\testsuite\runnable.js:126:21) │
│ at TestSuite.executeRunnable (C:\Users\Mr\AppData\Roaming\npm\node_modules\nightwatch\lib\testsuite\index.js:898:49) │
│ at TestSuite.handleRunnable (C:\Users\Mr\AppData\Roaming\npm\node_modules\nightwatch\lib\testsuite\index.js:913:33) │
│ at C:\Users\Mr\AppData\Roaming\npm\node_modules\nightwatch\lib\testsuite\index.js:745:21 │
│ │
│ × default: petStore.js [Pet Store] can do a test (78ms) │
│ Cannot read properties of undefined (reading '@nightwatch_element') │
│ TypeError: Cannot read properties of undefined (reading '@nightwatch_element') │
│ at Object.can do a test (C:\Projects\nightwatchTutorials\apiTesting\test\petStore.js:10:5) │
│ √ Passed [ok]: .get('/store/inventory/').expect(200) ok │
│ √ Passed [ok]: .get('/store/inventory/').expect('Content-Type', /json/) ok │
│ │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
The text was updated successfully, but these errors were encountered:
In a normal SuperTest test one can save out the response to perform later assertions on or save the data for more complicated tests. When I try that it appears the response comes back as a @nightwatch_element instead so it doesn't appear that it is possible. Could that be added?
The text was updated successfully, but these errors were encountered: