First steps with Protractor

Once installed in your computer, it’s time to start messing with it 🙂

First of all, we will use their websites tutorial test. Create this spec.js file:

// spec.js
describe('Protractor Demo App', function() {
  it('should have a title', function() {
    browser.get('http://juliemr.github.io/protractor-demo/');

    expect(browser.getTitle()).toEqual('Super Calculator');
  });
});

That’s just a basic test. Then create this config file to set up Protractor:

// conf.js
exports.config = {
  framework: 'jasmine2',
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['spec.js']
}

Starting the webdriver manager
To make it run you need to open the console and run the webdriver manager, so open it and exec: webdriver-manager start

Executing the tests
Now that the webdriver manager is running, open another console window, move to the folder where you created those two files and exec this: protractor conf.js

That just gives protractor the config file where it sets where are the tests to execute and other details.

Leave a Reply

Your email address will not be published. Required fields are marked *