From 35232188f0d2dce359b1bc8f79b0ef930578b7b8 Mon Sep 17 00:00:00 2001 From: Beppe Catanese <1771700+gcatanese@users.noreply.github.com> Date: Fri, 1 Dec 2023 16:38:34 +0100 Subject: [PATCH] Use utilities, delete utils (#57) --- tests/afp/dashboard.spec.js | 4 ++-- tests/afp/utils.js | 8 -------- tests/utilities.js | 3 +++ 3 files changed, 5 insertions(+), 10 deletions(-) delete mode 100644 tests/afp/utils.js diff --git a/tests/afp/dashboard.spec.js b/tests/afp/dashboard.spec.js index 5471ee7..4a1995b 100644 --- a/tests/afp/dashboard.spec.js +++ b/tests/afp/dashboard.spec.js @@ -1,6 +1,6 @@ // @ts-check const { test, expect } = require('@playwright/test'); -const utils = require('./utils'); +const utilities = require('../utilities'); test('Dashboard', async ({ page }) => { await page.goto('/'); @@ -9,7 +9,7 @@ test('Dashboard', async ({ page }) => { await page.goto('/login'); await expect(page.locator('text="Login"')).toBeVisible(); // perform login - await page.fill('input[name="username"]', utils.USERNAME); + await page.fill('input[name="username"]', utilities.USERNAME); await page.fill('input[name="password"]', "123"); await page.getByRole('button', { name: 'Submit' }).click(); diff --git a/tests/afp/utils.js b/tests/afp/utils.js deleted file mode 100644 index 63ef082..0000000 --- a/tests/afp/utils.js +++ /dev/null @@ -1,8 +0,0 @@ -const dotenv = require('dotenv'); - -dotenv.config(); - -module.exports = { - // valid AccountHolder id - USERNAME: process.env.AFP_USERNAME, -}; \ No newline at end of file diff --git a/tests/utilities.js b/tests/utilities.js index 022245e..6c69b63 100644 --- a/tests/utilities.js +++ b/tests/utilities.js @@ -16,6 +16,9 @@ module.exports = { /** Cardholder name. */ NAME_ON_CARD: 'J. Smith', + /** valid AccountHolder id for AfP tests: use env variable to not expose valid Id */ + USERNAME: process.env.AFP_USERNAME || "na", + /** Utility function to fill card details on the Adyen.Web.Component - Sets default values automatically if you do not overwrite it manually. * See: https://docs.adyen.com/online-payments/build-your-integration/?platform=Web&integration=Components. * Example usage: