Cypress-cucumber-preprocessor: Accessing tags in a running test

Created on 13 Jan 2020  路  3Comments  路  Source: TheBrainFamily/cypress-cucumber-preprocessor

Is it possible to access which tags the current scenario is tagged with within the Before hook? I know this is possible with Cucumber, but can't find a way to do it with your preprocessor. The reason I would need this is because I would like to do some conditional testing depending on which tag the scenario is tagged with.

Thanks in advance! :)

Most helpful comment

Does

window.testState.currentScenario.tags give you what you want? This should work from a cucumber Before hook

All 3 comments

I'm looking for same case
I use it with cucumber:

Before(async function (scenario) {
const tags = scenario.pickle.tags.map(tag => tag.name);
});

Does

window.testState.currentScenario.tags give you what you want? This should work from a cucumber Before hook

Does

window.testState.currentScenario.tags give you what you want? This should work from a cucumber Before hook

Thanks, that's exactly what I was looking for 馃榾

Was this page helpful?
0 / 5 - 0 ratings