how does one use module.exports and require in protractor tests?
angularjs, node.js, protractor
Solution
It's looking for `InsuredSearchPage` package in `node_modules`. You need to specify the location of `InsuredSearchPage` relative to the directory the file is in:
var InsuredSearchPage = require("./InsuredSearchPage");
The docs have more information on using `require()`
Problem
I am trying to use PageObject pattern in my e2e tests, but I am getting a message that module is not found (Error: cannot find module InsuredSearchPage) in /acceptance/insured/search/SearchPage.js I have following ``` enter code here var InsuredSearchPage = (function () { 'use strict'; function InsuredSearchPage() { var searchButton = element(by.id(searchFormBtn)); var page = { search: search }; return page; function search() { searchButton.click(); } } return InsuredSearchPage; })(); module.exports = InsuredSearchPage; ``` and in test (that is the same folder) i have this ``` var InsuredSearchPage = require("InsuredSearchPage"); ``` When I run the test, I get 'Error: cannot find module InsuredSearchPage.' What am I doing wrong?