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

Allure libraries are not working with cypress 12.15.0 #27113

Closed
BarbaraGodayol opened this issue Jun 22, 2023 · 129 comments
Closed

Allure libraries are not working with cypress 12.15.0 #27113

BarbaraGodayol opened this issue Jun 22, 2023 · 129 comments

Comments

@BarbaraGodayol
Copy link

BarbaraGodayol commented Jun 22, 2023

Current behavior

Currently, when you are using the library "@shelex/cypress-allure-plugin" and configurating cypress with the property "allure = true", at the end of cypress execution, the folder allure-results is not created.
In the previous versions, the folder was created with all the data

Desired behavior

In this situacion, cypress has to create a folder "allure-results" with all the data to can be used for other tools to create the real report.

Test code to reproduce

cypress.config.ts:

import setupNodeEvents from './setupNodeEvents';

const dotenv = require('dotenv');
const env = process.env.NODE_ENV?.trim() ?? 'docker';

dotenv.config({ path: `./environment/.env.${env}` });

export default defineConfig({
  e2e: {
    retries: {
      runMode: 0,
      openMode: 0,
    },
    env: {
      api_baseEndpoint: process.env.API_BASE_ENDPOINT,
      web_baseUrl: process.env.WEB_BASE_URL,
      api_password: process.env.API_PASSWORD,
      api_client_secret: process.env.API_CLIENT_SECRET,
      platform_environment: process.env.PLATFORM_ENVIRONMENT,
      db: {
        user: process.env.DB_USER,
        password: process.env.DB_PASSWORD,
        host: process.env.DB_HOST,
        server: process.env.DB_SERVER,
        database: process.env.DB_DATABASE,
        port: process.env.DB_PORT,
        ssl: process.env.DB_SSL
      },
      allure: true,
      allureResultsPath: "allure-results",
      allureReuseAfterSpec: true,
      allureAttachRequests: true,
      allureClearSkippedTests: false,
      allureAddVideoOnPass: false,
      ServiceKey: '#my*S3cr3t'
    },
    specPattern: '**/*.feature',
    chromeWebSecurity: false,
    video: false,
    screenshotOnRunFailure: true,
    defaultCommandTimeout: 8000,
    viewportWidth: 1920,
    viewportHeight: 1080,
    setupNodeEvents
  }
});

Cypress Version

12.15.0

Node version

v18.15.0

Operating System

windows

Debug Logs

No response

Other

No response

@mike-plummer
Copy link
Contributor

Hi @BarbaraGodayol , sorry that you're having trouble. We'll need more information in order to help with this issue:

  1. Are you saying your project using @shelex/cypress-allure-plugin worked on an older version of Cypress and no longer works on upgrading to v12.15.0? Or are you having trouble getting the addon working on a new project using 12.15.0?
  2. Are there any errors reported in the Cypress runner or terminal window? We will need the Debug Logs from your run to diagnose the issue.
  3. Can you provide a reproducible example we can use to troubleshoot? A git repo we can clone and run is preferred over copy-pasted code.

@sl-tawfiknouri
Copy link

Hi,
I had the same problem with the latest Cypress version 12.15.0.
The same project works well with version 12.14.0 and Cypress doesn't report any errors.
It seems the latest version has a problem with the Allure report and also doesn't seem to be able to create screenshots and videos automatically.

@mike-plummer
Copy link
Contributor

Thanks for the context @sl-tawfiknouri ! There is a known issue with 12.15.0 that we're looking into that may be causing issues under the covers, so it sounds like a temporary workaround for this is to downgrade to 12.14.0

@BarbaraGodayol
Copy link
Author

Hello @mike-plummer,
Like sl-tawfiknouri said, cypress is working well in 12.14.0 and about logs, I don' see any error log related with allure

@JessefSpecialisterren
Copy link

@mike-plummer Sadly, Cypress 12.16.0 does not seem to fix this issue. Still no folder allure-results after a test run. Downgrading to Cypress 12.14.0 while otherwise keeping the exact same configuration and environment makes things work as expected again

@mike-plummer
Copy link
Contributor

Hi @JessefSpecialisterren , sorry you're still having issues. We addressed an issue that was causing this error in 12.16.0 but it appears you've identified one or more edge cases we missed. Are you able to share a reproduction case we can use to troubleshoot?

@samixchoumi
Copy link

samixchoumi commented Jun 28, 2023

Hello @mike-plummer just use "@shelex/cypress-allure-plugin": "2.40.0" and "cypress": "12.15.0" or "cypress": "12.16.0" on your package.json project.

The allure-result folder will not be created. Reproduced on a lot of our project (using API testing or UI testing) / (typescript or javascript).

You can see below one of our project failing after upgrading cypress to 12.15/16 version :

"devDependencies": {
    "@badeball/cypress-cucumber-preprocessor": "^18.0.1",
    "@bahmutov/cypress-esbuild-preprocessor": "^2.2.0",
    "@faker-js/faker": "^8.0.2",
    "@shelex/cypress-allure-plugin": "^2.40.0",
    "cypress": "12.16.0",
    "cypress-cloud": "^1.7.4",
    "cypress-multi-reporters": "^1.6.3",
    "cypress-real-events": "^1.8.1",
    "cypress-recurse": "^1.35.2",
    "cypress-slack-reporter": "^1.5.3",
    "esbuild": "^0.18.10",
    "eslint": "^8.42.0",
    "eslint-plugin-cypress": "^2.13.3",
    "fs-extra": "^11.1.1",
    "mocha": "^10.2.0",
    "mochawesome": "^7.1.3",
    "mochawesome-merge": "^4.3.0",
    "mochawesome-report-generator": "^6.2.0",
    "typescript": "^5.1.3"
  },

In our case we switched to cypress-cloud run instead of cypress run command, but it seem to fail when using cypress run command too.

@mike-plummer
Copy link
Contributor

@mike-plummer
Copy link
Contributor

@BarbaraGodayol @JessefSpecialisterren @samixchoumi I have replicated your problem in the latest version of Cypress and will forward this ticket to the appropriate team. They will soon evaluate the priority of this ticket and consider their capacity to pick it up. Please note that this does not guarantee that this issue will be resolved. The ticket will indicate status changes during evaluation, so we ask that you please refrain from asking for updates. Thanks!

@mike-plummer mike-plummer added E2E Issue related to end-to-end testing Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. labels Jun 28, 2023
@casalribeiro
Copy link

Do you have any news on this issue?
We're still on v12.14.0 for now.

@mysticdevx
Copy link

Hi @JessefSpecialisterren , sorry you're still having issues. We addressed an issue that was causing this error in 12.16.0 but it appears you've identified one or more edge cases we missed. Are you able to share a reproduction case we can use to troubleshoot?

Hi,
I have upgraded to v12.17.0 with "@shelex/cypress-allure-plugin": "^2.40.0" and still the problem exists.

@dilshan-swivel
Copy link

Done quick test on Cypress version 12.17.1 and @shelex/cypress-allure-plugin: 2.40.0 , Still it is broken

@stefan-cooper
Copy link

Checked on 12.17.2 and this issue still persists. Sticking with 12.14.0 for now

@Deop
Copy link

Deop commented Jul 27, 2023

Having the same issue, latest working version is 12.14.0. Checked with 12.17.2 and it's not working for me as well.

@samixchoumi
Copy link

Having the same issue for 12.17.3. Any news about it @mike-plummer ?

@mike-plummer
Copy link
Contributor

@samixchoumi Unfortunately we are a very small team and can't address every issue immediately. We are always happy to receive contributions from the community if someone is interested in investigating and resolving this issue - see the Contributing Guide for info on setup and process.

The ticket will indicate status changes during evaluation, so we ask that you please refrain from asking for updates. Thanks!

@AlexandreTI-AUT
Copy link

AlexandreTI-AUT commented Aug 8, 2023

Having the same issue for 12.17.3

@danfooks
Copy link

danfooks commented Aug 8, 2023

I am experiencing the same issue. I downgraded Cypress to 11.0.0 to get Allure reports generating again. I am running 2.40.0 of cypress-allure-plugin.

@FerrazLeandro
Copy link

Tendo o mesmo problema para Cypress 12.17.3 e "@shelex/cypress-allure-plugin": "^2.40.0",

@Rida55
Copy link

Rida55 commented Aug 15, 2023

Okay, this isn't the exact solution, but it's a workaround.Downgrade your Cypress to version "cypress": "^11.0.0" or "cypress": "^12.14.0" by executing
'npm install cypress@11.0.0' OR npm install cypress@^12.14.0
along with the "@shelex/cypress-allure-plugin": "^2.40.0".

@amaanbs
Copy link

amaanbs commented Aug 18, 2023

@mike-plummer Any updates on a fix here? I created a plugin for one of our internal projects & that has been failing since 12.15 (it was working up until version 12.14).
I implemented certain event listeners in my support file to listen to cypress command executions wherein I would execute cy.now('task', 'xyz') & I would then listen to this xyz event inside my plugin under setupNodeEvents. This flow doesn't work with Cypress >= v12.15. Posting this here since both Allure & ReportPortal plugins have similar implementations & both seem to be broken since Cypress v12.15.
Would appreciate a response. Thanks!

@mike-plummer
Copy link
Contributor

@amaanbs This has not yet been prioritized to be worked by the Cypress team - we would welcome anyone from the community who is interested in taking a look. Information to get started is available in our Contributing Guide.

We ask that everyone please refrain from asking for updates - this GitHub issue will reflect status whenever there are updates to share.

@mike-plummer mike-plummer removed their assignment Aug 18, 2023
@jeremie-val
Copy link

Also waiting here for a fix to upgrade Cypress

@lmiller1990
Copy link
Contributor

lmiller1990 commented Aug 23, 2023

Cy 12.14 and 12.15 diff, only a handful of commits, should not be hard to at least find out what broke: v12.14.0...v12.15.0

Any error, what's actually "broken" - that would help figure out which commit(s) broke it.

@JessefSpecialisterren
Copy link

@lmiller1990 I already did some investigating a while ago and I'm pretty sure 89f0fb6 is the culprit. cypress-allure-plugin uses cy.now('task' to send report data from the browser to Node, which stopped working after those extra security measures were implemented

We've switched to mochawesome reporting for our project, by the way. The report isn't as good, but at least it works with newer Cypress versions

@AhmadfBaker
Copy link

OK great, Is there any configuration should be Done from cypress settings, or it's from the CI itself?
Could you send me your Email please?

@AhmadfBaker Could we please proceed discussion here https://github.com/mmisty/cypress-allure-adapter/discussions/categories/q-a if necessary Regarding configuration on CI side it should be the same as for any other allure plugin, nothing special. In cypress config you should define two env variables: 'allureResults' and 'allureResultsWatchPath'. I advise to set 'allureResults' to 'allure-results' and 'allureResultsWatchPath' to 'allure-results/watch'. And define in your CI that folder with results is 'allure-results/watch'

Thanks @mmisty

@Israel-QA
Copy link

Error on version ^13.4.0 still persist.

@thomasKuntermannDiva-e
Copy link

thomasKuntermannDiva-e commented Nov 10, 2023

I could fully restore functionality with v0.15.1 https://github.com/mmisty/cypress-allure-adapter
Thx @mmisty !

with this plugin (replaces Shelex plugin) you need to adjust your cypress.config.ts env variable "allureResultsPath" -> "allureResults" and make the other adjustments, that have been mentioned multiple times in older comments from this thread.

UPDATE: Firefox test-execution does not work with mmisty's version 0.15.2. But as Chrome is our leading browser, we can currently live with that.

@mariamaslam
Copy link

Is anyone using this with Cypress Type? The reports are null and it is not working for me.

@occasum13
Copy link

occasum13 commented Nov 14, 2023

Hi, I've stumbled upon this problem regarding version before and I've find a workaround with Cypress@12.14.0, also I've found a solution for an automated pipeline CI/CD workflow with GCP and slack webhook integration so everyday our tests run at X time, upload it to our company gcp bucket and notifies slack with some usefull information, the link to the report and which test cases failed as a preview (there's even a flake logic if anyone needs it, that works when a test has a flake in the end of its title). The example is public in my profile as Cypress-Allure-Example(https://github.com/occasum13/cypress-allure-example), feel free to take a look y'all! :)

obs: remove the '^' from package.json cypress dependency so your cypress version won't update.

Any doubts feel free to contact me at my linkedin: https://www.linkedin.com/in/joaogayer98/

@JAVA-NOVACHOK
Copy link

JAVA-NOVACHOK commented Dec 5, 2023

No i just remove the allure-command line as suggested solution, but that didin't work.
Do you mean to install this one @mmisty/cypress-allure-adapter and remove the old plugin ? or just to add this plugin?

@AhmadfBaker
If you have cypress version > 12.15 then shelex's plugin is not going to work with it. You have options: downgrade cypress version or you can install @mmisty/cypress-allure-adapter plugin.
If you need more information you can start from reading this thread carefully (there are lots of tips)

Yes I know that it will not work after 12.15, but even with your plugin it didn't work, still the allure results empty.

Here is my package.json

"devDependencies": { "@cypress/grep": "^4.0.0", "cypress": "^13.4.0", "cypress-file-upload": "^5.0.8", "mocha-allure-reporter": "^1.4.0", "mochawesome": "^7.0.1", "mochawesome-merge": "^4.1.0", "mochawesome-report-generator": "^6.0.1", "typescript": "^5.1.6" }, "dependencies": { "@mmisty/cypress-allure-adapter": "^0.13.0", "cypress-plugin-api": "^2.11.1", "exceljs": "^4.4.0", "xlsx": "^0.18.5" } }

@AhmadfBaker Hello. I have a question. You mentioned that allure-results folder was empty. But you didn`t reveal how you fixed it. I have this folder empty as well. If it is possible could you explain?

@nenadbjelica
Copy link

@mmisty please I need your help!

I am using latest cypress version: 13.6.4 with typescript.
Installed @mmisty/cypress-allure-adapter fallowing this link https://www.npmjs.com/package/@mmisty/cypress-allure-adapter
After setting up everything and running tests got exception:

The following error originated from your test code, not from Cypress.
> global is not defined
When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.
Cypress could not associate this error to any specific test.

We dynamically generated a new test to display this failure.
../../../../../../../../../../Desktop/Cypress/myTellcoCypressAut/node_modules/@mmisty/cypress-tags/setup/index.js:120:5
118 | });
119 | };

120 | global.describe = describeWithTags;
| ^
121 | global.describe.only = originals.originOnly;
122 | global.describe.skip = originals.originSkip;
123 | global.it = itWithTags;

It comes from import '@mmisty/cypress-allure-adapter/support'; which is in e2e.ts file

@mmisty
Copy link

mmisty commented Feb 9, 2024

@nenadbjelica hello, could you please check this out and apply what is suggested there

If the issue still persist could you please open issue here and add details like

  • cypress.config.ts
  • package.json
  • e2e.ts
  • env variables file (if you are using one)

@mysticdevx
Copy link

@mmisty please I need your help!

I am using latest cypress version: 13.6.4 with typescript. Installed @mmisty/cypress-allure-adapter fallowing this link https://www.npmjs.com/package/@mmisty/cypress-allure-adapter After setting up everything and running tests got exception:

The following error originated from your test code, not from Cypress. > global is not defined When Cypress detects uncaught errors originating from your test code it will automatically fail the current test. Cypress could not associate this error to any specific test.

We dynamically generated a new test to display this failure. ../../../../../../../../../../Desktop/Cypress/myTellcoCypressAut/node_modules/@mmisty/cypress-tags/setup/index.js:120:5 118 | }); 119 | };

120 | global.describe = describeWithTags;
| ^
121 | global.describe.only = originals.originOnly;
122 | global.describe.skip = originals.originSkip;
123 | global.it = itWithTags;

It comes from import '@mmisty/cypress-allure-adapter/support'; which is in e2e.ts file

hey @nenadbjelica
please add define: { global: "window" } to setupnodeevents object in your cypress config file.

@nenadbjelica
Copy link

nenadbjelica commented Feb 9, 2024

Hi @mysticdevx, thank you so much, it works:
const bundler = createBundler({ sourcemap: 'inline', define: { global: 'window' } });

@felipealmeidaacct
Copy link

Hello, @mmisty ! When I try to run Cypress the error below appears. I read the comments to see if anyone else had this situation, but I couldn't find one! Tanks!
2024-02-20_22-58

My cypress.config.js looks like this:
const { defineConfig } = require('cypress')
const { configureAllureAdapterPlugins } = require("@mmisty/cypress-allure-adapter/plugins")

module.exports = defineConfig({
viewportWidth: 1920,
viewportHeight: 1080,
chromeWebSecurity: false,
video: true,
videoCompression: false,
videoUploadOnPasses: true,
defaultCommandTimeout: 50000,
pageLoadTimeout: 180000,
requestTimeout: 15000,
retries: {
runMode: 2,
openMode: 0,
},
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
configureAllureAdapterPlugins(on, config);
//return require('./cypress/plugins/index.js')(on, config);
return config;
},
env: {
allure: true
},

@mmisty
Copy link

mmisty commented Feb 21, 2024

@felipealmeidaacct hi! could you please check whether you have properly installed the plugin. (delete node-modules and install by 'npm i @mmisty/cypress-allure-adapter --save-dev' or yarn if you use yarn pm.

If the problem persists could you please create issue in github for @mmisty/cypress-allure-adapter plugin and attach all the details: setup config, cypress.config, package.json

@baev
Copy link

baev commented Mar 8, 2024

We are excited to announce the official integration of Allure with Cypress! You can find the Allure-Cypress package at npm; detailed documentation is available on the Allure website.

We encourage everyone to try out this new integration. Should you encounter any issues or have feedback, please don't hesitate to share your thoughts in the discussions section on our GitHub organisation.

For those interested in the source code, it resides in the allure-js monorepo.

@mike-plummer, you can proceed to close the issue at your convenience.

@mysticdevx
Copy link

We are excited to announce the official integration of Allure with Cypress! You can find the Allure-Cypress package at npm; detailed documentation is available on the Allure website.

We encourage everyone to try out this new integration. Should you encounter any issues or have feedback, please don't hesitate to share your thoughts in the discussions section on our GitHub organisation.

For those interested in the source code, it resides in the allure-js monorepo.

@mike-plummer, you can proceed to close the issue at your convenience.

He @baev great news indeed! will there be a support for cypress with cucumber preprocessor?

@mike-plummer
Copy link
Contributor

@baev Fabulous, thanks for the awesome integration!

Anyone landing on this issue in the future is encouraged to upgrade to the latest version of Cypress and consider using the official integration provided by Allure (above).

@PieterGrobler
Copy link

PieterGrobler commented Apr 2, 2024

@baev Fabulous, thanks for the awesome integration!

Anyone landing on this issue in the future is encouraged to upgrade to the latest version of Cypress and consider using the official integration provided by Allure (above).

Thanks. allure-cypress works with the latest version of Cypress, BUT unfortunately you lose the automatic annotation of each test step which you got from cypress-allure-plugin (allureLogCypress). This means your test execution in the report is empty and you have to manually add your own step annotations to the tests.

@epszaw
Copy link

epszaw commented Apr 3, 2024

@PieterGrobler could you give an example of the annotation?

@jennifer-shehane jennifer-shehane removed E2E Issue related to end-to-end testing Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. labels Apr 3, 2024
@PieterGrobler
Copy link

PieterGrobler commented Apr 3, 2024

@PieterGrobler could you give an example of the annotation?

Example test (with no step annotations added):
`

it('Health Check - API Status Check - Clients', () => {
    const url = new Utility().getBaseUrl()
    cy.getBaseUrlKey(url, testData.mfptool_key, testData.bearerToken, testData.Broker_Code, testData.Broker_House)
        .then((res) => {
            const domain = url.replace('https://', '')
        cy.getCookie('jwt_key', {domain: domain}).then((cookie) => {
                let jwt_key = cookie.value

                cy.request({
                    method: 'POST',
                    url: (url + '/someUrl/'),
                    headers: {
                        'Authorization': "Bearer " + jwt_key,
                        'Content-Type': "application/json"
                    },
                    retryOnStatusCodeFailure: true
                }).then((response) => {
                    expect(response.status).to.eq(200)
                    expect(response.body.countTotal).to.be.greaterThan(0)
                    expect(response.body.clientList).to.have.lengthOf(10)
                    expect(response.body.clientList[0].clientId).to.not.be.empty
                    expect(response.body.clientList[0].clientName).to.not.be.empty
    
                    })
            })
        
        
    })

})`

Report generated with cypress-allure-plugin with step annotations:
image

@raghav-accredible
Copy link

Hi @baev Can you please confirm if there will be a support for cypress with cucumber preprocessor?

@baev
Copy link

baev commented Apr 4, 2024

Can you please confirm if there will be a support for cypress with cucumber preprocessor?

Yes, definitely. Please follow https://github.com/orgs/allure-framework/discussions/2409

@baev
Copy link

baev commented Apr 4, 2024

@PieterGrobler and others, please use our [Github Discussions] (https://github.com/orgs/allure-framework/discussions/new?category=questions-support) for all the questions. Our team reviews all the requests daily. I'm not sure it works to disturb 50 participants by asking questions here.

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