How to configure protractor

Protractor is a preferred end-to-end testing framework for the Angular JS built applications. Protractor is built on Selenium’s Web Driver, which is an API, written as extensions, for controlling browsers. Web Driver has extensions for all sorts of different browsers.

Protractor is built on top of the Jasmine/Mocha/Cucumber framework for writing your assertions, so we don’t need to learn a new framework in order to use it. But It is recommended to use Jasmine 2.

How to Configure Protractor?

Protractor itself requires a configuration script that tells Protractor how to run, how to connect to Selenium.
·        Install Protractor locally
npm install protractor
·        Install the selenium Web Driver
/node_modules/protractor/bin/webdriver-manager update
·        Specify the Selenium web drive path
seleniumServerJar: ‘./node_modules/protractor/selenium/selenium-server-standalone-2.52.0.jar',
·        Default configuration script uses a Chrome driver, specify the path of the driver location
chromeDriver: './node_modules/protractor/selenium/chromedriver'
·        Point the test specs folder to execute
specs: ['test/e2e/**/*_spec.js']
·        Pass the capabilities to the webdriver instance
capabilities: {
    'browserName': 'chrome'
  }
·        Optionally provide the options for the Jasmine node
jasmineNodeOpts: {
        // If true, display spec names.
        isVerbose: true,
        // If true, print colors to the terminal.
        showColors: true,
        // If true, include stack traces in failures.
        includeStackTrace: true,
        // Default time to wait in ms before a test fails.
        defaultTimeoutInterval: 30000
    }



No comments

Powered by Blogger.