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

BeforeAll Wrong! #1250

Closed
LeohsPaixao opened this issue Oct 10, 2024 · 3 comments
Closed

BeforeAll Wrong! #1250

LeohsPaixao opened this issue Oct 10, 2024 · 3 comments

Comments

@LeohsPaixao
Copy link

Current behavior

image
image

'BeforeAll' of all other specs is running on a specific spec, where it contains only one 'BeforeAll'.

Desired behavior

Only the 'BeforeAll' of the specified spec runs in the tests.

Test code to reproduce

BeforeAll(() => {
  cy.login('######@####.com.br', '######');
  createProject().then((data) => {
    projectIdentifier = data.identificador;
  });
});

Given('[atividade] entrar na rota {string}', (route: string) => {
  cy.visitAndwait(`${route}/${projectIdentifier}`);
  cy.checkDomLoaded();
  atividades.validateVisibleAtividades();
});

Versions

  • Cypress version: 13.10.0
  • Preprocessor version: 20.0.5
  • Node version: 20.14

Checklist

@badeball
Copy link
Owner

This could very well be intended behavior, depending on your configuration and file hierarchy, like if each feature is paired with every file containing hooks & step definitions.

In any case, you need to provide a complete & runnable example illustrating the issue.

@LeohsPaixao
Copy link
Author

Unfortunately, I can't show you the code anymore as it's from a company project. Regarding the file hierarchy, the specs are separated by modules and each one has its own 'BeforeAll', i.e. there is no dependency between them. But basically, all the BeforeAlls for each spec are the same, doing practically the same thing, as in the code I sent above.

  "cypress-cucumber-preprocessor": {
    "nonGlobalStepDefinitions": false,
    "stepDefinitions": "./e2e/specs/**/**/step_definitions/**/*.spec.ts",
    "html": {
      "enabled": true
    }

@LeohsPaixao
Copy link
Author

This could very well be intended behavior, depending on your configuration and file hierarchy, like if each feature is paired with every file containing hooks & step definitions.

In any case, you need to provide a complete & runnable example illustrating the issue.

Oooooh, I understood.

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

2 participants