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

Issues with applying the fix with cypress-cucumber-preprocessor #8

Open
AlexVeeva opened this issue Nov 14, 2024 · 0 comments
Open

Comments

@AlexVeeva
Copy link

Hello

Below is the code for my cypress config:

import { addCucumberPreprocessorPlugin } from '@badeball/cypress-cucumber-preprocessor';
import { createEsbuildPlugin } from '@badeball/cypress-cucumber-preprocessor/esbuild';
import createBundler from '@bahmutov/cypress-esbuild-preprocessor';
import { defineConfig } from 'cypress';
import cypressOnFix from 'cypress-on-fix';

export default defineConfig({
  viewportHeight: 1080,
  viewportWidth: 1920,
  retries: { openMode: 0, runMode: 2 },
  screenshotOnRunFailure: true,
  video: true,
  trashAssetsBeforeRuns: true,
  watchForFileChanges: false,
  defaultCommandTimeout: 6000,
  env: {
    omitFiltered: true,
    filterSpecs: true,
  },
  e2e: {
    testIsolation: false,
    specPattern: [
      'cypress/e2e/*.feature', // Include all .feature files
      'cypress/e2e/*.cy.ts', // Include all .cy.ts files
    ],

    async setupNodeEvents(
      cypressOn: Cypress.PluginEvents,
      config: Cypress.PluginConfigOptions,
    ): Promise<Cypress.PluginConfigOptions> {
      // Apply cypress-on-fix to handle event issues https://github.com/bahmutov/cypress-on-fix
      const on: any = cypressOnFix(cypressOn);

      await addCucumberPreprocessorPlugin(on, config);

      // Add cucumber preprocessor to digest the .feature files and change them to .js
      on(
        'file:preprocessor',
        createBundler({
          plugins: [createEsbuildPlugin(config)],
        }),
      );

      // Change browser window size when cypress:open is run
      on('before:browser:launch', (browser: any, launchOptions: any) => {
        if (browser.name === 'chrome') {
          launchOptions.args.push('--window-size=2000,2400');
        }
        return launchOptions;
      });

      return config;
    },
  },
});

But unfortunately, even with this fix, I get errors where the "other plugins" are overwriting event handlers:

image

Any help would be appreciated, thank you

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