首先,我是 e2e 测试的菜鸟。我所做的是
- 安装量角器
nmp install protractor
- 安装 webdriver-manager
webdriver-manager start
从我的 angularjs 应用程序所在的目录运行。它运行良好- 运行
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 布局/放置,所以量角器/webdriver 知道要运行哪个上下文。