sirj77
3 years agoNew Member
How to skip executing the step for a concrete example, but run it for others?
Hi guys!
I am trying to find a way how to skip (not execute) only one step for a specific scenario example, but execute it for another one.
Current implementation will execute both scenario examples and in cucumber report I will see it's passing for both, but in reality no code should be executed for second example and mark it as not run (or skipped)
Basicacally, is there a way how to indicate a step to not be executed if I run it for another @ca example?
(as you can see inside step implementation I have if statement only for @us example, but I don't need to execute this step for @ca one.
Appreciate for any help!
Example of the feature:
Scenario Outline: Approve Report
Given I login as "<user>" into "portal"
And Open "<caseType>" case
And I verify the Report has documents
When I approve the Report
Then the case status changes to "<expectedCaseStatus>"
@us
Examples:
| user | caseType | expectedCaseStatus |
| test user | US | US Report Approved |
@ca
Examples:
| user | caseType | expectedCaseStatus |
| test user | CA | CA Report Approved |
Then('I verify the Report has documents', async function (this: CustomWorld) {
const {
playwrightConfig: { page },
} = this;
const myPage = new MyPage(page);
const caseTypeName = this.getGlobalVariable('caseType');
if (caseTypeName.includes('US')) {
await myPage.openDocumentTab();
expect(myPage.documentStatus('my status'));
}
}
);