Archer
Archer

Reputation: 5147

AngularJS: e2e testing with protractor

First of all I'm a noob with e2e testing. What I've done is

However in few seconds it says Timed out waiting for page to load

Here are my files:

tests/e2e/conf.js:

// An example configuration file.
exports.config = {
    // The address of a running selenium server.
    seleniumAddress: 'http://localhost:4444/wd/hub',

    // Capabilities to be passed to the webdriver instance.
    capabilities: {
        'browserName': 'chrome'
    },

    // Spec patterns are relative to the current working directly when
    // protractor is called.
    specs: ['example_spec.js'],

    // Options to be passed to Jasmine-node.
    jasmineNodeOpts: {
        showColors: true,
        defaultTimeoutInterval: 30000
    }
};

tests/e2e/example_spec.js

var protr;

describe('addressBook homepage', function() {

    var ptor;

    beforeEach(function() {
        ptor = protractor.getInstance();
    });

    it('should greet the named user', function() {
        browser.get('/'); // <-- exception here

        element(by.model('yourName')).sendKeys('Julie');

        var greeting = element(by.binding('yourName'));

        expect(greeting.getText()).toEqual('Hello Julie!');
    });
});

I just can't understand where to define my webapp laypout/placement so protractor/webdriver knows which context to run.

Upvotes: 0

Views: 867

Answers (1)

Dan
Dan

Reputation: 3268

With that setup protractor will be trying to navigate to "/". You need to either set the baseUrl property in the configuration file, or put an absolute url in the browser.get(). If all your tests are going to be on the same domain I'd recommend the first option.

Upvotes: 0

Related Questions