我在使用带有phantomjs浏览器的量角器时遇到了一些麻烦,它无法与本地服务器连接,任何其他url都能正常工作。 有一些代码: protractor.config.js
var suites = {
// e2e: "./e2e.js",
// e2e2: "/e2e-spec.ts"
};
var helpers = require('./helpers');
require('ts-node/register');
exports.config = {
baseUrl: 'http://localhost:3001',
specs: [
helpers.root('src/e2e/e2e.js'),
helpers.root('src/e2e/e2e-spec.ts')
],
capabilities: {
'browserName': 'phantomjs',
version: '',
platform: 'ANY'
},
framework: 'jasmine2',
jasmineNodeOpts: {
showColors: true
},
useAllAngular2AppRoots: true,
};
和ofc spec file:
it('should put email click button etc', () => {
//this one take about:blank url
browser.driver.get('http://localhost:3001/student/panel').then( function () {
browser.driver.sleep(5000);
browser.driver.getCurrentUrl()
.then((url) => {
console.log(url);
expect(url).toEqual('hhttp://localhost:3001/student/panel');
})
;
});
});
it('should get into 10 minute mail page', () => {
minuteMail.getNew().then(function () {
//this works well
browser.driver.sleep(1000);
browser.driver.getCurrentUrl()
.then((url) => {
expect(url).toEqual('https://www.10minutmail.pl/?newMail=1');
})
;
});
});
谢谢:)