diff --git a/docs/basics.md b/docs/basics.md index 9fca12d4e..d67847006 100644 --- a/docs/basics.md +++ b/docs/basics.md @@ -210,6 +210,8 @@ To fill in sensitive data use the `secret` function, it won't expose actual valu ```js I.fillField('password', secret('123456')); +// you can also mask a property value in an object as an argument +I.doMyCustomLogIn({ login: 'Jan', password: secret('12345') }); ``` ### Assertions diff --git a/lib/step.js b/lib/step.js index 490a00e35..a2f42bb63 100644 --- a/lib/step.js +++ b/lib/step.js @@ -172,7 +172,11 @@ class Step { } else if (arg.toString && arg.toString() !== '[object Object]') { return arg.toString(); } else if (typeof arg === 'object') { - return JSON.stringify(arg); + return JSON.stringify( + Object.fromEntries( + Object.entries(arg).map(([key, value]) => [key, value instanceof Secret ? '*****' : value]), + ), + ); } return arg; }).join(', '); diff --git a/test/acceptance/codecept.Playwright.js b/test/acceptance/codecept.Playwright.js index 7cb3f0889..ce8747760 100644 --- a/test/acceptance/codecept.Playwright.js +++ b/test/acceptance/codecept.Playwright.js @@ -12,9 +12,9 @@ module.exports.config = { restart: process.env.BROWSER_RESTART || false, browser: process.env.BROWSER || 'chromium', ignoreHTTPSErrors: true, - webkit: { - ignoreHTTPSErrors: true, - } + webkit: { + ignoreHTTPSErrors: true, + }, }, JSONResponse: { requestHelper: 'Playwright',