Merge pull request #15662 from Budibase/fix-slow-loop-tests
Cleanup after automation tests.
This commit is contained in:
commit
9ee432f5b0
|
@ -16,6 +16,7 @@ describe("Execute Bash Automations", () => {
|
|||
name: "test row",
|
||||
description: "test description",
|
||||
})
|
||||
await config.api.automation.deleteAll()
|
||||
})
|
||||
|
||||
afterAll(() => {
|
||||
|
|
|
@ -33,6 +33,7 @@ describe("test the create row action", () => {
|
|||
name: "test",
|
||||
description: "test",
|
||||
}
|
||||
await config.api.automation.deleteAll()
|
||||
})
|
||||
|
||||
afterAll(() => {
|
||||
|
|
|
@ -6,6 +6,7 @@ describe("test the delay logic", () => {
|
|||
|
||||
beforeAll(async () => {
|
||||
await config.init()
|
||||
await config.api.automation.deleteAll()
|
||||
})
|
||||
|
||||
afterAll(() => {
|
||||
|
|
|
@ -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(() => {
|
||||
|
|
|
@ -7,6 +7,7 @@ describe("test the outgoing webhook action", () => {
|
|||
|
||||
beforeAll(async () => {
|
||||
await config.init()
|
||||
await config.api.automation.deleteAll()
|
||||
})
|
||||
|
||||
afterAll(() => {
|
||||
|
|
|
@ -26,6 +26,7 @@ if (descriptions.length) {
|
|||
const ds = await dsProvider()
|
||||
datasource = ds.datasource!
|
||||
client = ds.client!
|
||||
await config.api.automation.deleteAll()
|
||||
})
|
||||
|
||||
beforeEach(async () => {
|
||||
|
|
|
@ -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(() => {
|
||||
|
|
|
@ -26,6 +26,7 @@ describe("test the filter logic", () => {
|
|||
|
||||
beforeAll(async () => {
|
||||
await config.init()
|
||||
await config.api.automation.deleteAll()
|
||||
})
|
||||
|
||||
afterAll(() => {
|
||||
|
|
|
@ -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!, {})
|
||||
|
|
|
@ -7,6 +7,7 @@ describe("test the outgoing webhook action", () => {
|
|||
|
||||
beforeAll(async () => {
|
||||
await config.init()
|
||||
await config.api.automation.deleteAll()
|
||||
})
|
||||
|
||||
afterAll(() => {
|
||||
|
|
|
@ -8,6 +8,7 @@ describe("test the outgoing webhook action", () => {
|
|||
|
||||
beforeAll(async () => {
|
||||
await config.init()
|
||||
await config.api.automation.deleteAll()
|
||||
})
|
||||
|
||||
afterAll(() => {
|
||||
|
|
|
@ -16,6 +16,7 @@ describe("test the openai action", () => {
|
|||
|
||||
beforeAll(async () => {
|
||||
await config.init()
|
||||
await config.api.automation.deleteAll()
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
|
|
|
@ -8,6 +8,7 @@ describe("test the outgoing webhook action", () => {
|
|||
|
||||
beforeAll(async () => {
|
||||
await config.init()
|
||||
await config.api.automation.deleteAll()
|
||||
})
|
||||
|
||||
afterAll(() => {
|
||||
|
|
|
@ -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(() => {
|
||||
|
|
|
@ -28,6 +28,7 @@ describe("test the outgoing webhook action", () => {
|
|||
|
||||
beforeAll(async () => {
|
||||
await config.init()
|
||||
await config.api.automation.deleteAll()
|
||||
})
|
||||
|
||||
afterAll(() => {
|
||||
|
|
|
@ -6,6 +6,7 @@ describe("test the server log action", () => {
|
|||
|
||||
beforeAll(async () => {
|
||||
await config.init()
|
||||
await config.api.automation.deleteAll()
|
||||
})
|
||||
|
||||
afterAll(() => {
|
||||
|
|
|
@ -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 () => {
|
||||
|
|
|
@ -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(() => {
|
||||
|
|
|
@ -7,6 +7,7 @@ describe("test the outgoing webhook action", () => {
|
|||
|
||||
beforeAll(async () => {
|
||||
await config.init()
|
||||
await config.api.automation.deleteAll()
|
||||
})
|
||||
|
||||
afterAll(() => {
|
||||
|
|
|
@ -9,6 +9,8 @@ describe("app action trigger", () => {
|
|||
|
||||
beforeAll(async () => {
|
||||
await config.init()
|
||||
await config.api.automation.deleteAll()
|
||||
|
||||
automation = await createAutomationBuilder(config)
|
||||
.onAppAction()
|
||||
.serverLog({
|
||||
|
|
|
@ -16,6 +16,7 @@ describe("cron trigger", () => {
|
|||
|
||||
beforeAll(async () => {
|
||||
await config.init()
|
||||
await config.api.automation.deleteAll()
|
||||
})
|
||||
|
||||
afterAll(() => {
|
||||
|
|
|
@ -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! })
|
||||
|
|
|
@ -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! })
|
||||
|
|
|
@ -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! })
|
||||
|
|
|
@ -37,6 +37,7 @@ describe("Webhook trigger test", () => {
|
|||
|
||||
beforeEach(async () => {
|
||||
await config.init()
|
||||
await config.api.automation.deleteAll()
|
||||
table = await config.createTable()
|
||||
})
|
||||
|
||||
|
|
|
@ -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))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue