0

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

  • installed protractor nmp install protractor
  • installed webdriver-manager
  • run webdriver-manager start from the directory where my angularjs app sits. it runs fine
  • run protractor tests/e2e/conf.js it also runs fine

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.

Archer
  • 5,073
  • 8
  • 50
  • 96

1 Answers1

0

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.

Dan
  • 3,229
  • 2
  • 21
  • 34
  • It's the url of the site you want to test! – Dan Feb 08 '14 at 13:03
  • I wanna test local copy of my site which I suppose should be started automatically when protractor/webdriver is started. – Archer Feb 08 '14 at 13:21
  • sure but that's not protractor's responsibility. Protractor assumes that the website is already started. When you have it started the baseUrl could be for example: http://localhost:8080 – Dan Feb 08 '14 at 15:28
  • is that so dumb? why do I need to install a webserver only to test local version of my website? webdriver already has jetty in it. why not to use it just to run my website if I start it from source root? – Archer Feb 08 '14 at 18:09
  • @archer: Protractor uses Selenium server under the hood that uses Jetty as servlet container. On the other hand, Angular can be used with any backend (JavaEE, Node.JS, .NET, Rails,...). So majority of people doesn't want to host it on bundled Jetty. – luboskrnac Apr 01 '14 at 20:29