1
0
Fork 0
mirror of synced 2024-07-09 00:06:05 +12:00

Merge pull request #10854 from Budibase/update-test-notify

Update qa test notify script to be env aware
This commit is contained in:
Rory Powell 2023-06-09 21:14:14 +01:00 committed by GitHub
commit 037396babb
3 changed files with 15 additions and 5 deletions

View file

@ -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(),

View file

@ -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
}
}

View file

@ -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() {