- ProtractorJS provides suits and specs to test web application.
- In this demo,”We will learn to test a non AngularJS application using protractor”.
- Two files conf.js and spec.js are required as conf.js contains all the configuration object and spec.js contains all the test cases.
- In this example we will test to check www.google.com contains a title text a Google in the pages.
- The content of conf.js is as follows:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec.js']}
- The content of spec.js is as follows:
describe('Google Search Page', function() {
it('should have a title', function() {
browser.driver.get('http://www.google.com');
expect(browser.driver.getTitle()).toEqual('Google');
});
});
- Once the test suit are written , now we can start the web driver manager as following screenshot.
- Now we can start the protractor using command protractor conf.js.Following screenshot shows the terminal with protractor running.