1
我正嘗試編寫一個代碼,用於使用量角器將其重定向到index.html文件。當我輸入終端量角器protractor.conf.js以執行e2e測試時。它表明我這個錯誤:量角器不推薦使用getLocationAbsUr
W /量角器 -
browser.getLocationAbsUrl()
已過時,請使用browser.getCurrentUrl
代替。
爲什麼會這樣呢?是不是getLocationAbsUrl量角器的話?
的配置量角器
exports.config = {
allScriptsTimeout: 11000,
specs: [
'e2e/*.js'
],
capabilities: {
'browserName': 'chrome'
},
baseUrl: 'http://localhost:3000/',
framework: 'jasmine',
directConnect: true,
jasmineNodeOpts: {
defaultTimeoutInterval: 30000
}
};
代碼的代碼,E2E測試
'use strict';
describe('conFusion App E2E Testing', function() {
it('should automatically redirect to/when location hash/fragment is empty', function() {
browser.get('index.html');
expect(browser.getLocationAbsUrl()).toMatch("/");
});
'expect(browser.getCurrentUrl())。toMatch(「/」);'Use this –