Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration is not working with cucumber-preprocessor on ES6 format - file with .jmx extension #1

Open
rakeshnambiar opened this issue Dec 14, 2022 · 2 comments

Comments

@rakeshnambiar
Copy link

rakeshnambiar commented Dec 14, 2022

I am getting the error SyntaxError: Unexpected reserved word while trying to integrate the sdk with the existing cucumber-based cypress test suite.

import { defineConfig } from "cypress";
import { registerSmartDriverTasks } from "@devtools-ai/cypress-sdk/dist/plugins.js";
import preprocessor from "@badeball/cypress-cucumber-preprocessor";
import browserify from "@badeball/cypress-cucumber-preprocessor/browserify.js";

export default defineConfig({
  retries: 1,
  e2e: {
   async setupNodeEvents(on, config) {
      await preprocessor.addCucumberPreprocessorPlugin(on, config);
      on("file:preprocessor", browserify.default(config));
      registerSmartDriverTasks(on, config);
      return config;
      // implement node event listeners here
    },
    env: {
      interactiveMode: true,
    },
  },
  chromeWebSecurity: false,
});

To know further on the preprocessor settings please refer to https://github.com/badeball/cypress-cucumber-preprocessor/tree/master/examples/browserify-esm

@rakeshnambiar
Copy link
Author

@etienne-dev-tools Please could you help?

@rakeshnambiar
Copy link
Author

rakeshnambiar commented Jan 16, 2023

I also tried with the below config:

import { defineConfig } from "cypress";
import { registerSmartDriverTasks } from "@devtools-ai/cypress-sdk/dist/plugins.js";
import preprocessor from "@badeball/cypress-cucumber-preprocessor";
import browserify from "@badeball/cypress-cucumber-preprocessor/browserify.js";

export async function setupNodeEvents(on, config) {
  // This is required for the preprocessor to be able to generate JSON reports after each run, and more,
  await preprocessor.addCucumberPreprocessorPlugin(on, config);
  on("file:preprocessor", browserify.default(config));
  await registerSmartDriverTasks(on, config);
  // Make sure to return the config object as it might have been modified by the plugin.
  return config;
}

export default defineConfig({
  e2e: {
    specPattern: "**/*.feature",
    supportFile: false,
    setupNodeEvents,
    baseUrl: "https://my-app-url.com",
    browser: "Chrome"
  },
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant