I have some repeating functions and I want to isolate them in another file for use in Protractor. I don't want to have them in the same file as the tests are. How would I do this? I run protractor against an external non-angular web site, like this:
protractor conf.js
So inside spec.js I have these kinds of functions that I simply want to reuse:
function someFunction() {
console.log("We are in a function");
}
How can I put them aside in another .js file or something similar? Thanks for any advice!
my-module.js
module.exports = {
custom_function: function() {
console.log("whatever")
}
};
spec.js
const custom_function = (require("./my-module.js")).custom_function;
describe("Suite: UCare - Provider Search - 'Places' tab", () => {
it("1", async () => {
custom_function();
});
});