Merge pull request #10854 from Budibase/update-test-notify
Update qa test notify script to be env aware
This commit is contained in:
commit
037396babb
|
@ -15,6 +15,12 @@ async function generateReport() {
|
||||||
return JSON.parse(report)
|
return JSON.parse(report)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const env = process.argv.slice(2)[0]
|
||||||
|
|
||||||
|
if (!env) {
|
||||||
|
throw new Error("environment argument is required")
|
||||||
|
}
|
||||||
|
|
||||||
async function discordResultsNotification(report) {
|
async function discordResultsNotification(report) {
|
||||||
const {
|
const {
|
||||||
numTotalTestSuites,
|
numTotalTestSuites,
|
||||||
|
@ -39,8 +45,8 @@ async function discordResultsNotification(report) {
|
||||||
content: `**Nightly Tests Status**: ${OUTCOME}`,
|
content: `**Nightly Tests Status**: ${OUTCOME}`,
|
||||||
embeds: [
|
embeds: [
|
||||||
{
|
{
|
||||||
title: "Budi QA Bot",
|
title: `Budi QA Bot - ${env}`,
|
||||||
description: `Nightly Tests`,
|
description: `API Integration Tests`,
|
||||||
url: GITHUB_ACTIONS_RUN_URL,
|
url: GITHUB_ACTIONS_RUN_URL,
|
||||||
color: OUTCOME === "success" ? 3066993 : 15548997,
|
color: OUTCOME === "success" ? 3066993 : 15548997,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
|
|
@ -59,9 +59,12 @@ export default class AccountAPI {
|
||||||
return [response, json]
|
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}`)
|
const [response, json] = await this.client.del(`/api/accounts/${accountID}`)
|
||||||
expect(response).toHaveStatusCode(200)
|
|
||||||
|
if (opts.doExpect) {
|
||||||
|
expect(response).toHaveStatusCode(200)
|
||||||
|
}
|
||||||
return response
|
return response
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@ const API_OPTS: APIRequestOpts = { doExpect: false }
|
||||||
async function deleteAccount() {
|
async function deleteAccount() {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const accountID = global.qa.accountId
|
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() {
|
async function teardown() {
|
||||||
|
|
Loading…
Reference in New Issue