From dbd9cc0a6d7808f894f49e720e320d6e80570dda Mon Sep 17 00:00:00 2001 From: Matthias Rolke Date: Sat, 11 Jan 2025 20:23:49 +0100 Subject: [PATCH] feat: add BROWSER_SLOWMO env var to slow down execution for debugging (in ms) Co-authored-by: Clay Chipps --- CONTRIBUTING.md | 1 + src/browserforce.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index df332d7d..f136eb2e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -176,3 +176,4 @@ npm run test:e2e -- -g "AdminsCanLogInAsAnyUser" # will only run tests matching ``` > Note: You can run the e2e tests in non-headless mode (opening a browser) by setting the environment variable `BROWSER_DEBUG=true`. +> Note: You can also slow down the e2e test in non-headless mode by setting the environmnet variable, where the number is milliseconds of delay `BROWSER_SLOWMO=250`. diff --git a/src/browserforce.ts b/src/browserforce.ts index 68b662b3..2be1fe31 100644 --- a/src/browserforce.ts +++ b/src/browserforce.ts @@ -28,7 +28,8 @@ export class Browserforce { // workaround for navigating frames https://github.com/puppeteer/puppeteer/issues/5123 '--disable-features=site-per-process' ], - headless: !(process.env.BROWSER_DEBUG === 'true') + headless: !(process.env.BROWSER_DEBUG === 'true'), + slowMo: parseInt(process.env.BROWSER_SLOWMO, 10) ?? 0 }); const page = await this.getNewPage(); try {