Javascript Protractor - Seeing Outside Functions As Undefined
In specs/Test.js is a test definition: 'regex2' In pages/TablePage.js is a page object in regex2 there is a try to use a function from TablePage.js it('regex2', function(){
Solution 1:
The error comes from TablePage.js
, it should be.
var TablePage = (function () {
function TablePage() {
this.workingBalanceField = element(By.xpath('//*[@id="root"]/main/section/div/div/div[5]/div/div[1]'));
}
TablePage.prototype.matchPriceRegex = function (locator) {
this.text = locator.getText();
expect(this.text).toMatch("\d{0,3}?,?\d{0,3}?\.?\d{0,3}?");
};
return TablePage; // return the class as outer function return value
})();
// `(function(...){})` return a function, you should use `()` to execute the
// return function to get the returned class: TablePage.
module.exports = TablePage;
Post a Comment for "Javascript Protractor - Seeing Outside Functions As Undefined"