Merge pull request #15662 from Budibase/fix-slow-loop-tests

Cleanup after automation tests.
This commit is contained in:
Sam Rose 2025-03-03 17:33:06 +00:00 committed by GitHub
commit 9ee432f5b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
26 changed files with 33 additions and 4 deletions

View File

@ -16,6 +16,7 @@ describe("Execute Bash Automations", () => {
name: "test row",
description: "test description",
})
await config.api.automation.deleteAll()
})
afterAll(() => {

View File

@ -33,6 +33,7 @@ describe("test the create row action", () => {
name: "test",
description: "test",
}
await config.api.automation.deleteAll()
})
afterAll(() => {

View File

@ -6,6 +6,7 @@ describe("test the delay logic", () => {
beforeAll(async () => {
await config.init()
await config.api.automation.deleteAll()
})
afterAll(() => {

View File

@ -13,6 +13,7 @@ describe("test the delete row action", () => {
await config.init()
table = await config.api.table.save(basicTable())
row = await config.api.row.save(table._id!, {})
await config.api.automation.deleteAll()
})
afterAll(() => {

View File

@ -7,6 +7,7 @@ describe("test the outgoing webhook action", () => {
beforeAll(async () => {
await config.init()
await config.api.automation.deleteAll()
})
afterAll(() => {

View File

@ -26,6 +26,7 @@ if (descriptions.length) {
const ds = await dsProvider()
datasource = ds.datasource!
client = ds.client!
await config.api.automation.deleteAll()
})
beforeEach(async () => {

View File

@ -13,6 +13,7 @@ describe("Execute Script Automations", () => {
await config.init()
table = await config.api.table.save(basicTable())
await config.api.row.save(table._id!, {})
await config.api.automation.deleteAll()
})
afterAll(() => {

View File

@ -26,6 +26,7 @@ describe("test the filter logic", () => {
beforeAll(async () => {
await config.init()
await config.api.automation.deleteAll()
})
afterAll(() => {

View File

@ -22,10 +22,7 @@ describe("Attempt to run a basic loop automation", () => {
})
beforeEach(async () => {
const { automations } = await config.api.automation.fetch()
for (const automation of automations) {
await config.api.automation.delete(automation)
}
await config.api.automation.deleteAll()
table = await config.api.table.save(basicTable())
await config.api.row.save(table._id!, {})

View File

@ -7,6 +7,7 @@ describe("test the outgoing webhook action", () => {
beforeAll(async () => {
await config.init()
await config.api.automation.deleteAll()
})
afterAll(() => {

View File

@ -8,6 +8,7 @@ describe("test the outgoing webhook action", () => {
beforeAll(async () => {
await config.init()
await config.api.automation.deleteAll()
})
afterAll(() => {

View File

@ -16,6 +16,7 @@ describe("test the openai action", () => {
beforeAll(async () => {
await config.init()
await config.api.automation.deleteAll()
})
beforeEach(() => {

View File

@ -8,6 +8,7 @@ describe("test the outgoing webhook action", () => {
beforeAll(async () => {
await config.init()
await config.api.automation.deleteAll()
})
afterAll(() => {

View File

@ -21,6 +21,7 @@ describe("Test a query step automation", () => {
}
await config.api.row.save(table._id!, row)
await config.api.row.save(table._id!, row)
await config.api.automation.deleteAll()
})
afterAll(() => {

View File

@ -28,6 +28,7 @@ describe("test the outgoing webhook action", () => {
beforeAll(async () => {
await config.init()
await config.api.automation.deleteAll()
})
afterAll(() => {

View File

@ -6,6 +6,7 @@ describe("test the server log action", () => {
beforeAll(async () => {
await config.init()
await config.api.automation.deleteAll()
})
afterAll(() => {

View File

@ -9,6 +9,7 @@ describe("Test triggering an automation from another automation", () => {
beforeAll(async () => {
await automation.init()
await config.init()
await config.api.automation.deleteAll()
})
afterAll(async () => {

View File

@ -23,6 +23,7 @@ describe("test the update row action", () => {
await config.init()
table = await config.createTable()
row = await config.createRow()
await config.api.automation.deleteAll()
})
afterAll(() => {

View File

@ -7,6 +7,7 @@ describe("test the outgoing webhook action", () => {
beforeAll(async () => {
await config.init()
await config.api.automation.deleteAll()
})
afterAll(() => {

View File

@ -9,6 +9,8 @@ describe("app action trigger", () => {
beforeAll(async () => {
await config.init()
await config.api.automation.deleteAll()
automation = await createAutomationBuilder(config)
.onAppAction()
.serverLog({

View File

@ -16,6 +16,7 @@ describe("cron trigger", () => {
beforeAll(async () => {
await config.init()
await config.api.automation.deleteAll()
})
afterAll(() => {

View File

@ -11,6 +11,7 @@ describe("row deleted trigger", () => {
beforeAll(async () => {
await config.init()
await config.api.automation.deleteAll()
table = await config.api.table.save(basicTable())
automation = await createAutomationBuilder(config)
.onRowDeleted({ tableId: table._id! })

View File

@ -11,6 +11,7 @@ describe("row saved trigger", () => {
beforeAll(async () => {
await config.init()
await config.api.automation.deleteAll()
table = await config.api.table.save(basicTable())
automation = await createAutomationBuilder(config)
.onRowSaved({ tableId: table._id! })

View File

@ -11,6 +11,7 @@ describe("row updated trigger", () => {
beforeAll(async () => {
await config.init()
await config.api.automation.deleteAll()
table = await config.api.table.save(basicTable())
automation = await createAutomationBuilder(config)
.onRowUpdated({ tableId: table._id! })

View File

@ -37,6 +37,7 @@ describe("Webhook trigger test", () => {
beforeEach(async () => {
await config.init()
await config.api.automation.deleteAll()
table = await config.createTable()
})

View File

@ -133,4 +133,11 @@ export class AutomationAPI extends TestAPI {
}
)
}
deleteAll = async (expectations?: Expectations): Promise<void> => {
const { automations } = await this.fetch()
await Promise.all(
automations.map(automation => this.delete(automation, expectations))
)
}
}