我有3個文件,即conf.js,actionwords.js,project_test.js。 Actionwords.js和project_test.js是hiptest工具生成的文件。所以我需要使用這個結構來自動化測試用例。當我運行cmd時,出現錯誤。如何在量角器自動化中使用Javascript命名空間?
我跑:
protractor conf.js
消息: 失敗:無法讀取未定義
堆棧的特性 'theApplicationURL': 類型錯誤:無法讀取的未定義的屬性 'theApplicationURL'
// conf.js
個exports.config = {
framework: 'jasmine2',
directConnect: true,
seleniumAddress: 'http://localhost:4444/wd/hub',
specs:['path to/project_test.js'],
capabilities: { 'browserName': 'chrome' }
};
//actionwords.js
var Actionwords = {
theApplicationURL: function() {
browser.get('localhost');
browser.driver.manage().window().maximize();
browser.sleep(5000);
},
};
//project_test.js
describe('Test', function() {
beforeEach(function() {
this.actionwords = Object.create(Actionwords);
});
it('Login_Test (uid:fe6d6670-a864-4d0f-a867-3faf9f51ff8d)', function() {
// Given the application URL
this.actionwords.theApplicationURL();
});
});
有人能幫助我在這?
將你的動作詞變成一個函數而不是對象並導出它,然後在project_test.js中使用require() –