I'm currently running a test with the following code and encountering an error message:
Failed: cannot find module '../page/home_page.js
The main page consists of:
describe("login to website",function(){
var employeeId;
var employeeBday;
beforeEach(function(){
browser.get("https://pre-www5.main.co.il/#/");
});
it("should successfully login",function(){
employeeId = "54729108";
employeeBday = "25/03/1957";
var home_page = require('../page/home_page.js')
home_page.enterUsernameField(employeeId);
home_page.enterBirthdateField(employeeBday);
var pick_present_page = home_page.clickContinue();
element(by.xpath("//*[@id='planAndDev']/div/div/div/div/matanot/form/div[2]/h4")).getText().then(function(text)
{
expect(text).toContain("foo")
});
});
});
Also, utilizing the home_page class:
require ('../page/pick_present_page.js')
var home_page = function(){
this.enterUsernameField=function(employeeId){
element(by.xpath("//*[@id='planAndDev']/div/div/div/div/form/fieldset/div[1]/input")).sendKeys(employeeId);
};
this.enterBirthdateField=function(EmployeebDay){
element(by.xpath("//*[@id='planAndDev']/div/div/div/div/form/fieldset/div[2]/my-date-picker/div/div/input")).sendKeys(EmployeebDay);
};
this.clickContinue=function(){
element(by.xpath("//*[@id='planAndDev']/div/div/div/div/form/nav/div/button")).click();
return require('./pick_present_page');
};
module.exports = new home_page();
};
The project directory is located in C:\JS_Project
and the pages can be found in C:\JS_Project\page
.
It seems like I might have made an error in how I'm using the relative path.