【发布时间】:2017-02-28 03:32:07
【问题描述】:
我在运行 UI 测试时遇到以下错误。我是 Javascript 的新手,所以我一直在关注示例代码,但我不确定我哪里出错了。有人可以解释为什么我会收到此错误以及适当的修复方法吗?
错误:
[13:00:19] E/launcher - fn is not a function
[13:00:19] E/launcher - TypeError: fn is not a function
主页对象:
Homepage.prototype = Object.create({}, {
checkInBtn: {
get: function () {
return element(by.css('div.checkin.booking-date input'));
}
}, datePickerDay: {
value: function (day) {
return element(by.cssContainingText('.ui-datepicker-calendar a', day));
}
}, selectCheckInDate: {
value: function (day) {
return this.checkInBtn.click().then(this.datePickerDay(day).click());
}
},
});
module.exports = Homepage;
黄瓜量角器步骤文件
this.When(/^I enter the trip information and search$/, function (table) {
var page = new homepage();
var checkOutDay = new Date(data["DepartureDate"]).getDate();
page.selectCheckInDate(checkInDay);
expect(page.checkInBtn.getText()).to.eventually.have.string(checkInDay);
});
【问题讨论】:
-
你打电话给
var page = new homepage(),不应该是你在页面对象中声明的大写HHomepage()吗?
标签: javascript protractor cucumber