2.28.1 - cy.allure().writeEnvironmentInfo() no longer generates widgets/environment.json
monkpit opened this issue Β· comments
When I upgrade to versions of cypress-allure-plugin
higher than 2.28.0, my unit tests fail because widgets/environment.json
has empty array as contents, instead of the expected contents. I am generating this using cy.allure().writeEnvironmentInfo()
.
Cypress version: 9.7.0
Node version: 16.17.1
cypress-allure-plugin version: >=2.28.1 all seem to have this issue
OS: Mac 12.6 Monterey
To Reproduce
Steps to reproduce the behavior:
- Install the above versions
- Write an environment file using
cy.allure().writeEnvironmentInfo({ foo: 'bar' })
- Open the report - the environment area is blank.
- Open cypress/reports/widgets/environment.json - the contents are an empty array.
Expected behavior
The Allure report should contain Environment info as it did before 2.28.1.
Hi @monkpit
Thank you for opening an issue.
Yeah, that part of plugin with environment.properties file was ambiguous so I have refactored writeEnvironmentInfo
implementation and handling and for now I am sure it is writing env data properly.
However, you mention that problem started in v2.28.1. Only difference with v2.28.0 is with using cypress projectRoot
to define allure-results
path. The logic is simple - we take project root and concatenate it with allureResultsPath
to get proper absolute path to this folder.
I am not able to reproduce it, was using:
- cypress v9.7.0
- node v16.14.2
- cypress-allure-plugin v2.33.0
- OS Macos v12.6
So I assume you may have some custom allureResultsPath
or some different cypress project setup.
So please correct me if I got it wrong:
Structure:
- project
- cypress
- testCypressApp
- cypress
- allure-results
- cypress.json
- cypress.json
In such case, allureResultsPath
is not needed as it will write to project/testCypressApp/allure-results
, because:
- previously it was saving
allure-results
to folder relative tocwd
where you run it - now it saves it relative to
projectRoot
from Cypress (as it may differ from cwd)
Could you please provide some examples, at least some schematic details, because I am not sure I have understood that setup.
Also, you can try DEBUG=allure-plugin* npx cypress run
to check where it writes allure-results
files.
Cypress version: 10.9.0
@badeball/cypress-cucumber-preprocessor: 13.0.3 (latest)
cypress-allure-plugin: 2.33.1
node: 14.17.3
Hi,
I have upgraded to v2.33.1 but still the environment.json file returns as an empty array when report is prepared. I can see xxxx.results.json
and yyyy.container.json
files in the/allure-results
path. However envorimnet.json is missing.
I get error while writing allure results: ReferenceError: filePath is not defined
error.
I have tried both wit and without defining the allureResultsPath
configuration, both were unsuccessful. You can see Debug logs:
allure-plugin:writer starting writing allure results to "/Users/xxxxx/WebstormProjects/yyyyy-ui/packages/zzzzz-ui/allure-results" +8s
allure-plugin:writer write suite "Help Panel" to file "19455105-477c-463e-9b65-dba705c7a2b3-container.json" +1ms
allure-plugin:writer write test "User navigates to Help panel" to file "756c7ff7-0f8f-455b-af04-dfe1b44d19d4-result.json" +1ms
allure-plugin:writer removing empty step ""after each" hook" from test "756c7ff7-0f8f-455b-af04-dfe1b44d19d4" +1ms
allure-plugin:writer write file "/Users/xxxxx/WebstormProjects/yyyyy-ui/packages/zzzzz-ui/allure-results/categories.json" +0ms
error while writing allure results: ReferenceError: filePath is not defined allure-plugin:writer failed to write allure results: ReferenceError: filePath is not defined
allure-plugin:writer at writeInfoFile (/Users/xxxxx/WebstormProjects/zzzzz-ui/node_modules/@shelex/cypress-allure-plugin/writer/writeInfoFiles.js:10:20)
allure-plugin:writer at writeAllureResults (/Users/xxxxx/WebstormProjects/zzzzz-ui/node_modules/@shelex/cypress-allure-plugin/writer.js:227:17)
allure-plugin:writer at invoke (/Users/xxxxx/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_plugins.js:256:16)
allure-plugin:writer at /Users/xxxxx/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/util.js:59:14
allure-plugin:writer at tryCatcher (/Users/xxxxx/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
allure-plugin:writer at Function.Promise.attempt.Promise.try (/Users/xxxxx/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/method.js:39:29)
allure-plugin:writer at Object.wrapChildPromise (/Users/xxxxxxx/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/util.js:58:23)
allure-plugin:writer at RunPlugins.taskExecute (/Users/xxxxxx/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_plugins.js:262:10)
allure-plugin:writer at RunPlugins.execute (/Users/xxxxxx/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_plugins.js:182:21)
allure-plugin:writer at EventEmitter.<anonymous> (/Users/xxxxxx/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_plugins.js:279:12)
allure-plugin:writer at EventEmitter.emit (events.js:375:28)
allure-plugin:writer at EventEmitter.emit (domain.js:470:12)
allure-plugin:writer at process.<anonymous> (/Users/xxxxxx/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/util.js:33:22)
allure-plugin:writer at process.emit (events.js:387:35)
allure-plugin:writer at process.emit (domain.js:470:12)
allure-plugin:writer at process.emit.sharedData.processEmitHook.installedValue [as emit] (/Users/xxxxxx/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/node_modules/@cspotcode/source-map-support/source-map-support.js:745:40)
allure-plugin:writer at emit (internal/child_process.js:910:12)
allure-plugin:writer at processTicksAndRejections (internal/process/task_queues.js:83:21) +0ms
allure-plugin:writer got "after:spec" process message +7ms
allure-plugin:writer processing "after:spec" results +1ms
allure-plugin:writer going to check attachments for "756c7ff7-0f8f-455b-af04-dfe1b44d19d4" +0ms
allure-plugin:writer video will not be attached +0ms
π This issue has been resolved in version 2.33.2 π
The release is available on:
Your semantic-release bot π¦π