An Interactive command line interface & config helper for ProtractorJS
About | To Get Started | Installation | Commands
About
Protractor-CLI(formerly Cliptor.js) is an interactive command line interface which helps in setting up hassle free protractor projects. It takes user's inputs for generating protractor config files and also downloads the dependencies needed for writing e2e tests.
What protractor-cli is trying to solve?
Since protractor supports multiple frameworks and has many functionalities associated with them , users face it quite challenging to know the config options and experience a hard time to choose the right library to use in their e2e projects.
This project focuses primarily to solve these issues by generating config files based on user's input and downloads the respective dependencies automatically.
To Get Started
Pre-requisites
1.NodeJS installed globally in the system. https://nodejs.org/en/download/
Installation
Let's start by installing protractor-cli globally with npm.
$ npm install --global protractor-cli
Commands
A global binary cliptor will be installed, currently it supports two primary commands - config & install with no arguments.
cliptor --help
will show these list commands. cliptor --version
will show the current version of cliptor.
config
$ cliptor config
Starts protractor's interactive cli, generates config files & downloads protractor related dependencies!
install
$ cliptor install
This installs protractor & webdriver-manager globally, it also updates webdriver-manager which downloads chrome, firefox & internet explorer drivers. One can skip this step and use the cliptor config
command if they want to run selenium server in other ways!
Library Support
Protractor-CLI supports all the major libraries and frameworks that Protractor currently supports, let us have a look-
Test Frameworks
Jasmine being the default framework. Mocha & Cucumber have good support as well!
Transpilers
Since this project has been entirely written using TypeScript. You would find extensive support for it. Protractor also has recently migrated to typescript.
You could use the typescript features by simply selecting your specific framework & transpiler option provided by protractor-cli.
Jasmine being the default framework , protractor-cli asks whether you would want to use typescript as a transpiler which then installs typescript, jasmine types and also generates tsconfig.json automatically!
Coffee-Script support has also been provided with mocha & cucumber frameworks. You could write your scripts using coffee-script and the above frameworks will auto-compile them. The best part is you don't have to do it manaully as protractor-cli does it for you!
Browser Configuration
Protractor-CLI supports all three major browser configuration -
Test Environments
- Local Machine - It is your local test development environment
- Cloud Service - If you want to develop and maintain your test scripts in cloud services like - Sauce Labs & BrowserStack.
- Remote Machine - If you know the address of a remote machine where selenium server resides you could use this environment configuration.
Logging
Protractor has 4 types of logging mechanism -
- info (default)
- warn
- debug
- error
One could refer this StackOverFlow link to understand what they are and when to use them. Normally you would have to configure these in your config file manually but now protractor-cli does it for you.
Reports
Protractor-CLI installs & configures popular & well maintained report modules which could be integrated with protractor.
Framework | Report Types | Report Module |
---|---|---|
Jasmine |
dot spec json html |
Protractor jasmine's default dot console reporter jasmine-spec-reporter for flashy console spec reporter Protractor's resultJsonOutputFile config option generates json reportsprotractor-jasmine2-screenshot-reporter for html reports. |
Mocha |
dot spec json html |
Mocha's default dot console reporter in mochaOpts Built in spec console reporter Built in mocha's json reporter Mochawesome for html reports. |
cucumber |
progress summary json html |
Cucumber's default progress console reporter Summary console reporter Json reporter which generates cucumber json reports cucumber-html-reporter for html reports. |
Contributions
For contributors who want to improve this repo by contributing some code, reporting bugs, issues or improving documentation - PR's are highly welcome, please maintain the coding style , folder structure , detailed description of documentation and bugs/issues with examples if possible.
Development Hints
git clone https://github.com/igniteram/protractor-cli.git
cd protractor-cli
npm link
npm link
is very similar to npm install -g
except that instead of downloading the package from the repo, the just cloned protractor-cli folder becomes the global package.
cliptor
binary will be available to you globally and any changes you make in this folder could be verified by running binary from anywhere.
Attributions
Protractor-CLI was mainly inspired by WebdriverIO’s cli. I would also like to give credit to the Angular’s Protractor community for creating such a wonderful project which inspired this project development.