I need to do a lot of replacement on different pages. So i made page-object file with vars and replacement functions and trying to connect it to onReady. But there is a problem with require external *.js - code inside require promis is not executed. Here is my code, onReady.js:
`module.exports = async (page, scenario, vp) => {
await require('./clickAndHoverHelper')(page, scenario);
if (scenario.label == "catalog-page") {
page.evaluateHandle(() => {
require(['/var/lib/jenkins/workspace/backstop-desktop/PageObjects/CatalogPage.js'], function (CatalogPage) {
console.log('This code has newer run');
let catalogPage = new CatalogPage();
catalogPage.replaceTopBanner('topBannerReplacementURL');
});
}
}
I need to do a lot of replacement on different pages. So i made page-object file with vars and replacement functions and trying to connect it to onReady. But there is a problem with require external *.js - code inside require promis is not executed. Here is my code, onReady.js:
`module.exports = async (page, scenario, vp) => {
};`
CatalogPage.js: `var CatalogPage = function() {
};
module.exports = CatalogPage;`
Where I made a mistake? Is there any another way to include external libraries?