Closed andrejsmogrovic closed 2 years ago
Thanks @andrejsmogrovic, would you mind posting the stack trace too please?
Does the plugin work outside of cypress for you?
Yes, It works outside the cypress framework (chai + mocha).
Inside cypress, It looks like the fs.read has problems with the plugin itself. After import, it fails.
I also tried to Load the OpenAPI object inside the code. (defined in the readme.md file, point 2.From an object). But with the same result.
Stack Trace:
at patch ([node_modules/graceful-fs/polyfills.js:141:1](http://localhost:64488/__/#))
at patch ([node_modules/graceful-fs/graceful-fs.js:104:1](http://localhost:64488/__/#))
at [155]</ ([node_modules/graceful-fs/graceful-fs.js:96:1](http://localhost:64488/__/#))
at [155] (http://localhost:64488/__cypress/tests?p=cypress/support/index.js:22864:5)
at [155]< (http://localhost:64488/__cypress/tests?p=cypress/support/index.js:22864:18)
at o ([node_modules/browser-pack/_prelude.js:1:1](http://localhost:64488/__/#))
at o ([node_modules/browser-pack/_prelude.js:1:1](http://localhost:64488/__/#))
at [135]< ([node_modules/fs-extra/lib/fs/index.js:5:1](http://localhost:64488/__/#))
at o ([node_modules/browser-pack/_prelude.js:1:1](http://localhost:64488/__/#))
at o ([node_modules/browser-pack/_prelude.js:1:1](http://localhost:64488/__/#))
at [136]< ([node_modules/fs-extra/lib/index.js:5:1](http://localhost:64488/__/#))
at o ([node_modules/browser-pack/_prelude.js:1:1](http://localhost:64488/__/#))
at o ([node_modules/browser-pack/_prelude.js:1:1](http://localhost:64488/__/#))
at [181]< ([node_modules/openapi-validator/dist/openApiSpecFactory.js:6:1](http://localhost:64488/__/#))
at o ([node_modules/browser-pack/_prelude.js:1:1](http://localhost:64488/__/#))
at o ([node_modules/browser-pack/_prelude.js:1:1](http://localhost:64488/__/#))
at [180]< ([node_modules/openapi-validator/dist/index.js:9:1](http://localhost:64488/__/#))
at o ([node_modules/browser-pack/_prelude.js:1:1](http://localhost:64488/__/#))
at o ([node_modules/browser-pack/_prelude.js:1:1](http://localhost:64488/__/#))
at [82]< ([node_modules/chai-openapi-response-validator/dist/index.js:6:1](http://localhost:64488/__/#))
at o ([node_modules/browser-pack/_prelude.js:1:1](http://localhost:64488/__/#))
at o ([node_modules/browser-pack/_prelude.js:1:1](http://localhost:64488/__/#))
at [2]< ([cypress/support/index.js:47:40](http://localhost:64488/__/#))
at o ([node_modules/browser-pack/_prelude.js:1:1](http://localhost:64488/__/#))
at r ([node_modules/browser-pack/_prelude.js:1:1](http://localhost:64488/__/#))
at ([node_modules/browser-pack/_prelude.js:1:1](http://localhost:64488/__/#))
at ../driver/src/cypress/script_utils.ts/evalScripts (http://localhost:64488/__cypress/runner/cypress_runner.js:180864:17)
at arrayEach (http://localhost:64488/__cypress/runner/cypress_runner.js:41318:20)
at forEach (http://localhost:64488/__cypress/runner/cypress_runner.js:50198:15)
at evalScripts (http://localhost:64488/__cypress/runner/cypress_runner.js:180863:50)
at ../driver/src/cypress/script_utils.ts/runScriptsFromUrls (http://localhost:64488/__cypress/runner/cypress_runner.js:180871:164)
From previous event:
at runScriptsFromUrls (http://localhost:64488/__cypress/runner/cypress_runner.js:180871:137)
at runScripts (http://localhost:64488/__cypress/runner/cypress_runner.js:180886:13)
at onSpecWindow (http://localhost:64488/__cypress/runner/cypress_runner.js:169570:77)
at (http://localhost:64488/__cypress/iframes/integration%2FR_API%2FAPI.feature:16:25)
at (http://localhost:64488/__cypress/iframes/integration%2FR_API%2FAPI.feature:17:10)```
@rwalle61 I have resolved the issue, and the plugin is working fine with the cypress framework.
I have loaded the library via node, and created the task in the cypress. (Pure JavaScript).
Then, I have parsed cy.request response, and build a new one, so it looks like axios object.
After adding the plugin to the cypress:
const chai = require('chai') const chaiResponseValidator = require('chai-openapi-response-validator'); chai.use(chaiResponseValidator('data.json'));
I got an error: