Introducing the Spectron Command Line Tool

After some Spectron experience there tends to be some things that can get repetitive when creating Spectron tests. I figured creating a tool to do just that would be handy to have. So I created the spectron-cli npm package.

Granted, this command line tool doesn’t do all that much. Currently, it only has two commands to it.

The “init” command will create an e2e directory, if it doesn’t already exist in the current directory it’s run in. It will also create two files in that directory for you – a test.spec.js file and a test.page.js file. These files will include templates to help you get started writing your Spectron tests.

The “add” command will just create a spec file and a page file with the name of your choosing inside the e2e directory.

The way the templates are laid out, however, you would have to include chai and chai-as-promised packages if you don’t already have them. These tests can be run with mocha or jasmine test runners.

So feel free to install the tool with npm install spectron-cli and see how it works for you (or just find ways to break it). It is open source so feel free to submit and enhancements or fixes or just create an issue.

I hope this tool serves to help make your Spectron testing much easier.

Stay Informed

Sign up for the latest blogs, events, and insights.

We deliver solutions that accelerate the value of Azure.
Ready to experience the full power of Microsoft Azure?

Atmosera is thrilled to announce that we have been named GitHub AI Partner of the Year.

X