Closed natalyayyad closed 5 months ago
@natalyayyad hello! Thank you for reporting! this seems like a bug, but for reproduction and fixes I need more information, could you please provide:
does it reproduce with any test in your project?
Could you please add if it is possible:
Thank you!
Hello,
1. Here's cypress.config.ts file:
`import { defineConfig } from 'cypress';
// Import the path module const path = require('path'); const fsExtra = require('fs-extra'); import { configureAllureAdapterPlugins } from '@mmisty/cypress-allure-adapter/plugins';
const { verifyDownloadTasks } = require('cy-verify-downloads');
function getConfigurationFileByVersion(file: string) {
// Normalization of the absolute paths
const pathToConfigFile = path.resolve(
'./cypress/common/config/',
${file}.json
);
return fsExtra.readJson(pathToConfigFile);
}
module.exports = defineConfig({ e2e: { env: { allure: true, allureResults: 'allure-results', allureAttachRequests: true, allureLogCyCommands: true, allureShowDuplicateWarn: true, allureShowTagsInTitle: true, download_dir: './cypress/downloads', grepOmitFiltered: true, }, reporter: '../node_modules/mochawesome', reporterOptions: { mochaFile: 'cypress-results/cypress-report.xml', reportDir: 'cypress/results/mochawesome', overwrite: false, html: false, json: true, toConsole: true, }, chromeWebSecurity: false, screenshotsFolder: 'cypress/screenshots', video: false, videosFolder: 'allure-results/', screenshotOnRunFailure: true, retries: { runMode: 1, openMode: 0, }, viewportWidth: 1680, viewportHeight: 1050, specPattern: ['cypress/e2e/*/.spec.ts'], fixturesFolder: './cypress/fixtures', experimentalWebKitSupport: true, experimentalRunAllSpecs: true, experimentalMemoryManagement: true, numTestsKeptInMemory: 3, taskTimeout: 60000, defaultCommandTimeout: 10000, requestTimeout: 60000, responseTimeout: 60000, async setupNodeEvents(on: any, config: any) { //Cypress Grep Plugin const reporter = configureAllureAdapterPlugins(on, config);
require('@cypress/grep/src/plugin')(config);
require('./cypress/plugins/index.js')(on, config);
// implement node event listeners here
const version = config.env.version || 'local-env';
const configFile = await getConfigurationFileByVersion(version);
on('task', verifyDownloadTasks);
//allureWriter(on, config);
},
baseUrl: 'http://example.com',
},
}); `
2. local env file:
{ "projectName": "Project", "releaseVersion": "4.3.0", "automationFramework": "Cypress 13.4.0", "webBaseUrl": "http://example.com", "baseAtlasUrl": "http://example.com", "accessToken": " " }
3. e2e/support file
`// *** // This example support/index.js is processed and // loaded automatically before your test files.
// This is a great place to put global configuration and // behavior that modifies Cypress.
// You can change the location of this file or turn off // automatically serving support files with the // 'supportFile' configuration option.
// You can read more here: // https://on.cypress.io/configuration // ***
// Import commands.js using ES2015 syntax: import './commands'
import 'cypress-file-upload'
// Alternatively you can use CommonJS syntax: require('./commands') import './functions.ts'
// cypress/support/index.js // load and register the grep feature using "require" function // https://github.com/cypress-io/@cypress/grep
afterEach(() => { cy.window().then(win => { if (typeof win.gc === 'function') { // calling this more often seems to trigger major GC event more reliably win.gc(); win.gc(); win.gc(); win.gc(); win.gc(); } }); });
// // This example support/e2e.js is processed and // loaded automatically before your test files. // // This is a great place to put global configuration and // behavior that modifies Cypress. // // You can change the location of this file or turn off // automatically serving support files with the // 'supportFile' configuration option. // // You can read more here: // https://on.cypress.io/configuration //
// Import commands.js using ES2015 syntax: // here lies some command imports....
// Register cypress real events commands import 'cypress-real-events'
// Register Cypress Allure Plugin // import '@shelex/cypress-allure-plugin' import '@mmisty/cypress-allure-adapter/support'
// Register Cypress Grep Plugin import '@cypress/grep' const registerCypressGrep = require('@cypress/grep') registerCypressGrep()
Cypress.on('uncaught:exception', (err, runnable, promise) => { // when the exception originated from an unhandled promise rejection if (promise) { return true // turn on failing the test in this case }
// failing the test
return false
})
Cypress.on('fail', (error, runnable) => {
// we now have access to the err instance
// and the mocha runnable this failed on
throw error // throw error to have test still fail
})
import '../initialization-scripts'`
4. package.json
{ "name": "Project", "version": "1.0.0", "description": "", "main": "index.js", "dependencies": { "@testing-library/cypress": "10.0.1", "@types/node-fetch": "^2.5.11", "convert-excel-to-json": "^1.7.0", "cypress-real-events": "^1.9.1", "cypress-wait-until": "^1.7.2", "dayjs": "^1.11.7", "exceljs": "^4.3.0", "mocha": "^9.1.3", "mochawesome": "^7.0.1", "mochawesome-merge": "^4.1.0", "mochawesome-report-generator": "^6.0.1", "moment": "^2.29.4", "neat-csv": "^5.1.0", "typescript-collections": "^1.3.3", "wait-on": "^4.0.2", "xlsx": "^0.17.3" }, "devDependencies": { "@4tw/cypress-drag-drop": "^2.1.0", "@babel/core": "^7.11.1", "@babel/preset-env": "^7.11.0", "@cypress/grep": "3.1.3", "@cypress/webpack-preprocessor": "^4.1.3", "@mmisty/cypress-allure-adapter": "^0.13.0", "@types/convert-excel-to-json": "^1.7.1", "@types/fs-extra": "^11.0.1", "@types/node": "^14.18.32", "@typescript-eslint/eslint-plugin": "^5.53.0", "@typescript-eslint/parser": "^5.53.0", "babel-loader": "^8.0.6", "csv-parser": "^3.0.0", "cy-verify-downloads": "^0.1.11", "cypress": "13.4.0", "cypress-file-upload": "^5.0.8", "eslint": "^8.34.0", "eslint-config-airbnb": "^19.0.4", "eslint-config-prettier": "^8.6.0", "eslint-plugin-chai-friendly": "^0.7.2", "eslint-plugin-cypress": "^2.12.1", "eslint-plugin-import": "^2.27.5", "eslint-plugin-jsx-a11y": "^6.7.1", "eslint-plugin-mocha": "^10.1.0", "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-react": "^7.32.2", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-unused-imports": "^2.0.0", "fs": "0.0.1-security", "path": "^0.12.7", "pg": "^8.10.0", "prettier": "^2.8.4", "ts-loader": "^6.2.1", "typescript": "^5.1.6", "webpack": "^4.41.4" }, "scripts": { "start": "npx cypress open", "api-test": "npx cypress open --config testFiles=\"*/api-tests/*/*.spec.ts\"", "e2e-test": "npx cypress open --config testFiles=\"*/tests/*/*.spec.ts\"", "test": "npx cypress run", "merge_reports": "mochawesome-merge cypress/results/mochawesome*.json > cypress/results/output.json", "generate_mochawesome_report": "marge -o cypress/results/ cypress/results/output.json", "report": "npx cypress run; npm run merge_reports; npm run generate_mochawesome_report", "delete:reports": "npm run delete:reports", "prereport": "rm -r cypress/results/* || true", "mochawesome:merge": "npx mochawesome-merge \"cypress/results/mochawesome/*.json\" > mochawesome.json && npx marge mochawesome.json", "junit:merge": "npx junit-merge -d cypress/results/junit -o cypress/results/junit/result.xml", "cypress:run": "npx cypress run", "cypress:e2e": "npm run cypress:run; npm run junit:merge; npm run mochawesome:merge", "cy:run": "cypress run --browser firefox --env allure=true", "cy:run_sanity": "cypress run --browser chrome --env grepTags=@Sanity,allure=true", "allure:report": "allure generate allure-results-aggregated-files --clean -o allure-report", "allure:size": "pwd; ls -lah; du -sh allure-results/; du -sh allure-report/*; du -sh cypress/", "allure:clear": "npm run allure:size;rm -rf allure-results/*;rm -rf allure-results-aggregated-files/*;rm -rf allure-report/*; rm -rf cypress/screenshots/*; rm -rf cypress/videos/*;npm run allure:size", "pretest": "npm run allure:clear", "cypress:e2e_allure": "ls -lha; npm run cy:run; chmod -R 777 .; echo done", "cypress:e2e_allure_sanity": "ls -lha; npm run cy:run_sanity; chmod -R 777 .; echo done", "posttest": "npm run allure:report" }, "author": "", "license": "ISC" }
I hope this is helpful Thank you 🙏
Note: The previous error occur to me in every test case run
Hello, What I see from the first glance:
FYI: if you need to add a code snippet you can use 3 apostrophes to start a snippet and 3 apostrophes to end it. also you can use code editor.
closing since no updates
I'm currently using the Cypress Allure Adapter in my Cypress project, and I'm facing an issue where the test hangs and I get this error message in terminal [
](URL)
Is this a compatibility issue or could be something else?
Current versions: