Shelex / cypress-allure-plugin

cypress plugin to use allure reporter api in tests
https://shelex.github.io/cypress-allure-plugin-example/
Apache License 2.0
159 stars 44 forks source link

After hook in the test body #118

Closed olikbarabolik closed 2 years ago

olikbarabolik commented 2 years ago

Describe the bug Step “After” in the test body

To Reproduce Run script: describe('Отчет', () => { after(() => { cy.allure().step('Шаг внутри after') }) })

Expected behavior Steps for after\after all hooks have seporate sections

Environment (please complete the following information): • Cypress version: 8.7.0 • Allure plugin version 2.23

image

Shelex commented 2 years ago

Hi, @olikbarabolik Unfortunately I am not able to reproduce it as Allure report giving me proper results for this test code:

describe('Отчет', () => {
    before(() => {
        cy.allure().logStep('шаг внутри before');
    });

    it('test', () => {
        cy.wrap(true).should('be.eq', true);
    });

    after(() => {
        cy.allure().logStep('Шаг внутри after');
    });
});
Allure Report 2022-01-28 19-17-14
olikbarabolik commented 2 years ago

@Shelex version 2.17.2 image

Shelex commented 2 years ago

@olikbarabolik I agree that steps api in plugin is quite weird, but there is a section in readme describing the difference between step commands. Shortly:

So in case you want to create step for afterEach - please use logStep instead of step, it has quite same behaviour, but could be attached to hook. Basically step command was designed to cover cypress-cucumber-preprocessor steps of test (Given, When, Then) where all other steps will be included.