InterviewSolution
| 1. |
Explain How You Can Set Up Protractor In Your Project? |
|
Answer» It is very simple to set up Protractor in your project. Protractor is a node.js program, so it can be easily installed via any package manager that SUPPORTS node.js installation – both npm and YARN are the go-to package managers in most scenarios. Your system set up should have node.js runtime installed. Since npm COMES by default with node.js, so you can use it or you can download and use yarn. In case of npm, installing Protractor is just a matter of running this simple command – for node v.8.0+ npm i -g protractor or npm install -g protractor This command INSTALLS both Protractor and Web driver-Manager. Once Protractor is installed, you can check the version using Protractor -version Now, once Protractor is installed, you’ll not be ready for running the tests yet. You need the Chrome Driver or the Gecko Driver binaries for establishing connection with the browser. To achieve this, you’ll need to run Web driver-manager update This will install the web driver-server along with the browser dependencies. Once this is done, you’ll have Protractor set-up in your project. Now the next step is to write the test cases using the spec.js file and set up the Protractor configuration using the conf.js file. It is very simple to set up Protractor in your project. Protractor is a node.js program, so it can be easily installed via any package manager that supports node.js installation – both npm and yarn are the go-to package managers in most scenarios. Your system set up should have node.js runtime installed. Since npm comes by default with node.js, so you can use it or you can download and use yarn. In case of npm, installing Protractor is just a matter of running this simple command – for node v.8.0+ npm i -g protractor or npm install -g protractor This command installs both Protractor and Web driver-Manager. Once Protractor is installed, you can check the version using Protractor -version Now, once Protractor is installed, you’ll not be ready for running the tests yet. You need the Chrome Driver or the Gecko Driver binaries for establishing connection with the browser. To achieve this, you’ll need to run Web driver-manager update This will install the web driver-server along with the browser dependencies. Once this is done, you’ll have Protractor set-up in your project. Now the next step is to write the test cases using the spec.js file and set up the Protractor configuration using the conf.js file. |
|