0
我在我的頁面對象中定義了一個函數,當我在我的spec文件中調用該函數時,該函數將填充表單中的字段。但是,當我運行我的測試規範時,沒有任何反應。任何人都可以看看我的代碼,並給我一些洞察什麼是錯的?POM功能不發送密鑰
spec.js
var aboutYou = require('../page_objects/aboutYou.js')
describe('Credit Application', function() {
beforeEach(function(done) {
browser.get('http://localhost:5000');
});
describe('before form submission', function() {
it('should fill out the name fields', function() {
// Nothing Happens
aboutYou.fillFields;
// This sendKeys to the email field
aboutYou.emailAddress.sendKeys("[email protected]");
});
});
});
aboutYou.js
var AboutYou = function() {
this.firstName = browser.findElement(by.css(".section-aboutyou:not(.joint) input[formControlName=firstName]"));
this.lastName = element(by.css(".section-aboutyou:not(.joint) input[formControlName=lastName]"));
this.dateOfBirth = element(by.css(".section-aboutyou:not(.joint) input[formControlName=dateOfBirth]"));
this.homePhone = element(by.css(".section-aboutyou:not(.joint) input[formControlName=homePhone]"));
this.emailAddress = element(by.css(".section-aboutyou:not(.joint) input[formControlName=emailAddress]"));
this.fillFields = function() {
firstName.sendKeys("Randy");
lastName.sendKeys("Dinh");
};
};
module.exports = new AboutYou();
哦對。因爲它是一個功能。我知道這很簡單。非常感謝。 –