我是 AngularJS 的新手。我正在尝试使用 Protractor 运行端到端测试。目前,我正在 grunt-protractor-runner 的帮助下从 grunt 运行我的测试。我的基本测试如下所示:
describe('My Tests', function () {
var p = protractor.getInstance();
beforeEach(function () {
});
it('My First Test', function () {
var message = "Hello!";
expect(message).toEqual('Hello!');
});
});
这工作得很好。但是,它真的没有测试我的应用程序。为此,我总是想从应用程序的根目录开始。为了做到这一点,我已将上述内容更新为以下内容:
describe('My Tests', function () {
var p = protractor.getInstance();
beforeEach(function () {
p.get('#/');
});
it('My First Test', function () {
var message = "Hello!";
expect(message).toEqual('Hello!');
});
});
运行此测试时,Chrome 会启动。但是,“about:blank”是地址栏中加载的内容。我的应用永远不会加载。我查看了我的 protractor.config.js 文件,它看起来是正确的。它如下所示:
exports.config = {
allScriptsTimeout: 110000,
seleniumServerJar: './node_modules/protractor/bin/selenium/selenium-server-standalone-2.37.0.jar',
seleniumPort: 1234,
seleniumArgs: [],
seleniumAddress: null,
chromeDriver: './node_modules/protractor/bin/selenium/chromedriver.exe',
capabilities: { 'browserName': 'chrome' },
specs: [ '../tests/**/*.spec.js' ],
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
}
};
为了通过量角器进行集成测试,如何让我的应用程序加载到 Chrome 中?