igniteram / protractor-cucumber-typescript

e2e kickstarter test framework which consists of protractor, cucumber frameworks using typescript lang!
MIT License
196 stars 170 forks source link

How to update tags from cucumbertags from config.ts file at runtime? #46

Closed atulparate closed 6 years ago

atulparate commented 6 years ago

QUESTION

I want to update the config.ts file at runtime where I will be reading excel file where all features and scenarios are present with a run flag. As per the 'Y' it should update that tag attribute from the config.ts file.

Inside excel structure would be something like below, Run Fla | ScenarioTag Y | @InvalidLogin N | @ValidLogin Y | @ VerifyDashboard

After reading above file it should update config.ts as below, cucumberOpts: { compiler: "ts:ts-node/register", format: "json:./reports/json/cucumber_report.json", require: ["../../bdd/StepDefinition//.ts", "../../support/*.ts"], strict: true, tags: "@InvalidLogin or @VerifyDashboard",

Please suggest.

igniteram commented 6 years ago

@atulparate you could write a small utility file for reading excel content and a logic to convert them to the tags appending and , or to them. Since tags in cucumberOpts are basically strings you use string literals to read the content from the excel utility. Something like - tags - ${excelUtilFn()} where excelUtilFn() returns a string appending your concerned tags together

vishalsangave commented 6 years ago

Create a object of cucumberOpts={...... tags: "" } then use cucmberOpts.tags = getTagsOption(); This will update the tags value from the method you used.

shabfactor commented 6 years ago

@igniteram in the current project how you run tests using tags?

igniteram commented 6 years ago

@shabfactor sorry for the late reply, you can tags in the cucumberOpts object, you could also pass tags through command line and write a npm script for executing those tags tests!

igniteram commented 6 years ago

Since this is a stale issue and more of a support question, closing this for now. Please raise a new issue if necessary!