我有一个命令可以覆盖暂停以将对话框中的输入添加到报告中。我想知道是否有办法知道哪个测试正在调用该函数,以便我可以自定义输入上的消息。
Cypress.Commands.overwrite('pause', (originalFn, element, options) => {
var tryThis = '';
if (//place calling the function == file1) {
tryThis = 'message1';
} else if (//place calling the function == file2) {
...
} else if (//place calling the function == file3) {
...
}
var datalog = window.prompt(tryThis, "Log your results");
cy.addContext("DATALOG:" + datalog);
return originalFn(element, options)
})
Run Code Online (Sandbox Code Playgroud)