Git Product home page Git Product logo

Comments (5)

john-doherty avatar john-doherty commented on June 11, 2024

Hi @leggebroten, thank you for contributing!

A config file is a good idea, can you give me an example/snippet of the settings you'd like to see? Internally, the browser setup looks like this

from selenium-cucumber-js.

leggebroten avatar leggebroten commented on June 11, 2024

Hi John,

My initial plan would be to look for a well-known JSON config file in the node working directory and merge that with a "config" object at the top of your index.js file.

Then, use the values from that merged object as defaults for the options statements when constructing the program instance.

This could easily be extended to define arbitrary driver construction functors or pass additional to cucumber command line

let config = {
"dir": {
"step_def": "./step-definitions",
"page_obj": "./page-objects",
"shared_obj": "./shared-objects",
"reports": "./reports",
},
"browser": {
"allowed": "^(chrome|firefox|phantomjs)$",
"default": "chrome"
},
"timeout": 10000
};
let configFileName = path.resolve(process.cwd(), 'selenium-cucumber-js.json');
var fs = require('fs');
if (fs.existsSync(configFileName)) {
console.log("Reading config from " + configFileName);
Object.assign(config, require(configFileName));
console.log('Config is: ' + JSON.stringify(config));
}
// end Added

program
.version(pjson.version)
.description(pjson.description)
.option('-s, --steps ', 'path to step definitions. defaults to ' + config.dir.step_def, config.dir.step_def)

from selenium-cucumber-js.

leggebroten avatar leggebroten commented on June 11, 2024

I have a better solution and will submit a pull request for your review.

from selenium-cucumber-js.

leggebroten avatar leggebroten commented on June 11, 2024

Tried to add the two branches for pull requests ... no joy.

from selenium-cucumber-js.

john-doherty avatar john-doherty commented on June 11, 2024

Merged, thanks @leggebroten

from selenium-cucumber-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.