From b1287d6a9f121d783cfc60bdedd4f8d9a686471d Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Fri, 9 Jun 2023 20:39:14 +0100 Subject: [PATCH 1/2] Update qa test notify script to be env aware --- qa-core/scripts/testResultsWebhook.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/qa-core/scripts/testResultsWebhook.js b/qa-core/scripts/testResultsWebhook.js index b4725cae56..40cc42082d 100644 --- a/qa-core/scripts/testResultsWebhook.js +++ b/qa-core/scripts/testResultsWebhook.js @@ -15,6 +15,12 @@ async function generateReport() { return JSON.parse(report) } +const env = process.argv.slice(2)[0] + +if (!env) { + throw new Error("environment argument is required") +} + async function discordResultsNotification(report) { const { numTotalTestSuites, @@ -39,8 +45,8 @@ async function discordResultsNotification(report) { content: `**Nightly Tests Status**: ${OUTCOME}`, embeds: [ { - title: "Budi QA Bot", - description: `Nightly Tests`, + title: `Budi QA Bot - ${env}`, + description: `API Integration Tests`, url: GITHUB_ACTIONS_RUN_URL, color: OUTCOME === "success" ? 3066993 : 15548997, timestamp: new Date(), From 25fc792d24153fc1047fc5be6fc4565e161cac39 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Fri, 9 Jun 2023 20:58:42 +0100 Subject: [PATCH 2/2] Fix qa-core teardown --- qa-core/src/account-api/api/apis/AccountAPI.ts | 7 +++++-- qa-core/src/jest/globalTeardown.ts | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/qa-core/src/account-api/api/apis/AccountAPI.ts b/qa-core/src/account-api/api/apis/AccountAPI.ts index c18dde3d4a..35e7e5495e 100644 --- a/qa-core/src/account-api/api/apis/AccountAPI.ts +++ b/qa-core/src/account-api/api/apis/AccountAPI.ts @@ -59,9 +59,12 @@ export default class AccountAPI { return [response, json] } - async delete(accountID: string) { + async delete(accountID: string, opts: APIRequestOpts = { doExpect: true }) { const [response, json] = await this.client.del(`/api/accounts/${accountID}`) - expect(response).toHaveStatusCode(200) + + if (opts.doExpect) { + expect(response).toHaveStatusCode(200) + } return response } } diff --git a/qa-core/src/jest/globalTeardown.ts b/qa-core/src/jest/globalTeardown.ts index 51f6046f4f..5d6e1364d9 100644 --- a/qa-core/src/jest/globalTeardown.ts +++ b/qa-core/src/jest/globalTeardown.ts @@ -10,7 +10,8 @@ const API_OPTS: APIRequestOpts = { doExpect: false } async function deleteAccount() { // @ts-ignore const accountID = global.qa.accountId - await accountsApi.accounts.delete(accountID) + // can't run 'expect' blocks in teardown + await accountsApi.accounts.delete(accountID, { doExpect: false }) } async function teardown() {