我是backstopjs的新手,并且我将backstop.json(其中的一部分)作为
"onBeforeScript": "puppet/onBefore.js",
"onReadyScript": "puppet/onReady.js",
"scenarios": [
{
"label": "CBP Homepage",
"cookiePath": "backstop_data/engine_scripts/cookies.json",
"url": "development/url/somepage",
"referenceUrl": "uat/url/somepage",
.
.
}
我想在onBeforeScript中运行参考(backstop参考)时运行登录到开发站点,并在运行测试(backstop测试)时登录到UAT?如何实现此要求或任何有关资源的建议? >
答案 0 :(得分:0)
以下脚本对我有用(我基于操纵up脚本):
module.exports = async (page, scenario) => {
await page.goto(scenario.url)
await page.type('input[name="username"]', 'XXXXXXX');
await page.type('input[name="password"]', 'XXXXXXX');
await page.click('button[type="submit"]');
await page.waitForNavigation();
}
该脚本已添加到onBefore.js