From 2f15da5720041358b9eb484573bb87a20e644211 Mon Sep 17 00:00:00 2001 From: aytekin-smartcar <124309176+aytekin-smartcar@users.noreply.github.com> Date: Wed, 1 May 2024 14:37:03 -0500 Subject: [PATCH] feat: add browser configuration for test environment (#171) --- README.md | 2 ++ test/end-to-end/helpers/index.js | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3a79f79..f7defe9 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,8 @@ Note: In order to run tests locally the following environment variables would ha - `E2E_SMARTCAR_CLIENT_SECRET` - Client secret to be used. - `E2E_SMARTCAR_AMT` - AMT from dashboard for webhooks tests. - `E2E_SMARTCAR_WEBHOOK_ID` - Webhook ID use in the webhook tests success case. +- `BROWSER` - Web browser for tests (`chrome` or `firefox`, default: `firefox`). + Your application needs to have https://example.com/auth set as a valid redirect URI diff --git a/test/end-to-end/helpers/index.js b/test/end-to-end/helpers/index.js index e55fd07..9485fa8 100644 --- a/test/end-to-end/helpers/index.js +++ b/test/end-to-end/helpers/index.js @@ -13,6 +13,8 @@ const helpers = {}; const HEADLESS = isCI || process.env.HEADLESS; const CLIENT_ID = process.env.E2E_SMARTCAR_CLIENT_ID; const CLIENT_SECRET = process.env.E2E_SMARTCAR_CLIENT_SECRET; +const BROWSER = process.env.BROWSER || 'firefox'; + /* eslint-enable */ if (!CLIENT_ID || !CLIENT_SECRET) { @@ -74,7 +76,7 @@ helpers.runAuthFlow = async function( const driver = new Builder() .setChromeOptions(chromeOptions) .setFirefoxOptions(firefoxOptions) - .forBrowser('firefox') + .forBrowser(BROWSER) .build(); await driver.get(authUrl);