首先,我是e2e测试的菜鸟。我所做的是
nmp install protractor
webdriver-manager start
。它运行良好protractor tests/e2e/conf.js
它运行良好然而,在几秒钟内,它显示Timed out waiting for page to load
以下是我的文件:
测试/ 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
}
};
测试/ 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!');
});
});
我无法理解在哪里定义我的webapp laypout / placement,因此protractor / webdriver知道要运行哪个上下文。
答案 0 :(得分:0)
使用该设置量角器将尝试导航到“/”。您需要在配置文件中设置baseUrl属性,或在browser.get()中放置绝对URL。如果您的所有测试都在同一个域中,我建议您使用第一个选项。