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: Error happened in task "allureReportTest" when the test is skipped in beforeEach() #930

Open
jillyj opened this issue Apr 15, 2024 · 1 comment
Assignees

Comments

@jillyj
Copy link

jillyj commented Apr 15, 2024

Describe the bug
Error happened in task "allureReportTest" when the test is skipped in beforeEach()

To Reproduce
Steps to reproduce the behavior:

  1. Set env var SKIP_TESTS to true.
  2. Run the test which has a logic to conditionally skip the tests in beforeEach()
context('Conditional run', () => {
  let skip = false;
  before(() => {
    cy.get('div').then(($div) => {
      if (Cypress.env('SKIP_TESTS')) {
        skip = true;
      } else {
        skip = false;
      }
    });
  });

  beforeEach(function () {
    // use regular function here
    if (skip) this.skip();
  });
  it('some test', () => {
    expect(true).to.be.true;
  });
});
  1. Error occurred as below.
    image

Expected behavior
Test can be skipped successfully and the result/report is generated.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: macOS
  • Browser: Chrome
  • Version 123.0.6312.107

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
"allure-cypress": "^2.15.1",

@jillyj jillyj changed the title Error happened in task "allureReportTest" when the test is skipped in beforeEach() Cypress: Error happened in task "allureReportTest" when the test is skipped in beforeEach() Apr 16, 2024
@epszaw epszaw self-assigned this May 14, 2024
@mihaicerchez
Copy link

@epszaw This issue happens also when the Cypress test retries are enabled and an assertion from the first test attempts fails:
image

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

3 participants