bartonhammond Github contribution chart
bartonhammond Github Stats
bartonhammond Most Used Languages

Activity

03 Aug 2022

Bartonhammond

started

Started On 03 Aug 2022 at 12:04:13

Bartonhammond

having issue with json report generation

Current behavior

Tests run fine however json reports are stopped generating. everything was working fine with cypress version <10 and also cypress-cucumber-preprocessor <10 (before repo migration). I have completed the steps mentioned here https://github.com/badeball/cypress-cucumber-preprocessor/blob/master/docs/json-report.md installed json-fomatter but still no luck.

e2e. js (support file)

import { addCucumberPreprocessorPlugin } from '@badeball/cypress-cucumber-preprocessor'; export default async ( on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions ): Promise<Cypress.PluginConfigOptions> => { await addCucumberPreprocessorPlugin(on, config); return config; };

cypress.config.json

async function setupNodeEvents(on, config) { await preprocessor.addCucumberPreprocessorPlugin(on, config);

on(
    'file:preprocessor',
    webpack({
        webpackOptions: {
            resolve: {
                extensions: ['.ts', '.js'],
            },
            module: {
                rules: [
                    {
                        test: /\.ts$/,
                        exclude: [/node_modules/],
                        use: [
                            {
                                loader: 'ts-loader',
                            },
                        ],
                    },
                    {
                        test: /\.feature$/,
                        use: [
                            {
                                loader: '@badeball/cypress-cucumber-preprocessor/webpack',
                                options: config,
                            },
                        ],
                    },
                ],
            },
        },
    })
); 

When I run tests getting

if I just comment out the e2e.js file or set support file=false in config then tests run fine but no json reports.

Any suggestion is appreciated.

Desired behavior

json reports are generated when test completes running.

Versions

  • Cypress version: 10.3.0
  • Preprocessor version:11.4.0
  • Node version:16.13.1

Checklist

  • [x ] I've read the FAQ.
  • [ x] I've read Instructions for logging issues.
  • [ x] I'm not using cypress-cucumber-preprocessor@4.3.1 (package name has changed and it is no longer the most recent version, see #689).

Forked On 20 Jul 2022 at 12:20:05

Bartonhammond

@oguzhantx Thanks! You video and project was very helpful - thank you. My reports are all running again.

Commented On 20 Jul 2022 at 12:20:05

Bartonhammond

No json or ndjson files created

Looking for some help.

I can run my cucumber features successfully with Cypress 10.3

.cypress-cucumber-preprocessorrc.json

{
  "json": {
    "enabled": true,
    "formatter": "node",
    "args": [
      "report-formatter.js"
    ]
  },
  "messages": {
    "enabled": true,
    "output": "./messages.ndjson"
  }
} 

report-formatter.js

const Formatter = require('cucumber-json-report-formatter').Formatter;

const formatter = new Formatter();
const sourceFile = "./messages.ndjson"
const outputFile = "./cucumber-report.json"

await formatter.parseCucumberJson(sourceFile, outputFile); 

After running single scenario, no files are generated

I tried putting the configuration w/in thepackage.json file too but nothing worked.

Forked On 19 Jul 2022 at 08:24:40

Bartonhammond

Doh! my bad. Works when "run" no "open"

Commented On 19 Jul 2022 at 08:24:40

Bartonhammond

started

Started On 19 Jul 2022 at 02:18:01

Bartonhammond

having issue with json report generation

Current behavior

Tests run fine however json reports are stopped generating. everything was working fine with cypress version <10 and also cypress-cucumber-preprocessor <10 (before repo migration). I have completed the steps mentioned here https://github.com/badeball/cypress-cucumber-preprocessor/blob/master/docs/json-report.md installed json-fomatter but still no luck.

e2e. js (support file)

import { addCucumberPreprocessorPlugin } from '@badeball/cypress-cucumber-preprocessor'; export default async ( on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions ): Promise<Cypress.PluginConfigOptions> => { await addCucumberPreprocessorPlugin(on, config); return config; };

cypress.config.json

async function setupNodeEvents(on, config) { await preprocessor.addCucumberPreprocessorPlugin(on, config);

on(
    'file:preprocessor',
    webpack({
        webpackOptions: {
            resolve: {
                extensions: ['.ts', '.js'],
            },
            module: {
                rules: [
                    {
                        test: /\.ts$/,
                        exclude: [/node_modules/],
                        use: [
                            {
                                loader: 'ts-loader',
                            },
                        ],
                    },
                    {
                        test: /\.feature$/,
                        use: [
                            {
                                loader: '@badeball/cypress-cucumber-preprocessor/webpack',
                                options: config,
                            },
                        ],
                    },
                ],
            },
        },
    })
); 

When I run tests getting

if I just comment out the e2e.js file or set support file=false in config then tests run fine but no json reports.

Any suggestion is appreciated.

Desired behavior

json reports are generated when test completes running.

Versions

  • Cypress version: 10.3.0
  • Preprocessor version:11.4.0
  • Node version:16.13.1

Checklist

  • [x ] I've read the FAQ.
  • [ x] I've read Instructions for logging issues.
  • [ x] I'm not using cypress-cucumber-preprocessor@4.3.1 (package name has changed and it is no longer the most recent version, see #689).

Forked On 14 Jul 2022 at 02:42:03

Bartonhammond

@oguzhantx Did you ever get this working? I can run my tests but no JSON is emitted. Here's what I have done 0) running on windows 10 w/in bash

  1. I installed the Standalone JSON Formatter (https://github.com/cucumber/json-formatter/releases/download/v19.0.0/cucumber-json-formatter-windows-amd64)
  2. I moved it to my path and renamed it and confirmed it was installed
~/git/smc-cypress (hotfix/upgrade10)
$ cucumber-json-formatter.exe --help
Usage of C:\Users\hammonbu\bin\cucumber-json-formatter.exe: 
  1. created cypress/support/e2e.ts with the following and confirmed it is invoked by adding console.log
import { addCucumberPreprocessorPlugin } from "@badeball/cypress-cucumber-preprocessor";

export default async (
  on: Cypress.PluginEvents,
  config: Cypress.PluginConfigOptions
): Promise<Cypress.PluginConfigOptions> => {
  await addCucumberPreprocessorPlugin(on, config);

  // Make sure to return the config object as it might have been modified by the plugin.
 console.log('config',config);
  return config;
} 

console.log

config {
  animationDistanceThreshold: 5,
  arch: 'x64',
  autoOpen: false,
  baseUrl: null,
  blockHosts: null,
  browsers: [
    {
      name: 'chrome',
      family: 'chromium',
      channel: 'stable',
      displayName: 'Chrome',
      version: '103.0.5060.66',
      path: 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe',
      minSupportedVersion: 64,
      majorVersion: 103
    },
    {
      name: 'edge',
      family: 'chromium',
      channel: 'stable',
      displayName: 'Edge',
      version: '103.0.1264.49',
      path: 'C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe',
      minSupportedVersion: 79,
      majorVersion: 103
    },
    {
      name: 'electron',
      channel: 'stable',
      family: 'chromium',
      displayName: 'Electron',
      version: '100.0.4896.160',
      path: '',
      majorVersion: 100,
      info: 'Electron is the default browser that comes with Cypress. This is the default browser that runs in headless mode. Selecting this browser is useful when debugging. The version number indicates the underlying Chromium version that Electron uses.'
    }
  ],
  chromeWebSecurity: true,
  clientCertificates: [],
  clientRoute: '/__/',
  configFile: 'C:\\Users\\hammonbu\\git\\smc-cypress\\cypress.config.js',
  cypressBinaryRoot: 'C:\\Users\\hammonbu\\AppData\\Local\\Cypress\\Cache\\10.3.0\\Cypress\\resources\\app',
  cypressEnv: 'production',
  defaultCommandTimeout: 4000,
  devServerPublicPathRoute: '/__cypress/src',
  downloadsFolder: 'C:\\Users\\hammonbu\\git\\smc-cypress\\cypress\\downloads',
  env: {
    host: 'http://127.0.0.1:9081/smc-web/',
    ENV: 'dev'
  },
  excludeSpecPattern: '*.hot-update.js',
  execTimeout: 60000,
  experimentalFetchPolyfill: false,
  experimentalInteractiveRunEvents: false,
  experimentalSessionAndOrigin: false,
  experimentalSourceRewriting: false,
  fileServerFolder: 'C:\\Users\\hammonbu\\git\\smc-cypress',
  fixturesFolder: 'C:\\Users\\hammonbu\\git\\smc-cypress\\cypress\\fixtures',
  hosts: null,
  includeShadowDom: false,
  isInteractive: true,
  isTextTerminal: false,
  keystrokeDelay: 0,
  modifyObstructiveCode: true,
  morgan: true,
  namespace: '__cypress',
  numTestsKeptInMemory: 50,
  pageLoadTimeout: 60000,
  platform: 'win32',
  port: null,
  projectId: null,
  projectName: 'smc-cypress',
  projectRoot: 'C:\\Users\\hammonbu\\git\\smc-cypress',
  rawJson: {
    e2e: {
      specPattern: '**/*.feature',
      supportFile: 'cypress/support/index.js',
      setupNodeEvents: '[Function setupNodeEvents]'
    },
    specPattern: '**/*.feature',
    supportFile: 'cypress/support/index.js',
    setupNodeEvents: '[Function setupNodeEvents]',
    projectRoot: 'C:\\Users\\hammonbu\\git\\smc-cypress',
    projectName: 'smc-cypress'
  },
  redirectionLimit: 20,
  reporter: 'spec',
  reporterOptions: null,
  reporterRoute: '/__cypress/reporter',
  requestTimeout: 5000,
  resolved: {
    animationDistanceThreshold: { value: 5, from: 'default' },
    arch: { value: 'x64', from: 'default' },
    baseUrl: { value: null, from: 'default' },
    blockHosts: { value: null, from: 'default' },
    chromeWebSecurity: { value: true, from: 'default' },
    clientCertificates: { value: [], from: 'default' },
    defaultCommandTimeout: { value: 4000, from: 'default' },
    downloadsFolder: { value: 'cypress/downloads', from: 'default' },
    env: {
      host: [Object],
      username: [Object],
      password: [Object],
      ENV: [Object]
    },
    execTimeout: { value: 60000, from: 'default' },
    experimentalFetchPolyfill: { value: false, from: 'default' },
    experimentalInteractiveRunEvents: { value: false, from: 'default' },
    experimentalSessionAndOrigin: { value: false, from: 'default' },
    experimentalSourceRewriting: { value: false, from: 'default' },
    fileServerFolder: { value: '', from: 'default' },
    fixturesFolder: { value: 'cypress/fixtures', from: 'default' },
    excludeSpecPattern: { value: '*.hot-update.js', from: 'default' },
    includeShadowDom: { value: false, from: 'default' },
    keystrokeDelay: { value: 0, from: 'default' },
    modifyObstructiveCode: { value: true, from: 'default' },
    numTestsKeptInMemory: { value: 50, from: 'default' },
    platform: { value: 'win32', from: 'default' },
    pageLoadTimeout: { value: 60000, from: 'default' },
    port: { value: null, from: 'default' },
    projectId: { value: null, from: 'default' },
    redirectionLimit: { value: 20, from: 'default' },
    reporter: { value: 'spec', from: 'default' },
    reporterOptions: { value: null, from: 'default' },
    requestTimeout: { value: 5000, from: 'default' },
    resolvedNodePath: { value: null, from: 'default' },
    resolvedNodeVersion: { value: null, from: 'default' },
    responseTimeout: { value: 30000, from: 'default' },
    retries: { value: [Object], from: 'default' },
    screenshotOnRunFailure: { value: true, from: 'default' },
    screenshotsFolder: { value: 'cypress/screenshots', from: 'default' },
    slowTestThreshold: { value: 10000, from: 'default' },
    scrollBehavior: { value: 'top', from: 'default' },
    supportFile: { value: 'cypress/support/index.js', from: 'config' },
    supportFolder: { value: false, from: 'default' },
    taskTimeout: { value: 60000, from: 'default' },
    trashAssetsBeforeRuns: { value: true, from: 'default' },
    userAgent: { value: null, from: 'default' },
    video: { value: true, from: 'default' },
    videoCompression: { value: 32, from: 'default' },
    videosFolder: { value: 'cypress/videos', from: 'default' },
    videoUploadOnPasses: { value: true, from: 'default' },
    viewportHeight: { value: 660, from: 'default' },
    viewportWidth: { value: 1000, from: 'default' },
    waitForAnimations: { value: true, from: 'default' },
    watchForFileChanges: { value: true, from: 'default' },
    specPattern: { value: '**/*.feature', from: 'config' },
    browsers: { value: [Array], from: 'runtime' },
    hosts: { value: null, from: 'default' },
    isInteractive: { value: true, from: 'default' }
  },
  resolvedNodePath: 'C:\\Users\\hammonbu\\.nvm\\versions\\node\\v14.16.0\\bin\\node.exe',
  resolvedNodeVersion: '14.16.0',
  responseTimeout: 30000,
  retries: { runMode: 0, openMode: 0 },
  screenshotOnRunFailure: true,
  screenshotsFolder: 'C:\\Users\\hammonbu\\git\\smc-cypress\\cypress\\screenshots',
  scrollBehavior: 'top',
  setupNodeEvents: '[Function setupNodeEvents]',
  slowTestThreshold: 10000,
  socketId: null,
  socketIoCookie: '__socket',
  socketIoRoute: '/__socket',
  specPattern: '**/*.feature',
  supportFile: 'C:\\Users\\hammonbu\\git\\smc-cypress\\cypress\\support\\index.js',
  supportFolder: 'C:\\Users\\hammonbu\\git\\smc-cypress\\cypress\\support',
  taskTimeout: 60000,
  trashAssetsBeforeRuns: true,
  userAgent: null,
  version: '10.3.0',
  video: true,
  videoCompression: 32,
  videoUploadOnPasses: true,
  videosFolder: 'C:\\Users\\hammonbu\\git\\smc-cypress\\cypress\\videos',
  viewportHeight: 660,
  viewportWidth: 1000,
  waitForAnimations: true,
  watchForFileChanges: true,
  xhrRoute: '/xhrs/',
  testingType: 'e2e'
} 
  1. updated cypress\support\index.js with this:
import "./commands";
import "./e2e"; 
  1. created .cypress-cucumber-preprocessorrc.json in root (above cypress - at level of ``package.json)` and it contains
{
  "json": {
    "enabled": true
  }
} 
  1. I start cypress and run tests and kill all
  2. no errors are reported anywhere and no JSON file is emitted.

Commented On 14 Jul 2022 at 02:42:03

Bartonhammond

configFile is invalid: Cannot find module 'esbuild'

Current behavior

I am upgrading to this project (from original 4.3) and to cypress 10 at same time I've searched Stackoverflow for answers I've read guide to upgrading to version 11 I've read guide to upgrading to Cypress 10

I've rm -rf node_modules updated package.json and cypress.config.js and then npm install and then npx cypress open

Error: Cannot find module 'esbuild'
Require stack:
- C:\Users\hammonbu\git\smc-cypress\node_modules\@bahmutov\cypress-esbuild-preprocessor\src\index.js
- C:\Users\hammonbu\git\smc-cypress\cypress.config.js
- C:\Users\hammonbu\AppData\Local\Cypress\Cache\10.3.0\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_require_async_child.js
- C:\Users\hammonbu\AppData\Local\Cypress\Cache\10.3.0\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\require_async_child.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object. (C:\Users\hammonbu\git\smc-cypress\node_modules\@bahmutov\cypress-esbuild-preprocessor\src\index.js:1:17)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object. (C:\Users\hammonbu\git\smc-cypress\cypress.config.js:2:23)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at loadFile (C:\Users\hammonbu\AppData\Local\Cypress\Cache\10.3.0\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_require_async_child.js:89:14)
    at EventEmitter. (C:\Users\hammonbu\AppData\Local\Cypress\Cache\10.3.0\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_require_async_child.js:116:38)
    at EventEmitter.emit (events.js:315:20)
    at process. (C:\Users\hammonbu\AppData\Local\Cypress\Cache\10.3.0\Cypress\resources\app\node_modules\@packages\server\lib\plugins\util.js:33:22) 

cypress.config.js

const { defineConfig } = require('cypress')
const createBundler = require("@bahmutov/cypress-esbuild-preprocessor");
const preprocessor = require("@badeball/cypress-cucumber-preprocessor");
const createEsbuildPlugin = require("@badeball/cypress-cucumber-preprocessor/esbuild");

async function setupNodeEvents(on, config) {
    await preprocessor.addCucumberPreprocessorPlugin(on, config);

    on(
        "file:preprocessor",
        createBundler({
            plugins: [createEsbuildPlugin.default(config)],
        })
    );

    // Make sure to return the config object as it might have been modified by the plugin.
    return config;
}

module.exports = defineConfig({
    e2e: {
        specPattern: "**/*.feature",
        supportFile: "cypress/support/index.js",
        setupNodeEvents
    }
}) 

package.json

 "dependencies": {
    "@badeball/cypress-cucumber-preprocessor": "^11.5.0",
    "@bahmutov/cypress-esbuild-preprocessor": "^2.1.3",
    "cypress": "^10.3.0"
  } 

Desired behavior

Test code to reproduce

Versions

  • Cypress version: 11.5.0
  • Preprocessor version: 2.1.3
  • Node version: v14.16.0

Checklist

  • [Y] I've read the FAQ.
  • [Y] I've read Instructions for logging issues.
  • [Y] I'm not using cypress-cucumber-preprocessor@4.3.1 (package name has changed and it is no longer the most recent version, see #689).

Forked On 14 Jul 2022 at 01:22:52

Bartonhammond

@badeball Um - ok - didn't know that - thanks

Commented On 14 Jul 2022 at 01:22:52

Bartonhammond

started

Started On 13 Jul 2022 at 08:35:14

Bartonhammond

started

Started On 30 Jun 2022 at 04:09:05