Just like in selenium, we have multiple test files, we can implement the same in Protractor by creating multiple specs files.

Project Structure

Our project structure in this example will be as below in IntelliJ

project structure.JPG


Our first spec file will look like below. Note that http://www.viu.com is an angularjs site.

describe('Testing Viu', function() {
it('should have a title', function() {
expect(browser.getTitle()).toEqual('Viu - Watch TV Shows & Movies Online');


Our second spec file will be as below. Note that http://www.google.com is not an angular site.

describe('Testing Google', function() {
    it('should have a title', function() {

Here we have added browser.waitForAngularEnaled(false) since its a non-angular website. Test will fail with error Angular could not be found on the page: retries looking for angular exceeded if this is not added for a non-angular website


Finally, our conf file will be as below and this time we will be simply adding two spec file paths in specs parameter.

exports.config = {
    framework: 'jasmine',
    seleniumAddress: 'http://localhost:4444/wd/hub',
    specs: ['./tests/spec.js', './tests/spec2.js'],
    capabilities: {
        browserName: 'chrome'


Upon executing the conf file, you’ll see that tests described in both spec files are execute in the same browser instance and IntelliJ console will show output as below.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s