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

Cypress doesn't see e2e.ts files No such file or directory #29296

Open
Jan-Lubiejewski opened this issue Apr 10, 2024 · 2 comments
Open

Cypress doesn't see e2e.ts files No such file or directory #29296

Jan-Lubiejewski opened this issue Apr 10, 2024 · 2 comments
Labels
stage: needs information Not enough info to reproduce the issue

Comments

@Jan-Lubiejewski
Copy link

Jan-Lubiejewski commented Apr 10, 2024

Current behavior

I get the following error when I try to run any test in cypress:

ENOENT: no such file or directory, stat 'C:\Users\Jan\AppData\Roaming\Cypress\cy\production\projects\Vitalia-Automaty-c2f17adc889d91c4666136e184e89dd4\bundles\cypress\support\e2e.ts'

The structure of my repository is as follows:
C:\Users\Jan\A\VitaliaTestAutomation\Vitalia-Automaty

and here is the cypress folder. Everything works as expected buuuut when I swithc the supportFile in my config to true or set the directory with the name of the e2e.ts file it gives me this errror when I try to run any .feature file. It doesn't give an error when I run the cypress that says he can't see the e2e.ts file in my directory so it has to see it.

Here's my config file in cypress.config.ts

import { defineConfig } from "cypress";
import createBundler from "@bahmutov/cypress-esbuild-preprocessor";
import { addCucumberPreprocessorPlugin } from "@badeball/cypress-cucumber-preprocessor";
import { createEsbuildPlugin } from "@badeball/cypress-cucumber-preprocessor/esbuild";

// Define the asynchronous setup function
const setupAsync = async (on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions) => {
  // This is required for the preprocessor to be able to generate JSON reports after each run, and more,
  await addCucumberPreprocessorPlugin(on, config);

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

  return config;
};

export default defineConfig({
  projectId: "blabla",
  env: {
    url: "blablabla.pl"
    email: 'test@outlook.com'
  },
  e2e: {
    baseUrl: 'blabla.pl',
    supportFile: "cypress/support/e2e.ts", //OR supportFile: true
    includeShadowDom: true,
    chromeWebSecurity: true,
    viewportWidth: 1920,
    viewportHeight: 1080,
    specPattern: "**/*.feature",
    // Define the combined setupNodeEvents function
    setupNodeEvents(on, config) {
      // Check if on and config are provided and call the async setup function
      if (on && config) {
        return setupAsync(on, config);
      }
      // Otherwise, call the synchronous setup function
      return require('./cypress/plugins/index.js')(on, config);
    }
  },
});

Desired behavior

It should apply the e2e.ts file config and let me run any test.

Test code to reproduce

It's already in the descirption you just have to use this config I have given

Cypress Version

13.7.2

Node version

7.32.5

Operating System

Windows 11

Debug Logs

No response

Other

No response

@Jan-Lubiejewski
Copy link
Author

Jan-Lubiejewski commented Apr 10, 2024

I also tried such cypress.config.ts

import { defineConfig } from "cypress";
import createBundler from "@bahmutov/cypress-esbuild-preprocessor";
import { addCucumberPreprocessorPlugin } from "@badeball/cypress-cucumber-preprocessor";
import { createEsbuildPlugin } from "@badeball/cypress-cucumber-preprocessor/esbuild";

import "cypress/support/e2e";



export default defineConfig({
  projectId: "blablabla",
  env: {
    url: "smth.pl",
    email: 'test@outlook.com'
    }

  },
  e2e: {
    baseUrl: 'blabla.pl',
    supportFile: "cypress/support/e2e.ts",
    includeShadowDom: true,
    chromeWebSecurity: true,
    viewportWidth: 1920,
    viewportHeight: 1080,
    specPattern: "**/*.feature",
    async setupNodeEvents(
      on: Cypress.PluginEvents,
      config: Cypress.PluginConfigOptions
    ): Promise<Cypress.PluginConfigOptions> {
      // This is required for the preprocessor to be able to generate JSON reports after each run, and more,
      await addCucumberPreprocessorPlugin(on, config);

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

      return config;
    },
  },
});

No luck either.

@jennifer-shehane
Copy link
Member

Could you try following these instructions to Clear App Data?

If that doesn’t do anything, could you run Cypress in debug mode mode and print the entire set of logs here?

@jennifer-shehane jennifer-shehane added the stage: needs information Not enough info to reproduce the issue label Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage: needs information Not enough info to reproduce the issue
Projects
None yet
Development

No branches or pull requests

2 participants