Giter VIP home page Giter VIP logo

cypress-allure-plugin's People

Contributors

aali0730 avatar borisosipov avatar dependabot[bot] avatar jennifer-shehane avatar kpittman-securus avatar markroche32 avatar mmisty avatar mysticdevx avatar shelex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cypress-allure-plugin's Issues

import' and 'export' may appear only with 'sourceType: module' issue occurs on cypress-allure-plugin

I have followed the steps as per the link https://www.npmjs.com/package/@shelex/cypress-allure-plugin while executing the allure report with Cypress it throws the below exception.

support/index.ts

import './commands';
import '@shelex/cypress-allure-plugin'; 

/**
 * @type {Cypress.PluginConfig}
 */

plugins/index.js

const cucumber = require("cypress-cucumber-preprocessor").default;
const browserify = require("@cypress/browserify-preprocessor");
const mysql = require('mysql2')
const db = require('../../cypress.json')
var mssql = require('mssql');
const path = require('path');
const fs = require('fs-extra');
const allureWriter = require('@shelex/cypress-allure-plugin/writer');
/// <reference types="@shelex/cypress-allure-plugin" />

module.exports = (on, config) => {
  
  const options = browserify.defaultOptions;
  options.browserifyOptions.plugin.unshift(['tsify']);
  on("file:preprocessor", cucumber(options));
  
  on('task', {
    'createMySQLConnection'(query) {
      var value = queryDB(query)
      return value
    }
  });

  function queryDB(query) {
    var dbenv = config.env.configFile
    var connection="";
    if(dbenv=="qa"){
      connection = mysql.createConnection(db.credqa)
    }
    else if(dbenv=="stg"){
      connection = mysql.createConnection(db.credstg)
    }
    else if(dbenv=="stg2"){
      connection = mysql.createConnection(db.credstg2)
    }
    connection.connect()
    return new Promise((resolve, reject) => {
      connection.query(query, (error, results) => {
        if (error) {
          return reject(error)
        }
        connection.end()
        return resolve(results)
  
      })
    })
  }

  on('task', {
    'createMSSQLConnection'(query) {
      return abcQueryDB(query)
  }
});


 async function abcQueryDB(query){
   const connection = await mssql.connect(db.abc);
   var sqlServerRequest = new mssql.Request(connection);
   return new Promise((resolve, reject) => {
    sqlServerRequest.query(query, (error, recordset) => {
      mssql.close(); 
      if(error){
      reject (error)
      }
      else{
        resolve (recordset)
      }
    }) 
  })
 };

  allureWriter(on, config);
  
  const file = config.env.configFile || 'stg2';
  const pathToConfigFile = path.resolve('cypress/config', `${file}.json`);
  return config,fs.readJson(pathToConfigFile);

}

package.json

 "@shelex/cypress-allure-plugin": "^2.2.1"
 "allure-commandline": "^2.13.8",
 "cypress": "6.2.1",
 "cypress-cucumber-preprocessor": "2.0.1"

tsconfig.json

{
  "compilerOptions": {
    "target": "es2015",      
    "module": "commonjs",                
    "lib": ["es2017", "dom"],
    "strict": true,          
    "noImplicitAny": true,   
    "types": ["cypress","node","cypress-xpath","cypress-plugin-tab"],
    "esModuleInterop": true,    
    "skipLibCheck": true,       
    "forceConsistentCasingInFileNames": true 
  },
  "include": ["**/*.ts",
    "**/*.js", 
    "../node_modules/@shelex/cypress-allure-plugin/reporter",
    "../node_modules/cypress"]
}

node version

local machine: 12.18.1
Jenkins: 12.18.3

Note:

  1. allure-results folder got created only after adding the import shelex to index.ts. If it is not added then the folder is not getting created and the report is not generated.
  2. This issue is not occurring in few local machines and every time occurs in Jenkins execution
  3. Webpack is not used

Cypress
MicrosoftTeams-image

Jenkins Exception:
image

VSCode Console

The error was:

SyntaxError: 'import' and 'export' may appear only with 'sourceType: module'

This occurred while Cypress was compiling and bundling your test code. This is usually caused by:

- A missing file or dependency
- A syntax error in the file or one of its dependencies

Fix the error in your code and re-run your tests.
  (Results)

@Shelex could you share your thoughts?

Test suite fails if before contains an Allure step

Describe the bug
If before contains an Allure step (via cy.allure() chainer) test suite fails with following error message:

Cannot read property 'startStep' of null

To Reproduce
Steps to reproduce the behavior:

  1. Create a test suite with before section
  2. Add an Allure step to before section (either directly or via custom command that has step definition embedded)
  3. Run the test suite

Expected behavior
Test suite runs without errors. Steps contained in before section are shown on setUp of every test case

Environment (please complete the following information):

  • Cypress version: 4.7.0
  • OS: Windows|Linux (CentOS)

** Developer Tools Console Output **

Additional context
Add any other context about the problem here.

'Cannot read property 'addAttachment' of null' error if the test failed in the 'before' function

Describe the bug
If the test failed in the 'before' function, prior to any test body, the 'Cannot read property 'addAttachment' of null' error happen and is shown in cypress, instead of an actuall error that happened.
Apparently, it seems like the error is caused by the fact that this.reporter.currentTest is null. Please check screenshot for the detailed error.

To Reproduce
Steps to reproduce the behavior:
Setup cypress with cypres-allure-lugin

  1. Add a simple assert that would fail into the before function to the test (e.g. - expect(1).to.eq(2);)
  2. Run the test
  3. See error

Expected behavior
Errors in before function are handled properly, not causing allure-plugin to fail and create there own errors.

Environment (please complete the following information):

  • Cypress version: 5.6.0
  • OS: Windows

** Developer Tools Console Output **
Cannot read property 'addAttachment' of null
Because this error occurred during a before all hook we are skipping the remaining tests in the current suite: Sample Describe

Additional context
image

afterEach is not defined if cypress-allure-plugin is added as a report

Could you please help to clarify what I did wrong?
If there is no "reporter" section in my cypress.json file than after run:
npx cypress run --config video=false --env allure=true --browser chrome my generated allure report is empty.

I've tried to paste

"reporter": "@shelex/cypress-allure-plugin", "reporterOptions": { "targetDir": "allure" },
but this time I have got an error:

`>npx cypress run --config video=false --env allure=true --browser chrome

Could not load reporter by name: @shelex/cypress-allure-plugin

We searched for the reporter in these paths:

  • C:\Users\apopi\Perforce\apopichenko\WUG\MAIN\WhatsUp-UI\Web\NMWorkspace@shelex\cypress-allure-plugin
  • C:\Users\apopi\Perforce\apopichenko\WUG\MAIN\WhatsUp-UI\Web\NMWorkspace\node_modules@shelex\cypress-allure-plugin

The error we received was:

ReferenceError: afterEach is not defined
at Object. (C:\Users\apopi\Perforce\apopichenko\WUG\MAIN\WhatsUp-UI\Web\NMWorkspace\node_modules@shelex\cypress-allure-plugin\reporter\afterHook.js:4:1)
at Module._compile (internal/modules/cjs/loader.js:880:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:892:10)
at Module.load (internal/modules/cjs/loader.js:735:32)
at Module._load (internal/modules/cjs/loader.js:648:12)
at Module._load (electron/js2c/asar.js:717:26)
at Function.Module._load (electron/js2c/asar.js:717:26)
at Module.require (internal/modules/cjs/loader.js:775:19)
at require (internal/modules/cjs/helpers.js:68:18)
at Object. (C:\Users\apopi\Perforce\apopichenko\WUG\MAIN\WhatsUp-UI\Web\NMWorkspace\node_modules@shelex\cypress-allure-plugin\reporter\index.js:1:1)
at Module._compile (internal/modules/cjs/loader.js:880:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:892:10)
at Module.load (internal/modules/cjs/loader.js:735:32)
at Module._load (internal/modules/cjs/loader.js:648:12)
at Module._load (electron/js2c/asar.js:717:26)
at Function.Module._load (electron/js2c/asar.js:717:26)
at Module.require (internal/modules/cjs/loader.js:775:19)
at require (internal/modules/cjs/helpers.js:68:18)
at Function.Reporter.loadReporter (C:\Users\apopi\AppData\Local\Cypress\Cache\3.8.1\Cypress\resources\app\packages\server\lib\reporter.js:386:16)
at Project.watchSettingsAndStartWebsockets (C:\Users\apopi\AppData\Local\Cypress\Cache\3.8.1\Cypress\resources\app\packages\server\lib\project.js:310:18)
at C:\Users\apopi\AppData\Local\Cypress\Cache\3.8.1\Cypress\resources\app\packages\server\lib\project.js:142:16
at tryCatcher (C:\Users\apopi\AppData\Local\Cypress\Cache\3.8.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (C:\Users\apopi\AppData\Local\Cypress\Cache\3.8.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise.js:544:35)
at Promise._settlePromise (C:\Users\apopi\AppData\Local\Cypress\Cache\3.8.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise.js:604:18)
at Promise._settlePromise0 (C:\Users\apopi\AppData\Local\Cypress\Cache\3.8.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise.js:649:10)
at Promise._settlePromises (C:\Users\apopi\AppData\Local\Cypress\Cache\3.8.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise.js:729:18)
at Promise._fulfill (C:\Users\apopi\AppData\Local\Cypress\Cache\3.8.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise.js:673:18)
at PromiseArray._resolve (C:\Users\apopi\AppData\Local\Cypress\Cache\3.8.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise_array.js:127:19)
at PromiseArray._promiseFulfilled (C:\Users\apopi\AppData\Local\Cypress\Cache\3.8.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise_array.js:145:14)
at PromiseArray._iterate (C:\Users\apopi\AppData\Local\Cypress\Cache\3.8.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise_array.js:115:31)
at PromiseArray.init [as _init] (C:\Users\apopi\AppData\Local\Cypress\Cache\3.8.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise_array.js:79:10)
at Promise._settlePromise (C:\Users\apopi\AppData\Local\Cypress\Cache\3.8.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise.js:601:21)
at Promise._settlePromise0 (C:\Users\apopi\AppData\Local\Cypress\Cache\3.8.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise.js:649:10)
at Promise._settlePromises (C:\Users\apopi\AppData\Local\Cypress\Cache\3.8.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\promise.js:729:18)
at _drainQueueStep (C:\Users\apopi\AppData\Local\Cypress\Cache\3.8.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\async.js:93:12)
at _drainQueue (C:\Users\apopi\AppData\Local\Cypress\Cache\3.8.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\async.js:86:9)
at Async._drainQueues (C:\Users\apopi\AppData\Local\Cypress\Cache\3.8.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (C:\Users\apopi\AppData\Local\Cypress\Cache\3.8.1\Cypress\resources\app\packages\server\node_modules\bluebird\js\release\async.js:15:14)
at processImmediate (internal/timers.js:439:21)

Learn more at https://on.cypress.io/reporters

`_

Unable to generate allure-results folder after test execution is complete!!

I have configured the Cypress-allure-plugin within the package.json as suggested in the description and copied over the codes to plugin/index.js and support/index.js, also set an environment variable to customize the path for the allure-results.
Upon running the tests the allure-results folder is not generated automatically.

Steps to reproduce the behavior:

  1. Installing cypress allure plugin
  2. Configuration as suggested in the below link
    https://github.com/Shelex/cypress-allure-plugin
  3. Set the env variable to customize the path for reports
  4. Run the test : npx cypress-tags run -e TAGS='@tags' --env allure=true allureResultsPath=cypress/results --browser chrome

Expected behavior
The allure-results folder should get displayed.

Failure Message:

The task 'writeAllureResults' was not handled in the plugins file. The following tasks are registered: hasSavedRecord, connectDataBase, updateDataBase, getMerchantIDfromDataBase, fetchMultiVariableDataBase, fetchVariableDataBase, connectAsync, testStart, clearPreviousAttemptScreenshots

Environment (please complete the following information):

  • Cypress version: 4.3
  • OS: Windows

Screenshots taken in a afterEach hook are not being displayed in allure report

Hey guys,

My aim is to see screenshots for each test. Well, my code takes the screenshot in a afterEach hook and then I could see the .png added to the allure-results folder as shown in the image below.

image

The allure report opens nicely but the screenshot is not displayed although there is a kind of a section left to that. See below an image of the report:

image

So I tried a workaround by using attachment method of Allure API in order to add it programatically. However, I didn't have any success.

So, to summarize, it's seems attachment method of Allure API is not working properly.

I added the exact name of the screenshot generated by cypress as cypress documentation: https://docs.cypress.io/api/commands/screenshot.html#Notes
which worked in a mochawesome report.

Here is the code which I put in index.js under support folder.

import './commands'
import './login.js'
//import addContext from 'mochawesome/addContext'
import '@shelex/cypress-allure-plugin'

Cypress.on('test:after:run', (test, runnable) => {
  if (test.state === 'failed') {
    const screenshotFileName = `${runnable.parent.title} -- ${test.title} (failed).png`
    const path = `../reports/screenshots/${Cypress.spec.name}/${screenshotFileName}`
    cy.allure().attachment('screenshot', new Buffer.from(path,'base64'),'image/png')
    
  }
  else {
    const screenshotFileName = `${runnable.parent.title} -- ${test.title} -- after each hook.png`
    const path = `../reports/screenshots/${Cypress.spec.name}/${screenshotFileName}`
    cy.allure().attachment('screenshot', new Buffer.from(path,'base64'),'image/png')
  }
})

In my test I just have a afterEach calling cy.screenshot()
image

My OS is a Linux Mint 20 Ulyana and allure is in its most recent version I believe which is 2.13.6.

Integrate cypress-allure-plugin with Cypress 5+ Retry functionality

Is your feature request related to a problem? Please describe.
Integrate cypress-allure-plugin with Cypress 5+ Retry functionality

Describe the solution you'd like
Cypress 5+ allows for Retry test when it fails to the number of times, n

"retries": {
"runMode": 2,
"openMode": 2
},

  • discard previous passed and failed screenshot attempts from attachments in report

Additional context
Currently cypress-allure-plugin with Cypress 5+ Retry functionality :

  • previous passed and failed screenshot attempts appear in attachments in report

TypeError: Cannot read property error in beforeEach generates exception in plugin code

Describe the bug
I have issue in beforeEach of my test like this:
"TypeError: Cannot read property 'propertyName' of undefined"
and this leads to exception in cypress-allure-plugin, so my test run just stuck.

Here is exception

cypress_runner.js:6080 Unhandled rejection TypeError: Cannot read property 'clearFilesForPreviousAttempt' of undefined
at AllureReporter.startCase (http://IP/__cypress/tests?p=cypress\support\index.js:35951:20)
at AllureReporter.failTestCase (http://IP/__cypress/tests?p=cypress\support\index.js:36058:18)
at Runner.eval (http://IP/__cypress/tests?p=cypress\support\index.js:35591:31)

10.40.67.32-1613633504179.log

Cypress: 4.11
plugin version: 2.3.2

Error is fixed in 2.3.4

Custom Video Path

In the docs it says to open an issue if you are using a custom path for videos.

https://github.com/Shelex/cypress-allure-plugin#screenshots-and-videos

[...] for now default videos path is used: cypress/videos. Please open a feature request in case you are using custom folder paths.

I have inherited a project where there is a lot of existing stuff built around using the folder output... like output/reports, output/video, output/screenshots, etc.

It appears that the screenshots work fine from within this folder.

In Allure, the video attachments are displayed alongside failed tests, but they are 0 bytes and do not work.

It would be nice if there were some way I could have them linked correctly!

Please let me know if there's anything I could do to help.

Unable to overwrite suite name with cy.allure().suite()

Describe the bug
I have a before block in support/index.js that sets per suite configuration. One of the items I need to set is the suite name (Every suite needs to have a prefix added to it). If I try to modify the name by calling cy.allure().suite('NAMEHERE) I get following error:
TypeError: Cannot read property 'addLabel' of null

To Reproduce
Steps to reproduce the behavior:

  1. Add before() block in support/index.js
  2. Add cy.allure().suite('whatever') inside the block
  3. Run tests

Expected behavior
Tests pass with no issues, suite names in the report are set to whatever was set in the before block

Environment (please complete the following information):

  • Cypress version: 6.5.0
  • OS: Windows

** Developer Tools Console Output **

Additional context
Add any other context about the problem here.

Add "before all" and "after all" hooks to report

Is your feature request related to a problem? Please describe.
Based on #11 there is a demand from users to have before/after hooks be logged into report

Describe the solution you'd like
Set up and Tear down test steps should contain data from before all and after all hooks

Consider supporting tmsPostfix

Is your feature request related to a problem? Please describe.
In case of SpiraTeam, the URLs end in .aspx but this use case is not currently supported by the current configuration.

Describe the solution you'd like
The config could include a new optional tmsPostfix property that could be appended to the final URL.

Additional context

Unhandled rejection TypeError: this.currentHook.endStep is not a function

Describe the bug
I got Allure exception: " Unhandled rejection TypeError: this.currentHook.endStep is not a function " after Before each and before first test in spec.
Unhandled rejection TypeError: this.currentHook.endStep is not a function at AllureReporter.endHook (http://10.40.67.32/__cypress/tests?p=cypress\support\index.js:35627:30) at AllureReporter.failTestCase (http://10.40.67.32/__cypress/tests?p=cypress\support\index.js:35544:18) at Runner.eval (http://10.40.67.32/__cypress/tests?p=cypress\support\index.js:35125:31) From previous event: at onNext (http://10.40.67.32/__cypress/runner/cypress_runner.js:173630:20) at done (http://10.40.67.32/__cypress/runner/cypress_runner.js:103365:5) at http://10.40.67.32/__cypress/runner/cypress_runner.js:103430:11 From previous event: at callFn (http://10.40.67.32/__cypress/runner/cypress_runner.js:103428:14) at Hook.../driver/node_modules/mocha/lib/runnable.js.Runnable.run (http://10.40.67.32/__cypress/runner/cypress_runner.js:103412:7) at http://10.40.67.32/__cypress/runner/cypress_runner.js:173679:28 From previous event: at Object.onRunnableRun (http://10.40.67.32/__cypress/runner/cypress_runner.js:173667:20) at $Cypress.action (http://10.40.67.32/__cypress/runner/cypress_runner.js:164430:61) at Hook.Runnable.run (http://10.40.67.32/__cypress/runner/cypress_runner.js:172280:13) at next (http://10.40.67.32/__cypress/runner/cypress_runner.js:103927:10) at http://10.40.67.32/__cypress/runner/cypress_runner.js:103966:7 at next (http://10.40.67.32/__cypress/runner/cypress_runner.js:173603:16) at http://10.40.67.32/__cypress/runner/cypress_runner.js:173624:11

//--------------------------spec----------------------------
beforeEach('all', () => {

});

describe("suite", () => {
    it(test, () => {
        cy.log('test new');
        expect(true).to.be.true;
    });


});

Cypress version 4.12.1
cypress-allure-plugin version 2.0.1

DevTools console output is attached.

console_error_full.txt
console_error.txt

Possibility to add video for passed tests

Hi,

My client requires to add video to each test, both passed and failed. Currently, I see that there is a possibility to attach videos to failed tests, but I don't know how to attach movies to those, which ended successfully.

I've tried to do this in test:after:run and also in afterEach, but it seems it doesn't work (Maybe because video is generated later and not exists at the moment when I execute that command?) Or maybe there is a workaround and I didn't find a solution. It would be perfect to add this feature, or advise me, is there any workaround?

Cypress.on('test:after:run', (err, runnable) => {
    cy.allure().fileAttachment(
        `${Cypress.spec.name}.mp4`,
        path.join(
            Cypress.config().videosFolder,
            `${Cypress.spec.name}.mp4`
        ),
        'video/mp4'
    );
})

Best regards

Allure-results can't be created if "context.skip" or "describe.skip" is presented in suite body

Allure-results can't be created for spec file if "context.skip" or "return this.skip();" at "before" hook are presented in suite body so it doesn't even appears as tests at allure report results when all specs passed. Mocha/mochawesome handle this correctly but this plugin unfortunately not.

Steps to reproduce:

  1. Use modified attached* cypress/examples/actions.spec file at cloned project(I've just remove all(except the first) actions from your original file for more speed and results visibility; reproduced the same at production with big number of tests)
  2. run "yarn cy:run" at project directory
  3. Observe the result

Expected result
Plugin should correctly handle test statements and create corresponding test result:

Actual result

  1. https://pastebin.com/4EK0uYcF - context.skip example actions.spec file with partially skipped tests
    https://pastebin.com/hq7Xa59r- console output
    Allure results wasn't created
  2. https://pastebin.com/cYfmYbNF - another context.skip example actions.spec file with all spec.file tests skipped
    hhttps://pastebin.com/1tC2inqjr- console output
    Allure results wasn't created

Environment :

  • Cypress version: 6.8.0
  • OS: Reproduced on latest Debian and MacOS
  • cypress-allure-plugin version. Tried both on the 2.3.5 and 2.4.0

Consider integration with cypress-image-snapshot

Is your feature request related to a problem? Please describe.

Thank you for your awesome library, first of all.

You have a great example how to integrate with cypress-plugin-snapshot: https://github.com/Shelex/cypress-allure-snapshots-example/blob/master/cypress/support/index.js

Unfortunately, it's severely lacking feature, for instance, diffing is not very configurable.

https://github.com/jaredpalmer/cypress-image-snapshot provides a more fine-tuned way to configure diffing.

the report shows the passed test steps as fallen

** Description of the error **
the results of the steps taken are displayed incorrectly when "allureLogCypress": false

** Playback **
Steps to reproduce the behavior:

1.set variable "allureLogCypress": true
2.run the test script:

describe ('example ->', function () {

it ('test # 1', () => {
    cy.allure (). step ("visit 1", false);
    cy.visit ("http://example.com");

    cy.allure (). step ("visit 2", false);
    cy.visit ("http://example.com");

    cy.allure (). step ("visit 3", false);
    cy.visit ("http://example555.com");
});
});
  1. view the report (the display of steps is correct).

4.set variable "allureLogCypress": false
5. run the test script:

describe ('example ->', function () {

it ('test # 1', () => {
    cy.allure (). step ("visit 1", false);
    cy.visit ("http://example.com");

    cy.allure (). step ("visit 2", false);
    cy.visit ("http://example.com");

    cy.allure (). step ("visit 3", false);
    cy.visit ("http://example555.com");
});
});

6. view the report (all steps are displayed as fallen).

** Expected Behavior **
The report is expected to display successfully completed steps in green, dropped in red.

** Environment (please fill in the following information): **

  • Cypress version: 6.0.3
  • OS: Windows 10
  • cypress-allure-plugin v.2.2.0

Unable to open screenshot

Describe the bug

allure-results folder has the screenshot but its not available on the html report as shown below

image

image

image

Expected behavior
Should be able to see the screenshot

Environment (please complete the following information):

  • Cypress version: 4.8
  • OS: windows

** Developer Tools Console Output **

please add label->framework

Hi there!
My team is looking into using allure reports more broadly - across many test platforms.
The allure report for some (particularly officially supported) frameworks includes the framework name, as in:

  "labels": [
    {
      "name": "framework",
      "value": "junit-platform"
    },
...

It seems this info is hardcoded into the plugin as in this LOC:
https://github.com/allure-framework/allure-java/blob/5365fddefb684ca4d4abd6b43c5ec7b10f2215d3/allure-junit-platform/src/main/java/io/qameta/allure/junitplatform/AllureJunitPlatform.java#L376

As in, if you're using this code you must be using junit (and they populate language:java as well). :-)

Would you be open to including a framework -> cypress label in this repo?

I'm open to providing a PR myself or from my team, but I just wanted to float the idea to you first.

Allure report not working with cucumber typescript

Hi,
Allure reporter is capturing the results in allure-results but not actually producing the report in correct format

Scripts

   "cy:cucumber:open": "cypress open --browser chrome",
    "cy:cucumber:run": "cypress run --env allure=true --browser chrome",
    "allure:report": "npx allure generate reports/allure-results --clean -o allure-report",
    "allure:clear": "rm -r reports/allure-results/ reports/allure-report reports/screenshots || true"

in cypress.json

 "env": {
    "allureResultsPath": "reports/allure-results"
  }

My plugin/index.js

const cucumber = require('cypress-cucumber-preprocessor').default;
const browserify = require('@cypress/browserify-preprocessor');
const allureWriter = require('@shelex/cypress-allure-plugin/writer');


module.exports = (on, config) => {
  const options = browserify.defaultOptions;

  options.browserifyOptions.plugin.unshift(['tsify']);

  on('file:preprocessor', cucumber(options));
  allureWriter(on, config);
  return config;
};

Screenshot 2020-05-14 at 11 01 00 PM

Snapshots made by cypress-plugin-snapshots are not included in the report

Describe the bug

Looks like there's missing integration between Allure plugin and Snapshot plugin:

To Reproduce

cy.document().toMatchImageSnapshot();

Expected behavior

Should result in snapshot added to report, but it does not. Especially when snapshot does not match.

Environment (please complete the following information):

  • Cypress version: 4.10.0
  • OS: Mac

cy.allure().story('A-Story') is not shown in generated html report

Describe the bug
If I use the API to add some test informations to the test report with cy.allure().story('A-Story'), the mentioned information is not visible in test report html.

To Reproduce
Steps to reproduce the behavior:

  1. Write a test with the following line in it: cy.allure().story('A-Story').issue('An-Issue', 'An-Issue_URL')
    e.g.:
    describe('test suite', () => {
      it('test case', () => {
        cy.allure().story('A-Story').issue('An-Issue', 'An-Issue_URL')
        cy.visit('www.google.de');
      });
    });
    
  2. Generate html report
    --> The issue link An-Issue is visible on html report --> OK
    --> The stroy link A-story is NOT visible on html report --> NOK
    Hint: Didn't tested all available tags. Maybe the issue occurs also with other tags.

Expected behavior
Both informations (issue and story link) are visible in html report

Environment:

  • Cypress version: 6.0.1
  • Cypress-allure-plugin version: 1.8.5
  • OS: Windows

Cannot read property 'config' of undefined

When I run Cypress it's failing after the tests complete. The error I get is:

Cannot read property 'config' of undefined 
Because this error occurred during a `after all` hook we are skipping all of the remaining tests`

This happens regardless of the Cypress test, even running the example ones from the Cypress Allure demo repo. It looks like this failure is in afterHook.js when its passing Cypress.Allure.reporter.runtime.config.. I have everything properly configured in plugins/index.js, support/index.js and tsconfig.json.

Steps to reproduce the behavior:

  1. Run cypress run --headless --browser chrome "--spec" "cypress/integration/Web/UserFlows/allure.spec"

Expected behavior
Cypress to complete and Allure files to be generated.

Environment (please complete the following information):

  • Cypress version: 5.3.0
  • OS: Mac

** Developer Tools Console Output **

../../node_modules/.bin/cypress run --headless --browser chrome  "--spec" "cypress/integration/Web/UserFlows/allure.spec"

====================================================================================================

  (Run Starting)

  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚ Cypress:    5.3.0                                                                              โ”‚
  โ”‚ Browser:    Chrome 86 (headless)                                                               โ”‚
  โ”‚ Specs:      1 found (Web/UserFlows/allure.spec)                                                โ”‚
  โ”‚ Searched:   cypress/integration/Web/UserFlows/allure.spec                                      โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜


โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
                                                                                                    
  Running:  Web/UserFlows/allure.spec                                                       (1 of 1)


  Actions
    โœ“ .blur() - blur off a DOM element (910ms)
    โœ“ .clear() - clears an input or textarea element (711ms)
    โœ“ .submit() - submit a form (493ms)
    โœ“ .click() - click on a DOM element (2133ms)
    โœ“ .dblclick() - double click on a DOM element (371ms)
    โœ“ .rightclick() - right click on a DOM element (301ms)
    โœ“ .check() - check a checkbox or radio element (939ms)
    โœ“ .type() - type into a DOM element (8846ms)
    โœ“ .uncheck() - uncheck a checkbox element (5924ms)
    โœ“ .select() - select an option in a <select> element (1045ms)
    โœ“ .scrollIntoView() - scroll an element into view (257ms)
    โœ“ .trigger() - trigger an event on a DOM element (232ms)
    1) "after all" hook for "cy.scrollTo() - scroll the window or element to a position"


  12 passing (33s)
  1 failing

  1) Actions
       "after all" hook for "cy.scrollTo() - scroll the window or element to a position":
     TypeError: Cannot read property 'config' of undefined

Because this error occurred during a `after all` hook we are skipping all of the remaining tests.
      at Context.eval (https://example.cypress.io/__cypress/tests?p=cypress/support/index.js:101:71)




  (Results)

  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚ Tests:        13                                                                               โ”‚
  โ”‚ Passing:      12                                                                               โ”‚
  โ”‚ Failing:      1                                                                                โ”‚
  โ”‚ Pending:      0                                                                                โ”‚
  โ”‚ Skipped:      0                                                                                โ”‚
  โ”‚ Screenshots:  4                                                                                โ”‚
  โ”‚ Video:        false                                                                            โ”‚
  โ”‚ Duration:     33 seconds                                                                       โ”‚
  โ”‚ Spec Ran:     Web/UserFlows/allure.spec                                                        โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜


  (Screenshots)

  -  allure-results/8042cfec-294c-4e8b-9f16-2ea3c0d886fd-attachment.png                  (1280x6545)
  -  allure-results/7816ba67-91d7-4537-8d6c-40d900865552-attachment.png                  (1280x6545)
  -  allure-results/7707a682-6184-4744-8f31-eac40127820f-attachment.png                  (1280x6545)
  -  allure-results/835d0cdb-674b-4045-801d-58cfb812ee94-attachment.png                   (1280x720)


====================================================================================================

  (Run Finished)


       Spec                                              Tests  Passing  Failing  Pending  Skipped  
  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚ โœ–  Web/UserFlows/allure.spec                00:33       13       12        1        -        - โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
    โœ–  1 of 1 failed (100%)                     00:33       13       12        1        -        -  

Additional context
Add any other context about the problem here.

tests cannot be marked as @Flaky

According to allure framework it should be possible to mark some tests as flaky by adding corresponding tag @flaky, however it seems like it is not supported by plugin

ReferenceError: Cypress is not defined

Describe the bug
After upgrading to version 1.4.1 instead of displaying a failure message I see ReferenceError: Cypress is not defined:

  1) Organization STO-1: UI - Settings - Organization:
     ReferenceError: Cypress is not defined
      at Object.handler (/tests/node_modules/@shelex/cypress-allure-plugin/writer.js:60:9)
      at invoke (/Library/Caches/Cypress/4.3.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_plugins.js:21:16)
      at /Library/Caches/Cypress/4.3.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/util.js:48:16
      at tryCatcher (/Library/Caches/Cypress/4.3.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
      at Function.Promise.attempt.Promise.try (/Library/Caches/Cypress/4.3.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/method.js:39:29)
      at Object.wrapChildPromise (/Library/Caches/Cypress/4.3.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/util.js:47:28)
      at execute (/Library/Caches/Cypress/4.3.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_plugins.js:92:12)
      at EventEmitter.<anonymous> (/Library/Caches/Cypress/4.3.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_plugins.js:200:5)
      at EventEmitter.emit (events.js:210:5)
      at process.<anonymous> (/Library/Caches/Cypress/4.3.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/util.js:25:29)
      at process.emit (events.js:210:5)
      at emit (internal/child_process.js:876:12)
      at processTicksAndRejections (internal/process/task_queues.js:81:21)

This works normally in version 1.4.0 and seems to be related to if (Cypress.env('allure') === true) part from 7ff767a

I have plugin is connected in index.js file:

// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************

// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)

const fs = require("fs-extra");
const path = require("path");
const clipboardy = require("clipboardy");
const allureWriter = require("@shelex/cypress-allure-plugin/writer");

module.exports = (on, config) => {
    // `on` is used to hook into various events Cypress emits
    // `config` is the resolved Cypress config
    // accept a configFile value or use development by default

    // https://docs.cypress.io/api/commands/task.html#Read-a-file-that-might-not-exist
    on("task", {
        readFileMaybe(filename) {
            if (fs.existsSync(filename)) {
                return fs.readFileSync(filename, "utf8");
            }

            return null;
        },
    });

    on("task", {
        getClipboard() {
            return clipboardy.readSync();
        },
    });

    const file = config.env.configFile || "development";

    allureWriter(on);

    return getConfigurationByFile(file);
};

function getConfigurationByFile(file) {
    const pathToConfigFile = path.resolve("cypress/config", `${file}.json`);

    return fs.readJson(pathToConfigFile);
}

Did I miss any changes in configuration?

Environment (please complete the following information):

  • Cypress version: 4.3.0
  • OS: Mac 10.14.6

Also reproduces in CircleCI

Unfortunately, I don't have a sample project to share, but may be able to create one if you need it.

Plugin is using uuid which is not listed in dependencies

Describe the bug

Plugin is using uuid package https://github.com/Shelex/cypress-allure-plugin/search?q=uuid&unscoped_q=uuid which is not listed in dependencies:

image

  Error: @shelex/cypress-allure-plugin tried to access uuid, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
 Required package: uuid (via "uuid")
 Required by: @shelex/cypress-allure-plugin@npm:1.7.3 (via /builds/web-modules/web-modules-core/.yarn/cache/@shelex-cypress-allure-plugin-npm-1.7.3-fce6065109-3f2ae075be.zip/node_modules/@shelex/cypress-allure-plugin/)
 Require stack:
 - /builds/web-modules/web-modules-core/.yarn/cache/@shelex-cypress-allure-plugin-npm-1.7.3-fce6065109-3f2ae075be.zip/node_modules/@shelex/cypress-allure-plugin/writer.js

Pictures are not clickable in report html

Describe the bug
If a screenshot or a diff-screenshot was taken during test run...it is listed at each test result in report as filename, but it isn't clickable

To Reproduce
Steps to reproduce the behavior:

  1. Execute a test where a screenshot is taken
  2. Generate a report
  3. Open this report and try to click on the line of the testexecution log where the screenshot is mentioned

Expected behavior
If I click on the screenshot name in the log of the test report, I see it on the page as image, as in previous versions of Cypress-allure-plugin
Retestet with Cypress-Verion 5.0.0 and Cypress-allure-plugin version 1.7.1 --> It works

Environment (please complete the following information):

  • Cypress version: 5.00
  • Cypress-allure-plugin version: 1.8.2
  • OS: Windows

Question: are there any options to overwrite displayName in runtime?

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Use case is following: sometimes, when running parameterised tests there is a need to overwrite test name after test has already started. Wonder if it can be achieved with this plugin? ๐Ÿค” Any plans to add something like allure.displayName("Readable Name")
?

Nested steps

Current behavior:
When I write cy.allure().step("step_name",true), the new step starts.
All steps go one after another in the report.

Desired behavior:
It would be wonderful to have ability to start new step within another step.
For example:

cy.allure().startStep("parent_step")

  • cy.allure().startStep("first_child_step")

  • ...

  • cy.allure().endStep()

  • cy.allure().startStep("second_child_step")

  • ...

  • cy.allure().endStep()

cy.allure().endStep()

Cypress run does not generate allure results json for one of test suites (but cypress open does)

Describe the bug
Cypress run does not generate allure results json for one of test suites (but cypress open does).

To Reproduce
Steps to reproduce the behavior:

  1. Do everything as README.md says (no typescript, no webpack)
  2. node_modules/.bin/cypress run --spec 'cypress/integration/redirect.spec.js' (I'll show the content later)
  3. No allure-results generated

Expected behavior
allure-results generated for redirect.spec suite

Environment (please complete the following information):

  • Cypress version: 6.8.0
  • OS: Ubuntu 20.04.2

Additional context
Here's the spec's code:

/// <reference types="cypress" />
// cypress/integration/redirect.spec.js
import { baseUrl } from '../conf' // a url string

describe('redirect with arbitrary payload', () => {
  // https://github.com/cypress-io/cypress/issues/9307
  before(() => cy.visit(baseUrl, { failOnStatusCode: false }))

  const requestOptions = { // NOTE: 3 types of request
    'with qs': {
      qs: { foo: 'bar' },
    },
    'with json': {
      body: { foo: 'bar' },
    },
    'with xml': {
      body: '<?xml version="1.0" encoding="UTF-8"?><note>Hello!</note>',
      headers: { 'Content-Type': 'text/xml; charset=utf-8' }, // cypress doesn't add this for xml automatically
    },
  }

  for (const testCase in requestOptions) {
    it(testCase, () => {
      cy.request({
        method: 'GET',
        url: baseUrl,
        failOnStatusCode: false,
        ...requestOptions[testCase],
      }).then(resp => {
        expect(resp.status).to.equal(545)
        expect(resp.headers['content-type']).to.eq('text/html; charset=utf-8')
        expect(resp.body).to.include('Checking your browser')
      })
    })
  }
})

The interesting part is - if we remove one field from requestOptions so only 2 types of requests left, everything will be ok!

  const requestOptions = {
    'with qs': {
      qs: { foo: 'bar' },
    },
    'with json': {
      body: { foo: 'bar' },
    },
  }

With such requestOptions I have my allure-results generated :D

@link annotation in gherkin file doesn't work

Describe the bug
When trying to add a @link annotation to any scenario, it shows up as a Tag instead.

To Reproduce
Steps to reproduce the behavior:

  1. In the cypress/integration/cucumber/news/Google.feature add:
    @link("https://google.com","google")
    Scenario: Opening a Google network page
        Given I open Google page
        Then I see "Google" in the title
  1. Then run the yarn cy:cucumber:run, followed by yarn allure:report, and finally allure open
  2. You will see that link shows up as a Tag instead of a Link.

Screen Shot 2021-04-07 at 11 34 45 PM

Expected behavior
One would expect to see it under the Links section as a link entry.

Environment (please complete the following information):

  • Cypress version: 6.2.0
  • OS: Mac

Execution get stuck when using context.Skip() with allure

Describe the bug
When Adding context.skip to spec file and keeping allure=true in the config, the execution is getting stuck and not getting terminate. Below is the screenshot for the same:
image

To Reproduce
Steps to reproduce the behavior:

  1. Clone the repo https://github.com/Shelex/cypress-allure-plugin-example
  2. Update contextto context.skip in action.spec.js file
  3. Run the command "yarn cy:run"

Expected behavior
Testcase should get skip and execution should be completed

Environment (please complete the following information):

  • Cypress version: 6.2.0
  • OS: Windows 10

** Developer Tools Console Output **

Additional context
Add any other context about the problem here.

Execution stuck with skipped cucumber scenario and afterEach hook

Describe the bug
The problem is very similar to #51 . If a scenario is skipped in a feature file using tags and there is an afterEach hook tests execution is stuck.
Tests run ok if allure=false.
Tests run ok if there are no afterEach hook.
Tests run ok if there are no skipped tests.
Note that I've updated "@shelex/cypress-allure-plugin" to the latest version and verified that #51 is fixed.

test-stuck

To Reproduce
Steps to reproduce the behavior:

  1. Clone the repo https://github.com/Shelex/cypress-allure-plugin-example
    1.1 Optional: Update version of "@shelex/cypress-allure-plugin" to 2.3.5
  2. Tag first scenario in Google.feature with @Skip
  3. Add additional env to cy:cucumber:run script in order to skip a scenario like: --env allure=true,TAGS='not @skip'
  4. Add afterEach hook in a new file or in any of the existing js files in "cypress/integration/cucumber/news/Google" folder

Expected behavior
All tests are executed.

Environment (please complete the following information):

  • Cypress version: 6.2.0
  • OS: Linux (Ubuntu)

** Developer Tools Console Output **

Additional context
Add any other context about the problem here.

Allure prevents cypress-cucumber-preprocessor to produce proper JSON reports

Hi, I am using allure in Cypress framework. I use allure for reporting and cypress-cucumber-preprocessor reporter to have json reports in order to import results to xRay. Whenever I activate allure (either in cypress.json file or through cli) the cypress report JSONs don't include the failed scenarios. but when I deactivate allure (allure=false), the cypress cucumber report behaves as expected. Can you suggest a workaround or solution to this issue?

Expected behaviour
Even if the allure is activates, cypress-cucumber-preprocessor should prepare proper results, including failed scenarios

Environment (please complete the following information):

  • Cypress version: 5.6.0 (tried with 6.x too)
  • cypress-cucumber-preprocessor. Latest
  • Allure dependencies Latest
  • OS: Mac - Big Sur (Tried in previous version too)

In package json, I have:

 "cypress-cucumber-preprocessor": {
    "nonGlobalStepDefinitions": true,
    "cucumberJson": {
      "generate": true,
      "outputFolder": "cypress/cucumber-json",
      "filePrefix": "",
      "fileSuffix": ".cucumber"
    }
  }

and in cypress.json I have:

  "env": {
    "issuePrefix": "xxxxxxx",
    "allure": true,
    "allureResultsPath": "allure-results"
  }

I also tried allure: false and run with --env allure=true in cli

Here is sample project:
https://github.com/mysticdevx/webPackExample

Add opportunity to add video to allure report

Hi there, I've tried to add videos to allure report, but with no success
I've tried to rename PNG format to WEBM in AllureInterface and writer files, it writes video and attached to report, but it record seconds after test fails, like a screenshot

Even add video to report as cypress does would be perfect. Cypress attaches full video to each test suite even it passes

Many thanks!

Put videos in allure-results folder

Is your feature request related to a problem? Please describe.
Video attachments refers to absolute folder on your system.
Example:

    "attachments": [
        {
            "name": "screens.test.js.mp4",
            "type": "video/mp4",
            "source": "/Users/homeuser/Documents/frontend/cypress/videos/screens.test.js.mp4"
        },
        {
            "name": "screens.test.js:2020-11-11T17:28:24.988Z",
            "type": "image/png",
            "source": "056807c6-4a03-4016-973d-a386005e0d28-attachment.png"
        }
    ],

Describe the solution you'd like
I need to have self contained allure results to zip it and pass somebody else, because of that videos should be contained in allure-results folder the same way as images already.

    "attachments": [
        {
            "name": "screens.test.js.mp4",
            "type": "video/mp4",
            "source": "screens.test.js.mp4"
        },
        {
            "name": "screens.test.js:2020-11-11T17:28:24.988Z",
            "type": "image/png",
            "source": "056807c6-4a03-4016-973d-a386005e0d28-attachment.png"
        }
    ],

Example for typescript via webpack preprocessor

Is your feature request related to a problem? Please describe.
Currently there is no exact steps for integrating allure plugin with cypress-webpack preprocessor

Describe the solution you'd like
Example repo how to integrate allure plugin into framework with webpack preprocessor used.

Screenshots are saved into allure-results even when allure is disabled

Describe the bug
When Allure is disabled and screenshot is in the end of test - it is anyway saved to allure-results folder.

To Reproduce
Steps to reproduce the behavior:

  1. pass allure=false env variable
  2. add cy.screenshot in the end of test
  3. run tests: yarn cy:run

Expected behavior
As Allure is disabled, screenshot should not be saved into allure-results

Unable to generate allure-results folder in Cypress TypeScript which causes NaN% while viewing the report

I am trying to create the Allure report for my Cypress TypeScript project and the allure-results folder is not created or it is not running with the dynamic environments like qa, stage, stage2
When I run with the below command either any one is triggered either environmental configFile or allure but not the both.

npx cypress-tags run TAGS="@TC_170" --env configFile=qa --browser chrome allure=true

If I give allure near --env the configFile is not taking the qa value.

I have followed the instruction as per the npmjs.com @shelex

package.json

"scripts": {
    "cypress:open": "npx cypress open --env configFile=qa --browser chrome",
    "cypress:run": "npx cypress run --env configFile=qa --browser chrome",
    "allure:report": "allure generate allure-results --clean -o allure-report",
    "allure:clear":"if exist allure-results rmdir /q /s allure-results && if exist allure-report rmdir /q /s allure-report && if exist 
                          cypress\\screenshots rmdir /q /s cypress\\screenshots && if exist cypress\\videos rmdir /q /s cypress\\videos",
    "pretest":"npm run allure:clear",
    "test":"npm run qa || npm run posttest" ,
    "posttest":"npm run allure:report"

 },
"dependencies": {
    "@shelex/cypress-allure-plugin": "^2.2.1",
    "@types/cypress-cucumber-preprocessor": "^4.0.0",
    "allure-commandline": "^2.13.8",
    "cypress": "6.2.1",
    "cypress-cucumber-preprocessor": "2.0.1",
    "fs-extra": "^9.1.0",
    "mssql": "6.1.0",
    "mysql2": "2.2.5",
    "path": "^0.12.7",
    "tsify": "^5.0.2",
    "typescript": "^3.4.5"
  },
  "cypress-cucumber-preprocessor": {
    "nonGlobalStepDefinitions": false
  },
  "devDependencies": {
    "@types/node": "^14.14.20",
    "cypress-plugin-tab": "^1.0.5",
    "cypress-sql-server": "^1.0.0",
    "cypress-xpath": "^1.6.1"
  }

cypress/plugins/index.js

const cucumber = require("cypress-cucumber-preprocessor").default;
const browserify = require("@cypress/browserify-preprocessor");
const path = require('path');
const fs = require('fs-extra');
const allureWriter = require('@shelex/cypress-allure-plugin/writer');

module.exports = (on, config) => {
  
  const options = browserify.defaultOptions;
  options.browserifyOptions.plugin.unshift(['tsify']);
  on("file:preprocessor", cucumber(options));

  allureWriter(on, config);
  return config;
}

support/index.ts

import '@shelex/cypress-allure-plugin';

tsconfig.json

"include": [
      "../node_modules/@shelex/cypress-allure-plugin/reporter",
      "../node_modules/cypress"
    ]

How to solve this NaN% issue as below I hope this is because of allure-results is not available/generated

allure generate allure-results --clean -o allure-report
allure-results does not exist
Report successfully generated to allure-report

Module exports doesn't work correct with typescript

Describe the bug
There is an error when trying to connect the allure plugin with cypress in plugin/index.ts file and the project is on the typescript.

Steps to reproduce the behavior:

  1. Connect plugin with import in plugin/index.ts file import allureWriter from "@shelex/cypress-allure-plugin/writer";
  2. Run cypress npx cypress open
  3. Error
**Message:** The function exported by the plugins file threw an error.

We invoked the function exported by `~/project/cypress/plugins/index.ts`, but it threw an error.

**Details:** TypeError: writer_1.default is not a function
   at ~/project/cypress/plugins/index.ts:25:15
   at /Users/andrii/Library/Caches/Cypress/6.3.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_plugins.js:89:12
   at tryCatcher (/Users/andrii/Library/Caches/Cypress/6.3.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
   at Function.Promise.attempt.Promise.try (/Users/andrii/Library/Caches/Cypress/6.3.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/method.js:39:29)
   at load (/Users/andrii/Library/Caches/Cypress/6.3.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_plugins.js:86:7)
   at EventEmitter.<anonymous> (/Users/andrii/Library/Caches/Cypress/6.3.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_plugins.js:200:5)
   at EventEmitter.emit (node:events:365:28)
   at process.<anonymous> (/Users/andrii/Library/Caches/Cypress/6.3.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/util.js:19:22)
   at process.emit (node:events:365:28)
   at process.emit (/Users/andrii/Library/Caches/Cypress/6.3.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/source-map-support/source-map-support.js:495:21)
   at emit (node:internal/child_process:920:12)
   at processTicksAndRejections (node:internal/process/task_queues:84:21)

Stack trace:

Error: The function exported by the plugins file threw an error.

We invoked the function exported by `~/project/cypress/plugins/index.ts`, but it threw an error.
    at Object.get (/Users/andrii/Library/Caches/Cypress/6.3.0/Cypress.app/Contents/Resources/app/packages/server/lib/errors.js:968:15)
    at EventEmitter.<anonymous> (/Users/andrii/Library/Caches/Cypress/6.3.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/index.js:144:21)
    at EventEmitter.emit (events.js:315:20)
    at ChildProcess.<anonymous> (/Users/andrii/Library/Caches/Cypress/6.3.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/util.js:19:22)
    at ChildProcess.emit (events.js:315:20)
    at emit (internal/child_process.js:876:12)
    at processTicksAndRejections (internal/process/task_queues.js:85:21)

Expected behavior
Cypress runner start working

It works if import all library:
import * as allureWriter from "@shelex/cypress-allure-plugin/writer";

Environment:

  • OS: Mac
  • Cypress package version: 6.3.0
  • Cypress binary version: 6.3.0
  • Electron version: 11.2.0
  • Bundled Node version: 12.18.3
  • node 16.0.0

Cannot read property 'addAttachment' of null

Getting Cannot read property 'addAttachment' of null in before all hook

Environment (please complete the following information):
"@shelex/cypress-allure-plugin": "1.8.0",
"cypress": "4.1.0",

Windows 10 pro 64 bit OS

Automatically create Allure steps out of custom commands

Is your feature request related to a problem? Please describe.
In Java-based frameworks, Allure automatically creates steps out of test methods and sets the step name to method name. Test engineer can optionally add @step annotation to the method to add a readable step name to the report. In Cypress however all instructions (and XHRs) are treated as separate steps regardless of whether they're a part of custom command or not. The only way to transform them into a proper Allure step is to manually add cy.allure().step('Step name') chainer to every custom command (which is tedious)

Describe the solution you'd like
Custom commands are automatically turned into steps with the step name set to command name and command arguments listed after the step name, e.g

Cypress.Commands.add('Do something', (variable) => {
//step content here
});

Would create Allure step named Do something, variable
Additional context
Add any other context or screenshots about the feature request here.

SubSuites for skiped tests

Describe the bug
Tests with label subSuite and with mark skip lose their suites.

Example

describe('suiteName', function(){

  • cy.allure().label('subSuite', 'subSuiteName');

  • it.skip('testName', function () {

  • .......

  • }

}

Current behavior
Test testName will be situated in folder suiteName.

Desired behavior
Test testName should be situated in subfolder subSuiteName in folder suiteName.

Conflict with FileUploadManager

Describe the bug
If you use allure report and file upload manager then you have a conflict with the attach file command in the tests

To Reproduce
Steps to reproduce the behavior:

  1. Install file upload manager and allure reporter
  2. Write test with command cy.get('something').attachFile(youFixturePath)
  3. Run test with command "npm"

Expected behavior
Test execution.

Environment (please complete the following information):

  • Cypress version: 6.2.0
  • Allure-plugin: 1.10.1
  • Cypress-file-upload: 4.1.1
  • OS: Windows

Screenshots not getting attached?

Describe the bug
Screenshots not getting attached on latest version, data/attachments folder is empty although a screenshot is created..

Empty attachments from report
image

Screenshots in cypress
image

Empty attachments folder:
image

Expected behavior
A clear and concise description of what you expected to happen.

Environment (please complete the following information):

  • Cypress version: 5.1.0
  • OS: Mac
  • allure-report 1.8.2

** Developer Tools Console Output **

Additional context
Add any other context about the problem here.

TypeError: Cannot read property 'config' of undefined

I am getting below Error for my package while loading the page.

TypeError: Cannot read property 'config' of undefined
at eval (webpack-internal:///./src/pages/Dynamo.tsx:5:5)
at Object../src/pages/Dynamo.tsx (/workplace/neethas/ART_web_Testing/src/ARTWeb_testing/.next/server/pages/Dynamo.js:103:1)
at webpack_require (/workplace/neethas/ART_web_Testing/src/ARTWeb_testing/.next/server/pages/Dynamo.js:23:31)
at /workplace/neethas/ART_web_Testing/src/ARTWeb_testing/.next/server/pages/Dynamo.js:91:18
at Object. (/workplace/neethas/ART_web_Testing/src/ARTWeb_testing/.next/server/pages/Dynamo.js:92:12)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Module.m._compile (/workplace/neethas/ART_web_Testing/src/ARTWeb_testing/node_modules/ts-node/src/index.ts:858:23)
at Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Object.require.extensions. [as .js] (/workplace/neethas/ART_web_Testing/src/ARTWeb_testing/node_modules/ts-node/src/index.ts:861:12)
at Module.load (internal/modules/cjs/loader.js:985:32)

My Index.config.js file
// eslint-disable-next-line @typescript-eslint/no-var-requires
const artConfig = require("@amzn/art-next-configuration");

const stage = (process.env.STAGE || "local").toLowerCase();
const isRDE = process.env.IS_RDE;

function getAssetPrefix(stage) {
return stage === "local" || isRDE === "true"
? ""
: // TODO: add your CloudFront URL here
"https://.cloudfront.net/assets";
}

module.exports = artConfig({
distDir: ".next",
assetPrefix: getAssetPrefix(stage),
});

module.exports = {
webpack: (config, { isServer }) => {
// Fixes npm packages that depend on fs module
if (!isServer) {
config.node = {
fs: 'empty'
}
}

return config

}
}

my index,js file

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var os_1 = require("os");
var path_1 = require("path");
var fs_1 = require("fs");
exports.ENV_CREDENTIALS_PATH = 'AWS_SHARED_CREDENTIALS_FILE';
exports.ENV_CONFIG_PATH = 'AWS_CONFIG_FILE';
var swallowError = function () { return ({}); };
function loadSharedConfigFiles(init) {
if (init === void 0) { init = {}; }
var _a = init.filepath, filepath = _a === void 0 ? process.env[exports.ENV_CREDENTIALS_PATH]
|| path_1.join(getHomeDir(), '.aws', 'credentials') : _a, _b = init.configFilepath, configFilepath = _b === void 0 ? process.env[exports.ENV_CONFIG_PATH]
|| path_1.join(getHomeDir(), '.aws', 'config') : _b;
return Promise.all([
slurpFile(configFilepath)
.then(parseIni)
.then(normalizeConfigFile)
.catch(swallowError),
slurpFile(filepath)
.then(parseIni)
.catch(swallowError),
]).then(function (parsedFiles) {
var configFile = parsedFiles[0], credentialsFile = parsedFiles[1];
return {
configFile: configFile,
credentialsFile: credentialsFile,
};
});
}
exports.loadSharedConfigFiles = loadSharedConfigFiles;
var profileKeyRegex = /^profile\s(["'])?([^\1]+)\1$/;
function normalizeConfigFile(data) {
var map = {};
for (var _i = 0, _a = Object.keys(data); _i < _a.length; _i++) {
var key = _a[_i];
var matches = void 0;
if (key === 'default') {
map.default = data.default;
}
else if (matches = profileKeyRegex.exec(key)) {
var _1 = matches[0], _2 = matches[1], normalizedKey = matches[2];
if (normalizedKey) {
map[normalizedKey] = data[key];
}
}
}
return map;
}
function parseIni(iniData) {
var map = {};
var currentSection;
for (var _i = 0, _a = iniData.split(/\r?\n/); _i < _a.length; _i++) {
var line = _a[_i];
line = line.split(/(^|\s)[;#]/)[0]; // remove comments
var section = line.match(/^\s*[([^\[\]]+)]\s*$/);
if (section) {
currentSection = section[1];
}
else if (currentSection) {
var item = line.match(/^\s*(.+?)\s*=\s*(.+?)\s*$/);
if (item) {
map[currentSection] = map[currentSection] || {};
map[currentSection][item[1]] = item[2];
}
}
}
return map;
}
function slurpFile(path) {
return new Promise(function (resolve, reject) {
fs_1.readFile(path, 'utf8', function (err, data) {
if (err) {
reject(err);
}
else {
resolve(data);
}
});
});
}
function getHomeDir() {
var _a = process.env, HOME = _a.HOME, USERPROFILE = _a.USERPROFILE, HOMEPATH = _a.HOMEPATH, _b = _a.HOMEDRIVE, HOMEDRIVE = _b === void 0 ? "C:" + path_1.sep : _b;
if (HOME)
return HOME;
if (USERPROFILE)
return USERPROFILE;
if (HOMEPATH)
return "" + HOMEDRIVE + HOMEPATH;
return os_1.homedir();
}
//# sourceMappingURL=index.js.map

A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Do this
  2. Then do that
  3. See error

Expected behavior
A clear and concise description of what you expected to happen.

Environment (please complete the following information):

  • Cypress version: #.##
  • OS: Windows | Mac | Linux (distro):

** Developer Tools Console Output **

Additional context
Add any other context about the problem here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.