AP
Size: a a a
AP
S
"strict mode";
// get name of function where it is called
const getCallerName = () => {
const _ = Error.prepareStackTrace;
Error.prepareStackTrace = (_, stack) => stack;
const stack = new Error().stack.slice(1);
Error.prepareStackTrace = _;
return stack[0].getFunctionName();
};
// examples
let funcVar = function myFunc () {
console.log(getCallerName());
};
funcVar(); // "myFunc"
funcVar = function () {
console.log(getCallerName());
};
funcVar(); // "funcVar"
funcVar = () => {
console.log(getCallerName());
};
funcVar(); // "funcVar"
(() => {
console.log(getCallerName());
})(); // null
AP
A
S
function myFun() {
console.log(myFun.name)
}
function myFun() {
console.log("myFun")
}
const myFun = () => {
console.log("myFun")
}
M
A
if (error !== undefined) {
browser.takeScreenshot(process.cwd()+'/allure-results/screen1.png');
browser.touchScroll(0, 1200);
browser.takeScreenshot(process.cwd()+'/allure-results/screen2.png');
}
BO
if (error !== undefined) {
browser.takeScreenshot(process.cwd()+'/allure-results/screen1.png');
browser.touchScroll(0, 1200);
browser.takeScreenshot(process.cwd()+'/allure-results/screen2.png');
}
BO
A
M
if (error !== undefined) {
browser.takeScreenshot(process.cwd()+'/allure-results/screen1.png');
browser.touchScroll(0, 1200);
browser.takeScreenshot(process.cwd()+'/allure-results/screen2.png');
}
A
A
const { attachments } = require('@wdio/allure-reporter').default
...
browser.saveScreenshot(process.cwd() + '/allure-results/screen1.png');
attachments.addAttachment("Screen1",
Buffer.from(process.cwd() + '/allure-results/screen1.png',
"base64"),
"image/png");
S
Buffer.from
должен принимать контент а не путьa
B
a
a
B
a