From 943bd5487951494d36f6e472c4c27485063cda7b Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Wed, 28 Sep 2022 18:31:23 +0100 Subject: [PATCH] use environment variables in jest run --- qa-core/package.json | 6 +++--- .../internal-api/TestConfiguration/InternalAPIClient.ts | 1 - qa-core/src/config/internal-api/TestConfiguration/auth.ts | 8 +++----- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/qa-core/package.json b/qa-core/package.json index 4b9d4a791e..7cd566587e 100644 --- a/qa-core/package.json +++ b/qa-core/package.json @@ -9,8 +9,8 @@ "url": "https://github.com/Budibase/budibase.git" }, "scripts": { - "test": "jest --runInBand", - "test:watch": "jest --watch", + "test": "env-cmd jest --runInBand", + "test:watch": "env-cmd jest --watch", "test:debug": "DEBUG=1 jest", "docker:up": "docker-compose up -d", "docker:down": "docker-compose down", @@ -53,4 +53,4 @@ "@budibase/backend-core": "^2.0.5", "node-fetch": "2" } -} +} \ No newline at end of file diff --git a/qa-core/src/config/internal-api/TestConfiguration/InternalAPIClient.ts b/qa-core/src/config/internal-api/TestConfiguration/InternalAPIClient.ts index 1134f02743..bfcbb9f4e2 100644 --- a/qa-core/src/config/internal-api/TestConfiguration/InternalAPIClient.ts +++ b/qa-core/src/config/internal-api/TestConfiguration/InternalAPIClient.ts @@ -12,7 +12,6 @@ interface ApiOptions { class InternalAPIClient { host: string appId?: string - csrfToken?: string cookie?: string constructor(appId?: string) { diff --git a/qa-core/src/config/internal-api/TestConfiguration/auth.ts b/qa-core/src/config/internal-api/TestConfiguration/auth.ts index 466f50424d..6ac53f24b6 100644 --- a/qa-core/src/config/internal-api/TestConfiguration/auth.ts +++ b/qa-core/src/config/internal-api/TestConfiguration/auth.ts @@ -11,10 +11,8 @@ export default class AuthApi { async login(): Promise<[Response, any]> { const response = await this.api.post(`/global/auth/default/login`, { body: { - // username: process.env.BB_ADMIN_USER_EMAIL, - // password: process.env.BB_ADMIN_USER_PASSWORD - username: "qa@budibase.com", - password: "budibase" + username: process.env.BB_ADMIN_USER_EMAIL, + password: process.env.BB_ADMIN_USER_PASSWORD } }) const cookie = response.headers.get("set-cookie") @@ -23,6 +21,6 @@ export default class AuthApi { } async logout(): Promise { - return this.api.post(`/global/auth/default/logout`) + return this.api.post(`/global/auth/logout`) } }