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",
|
name: "test row",
|
||||||
description: "test description",
|
description: "test description",
|
||||||
})
|
})
|
||||||
|
await config.api.automation.deleteAll()
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
|
|
|
@ -33,6 +33,7 @@ describe("test the create row action", () => {
|
||||||
name: "test",
|
name: "test",
|
||||||
description: "test",
|
description: "test",
|
||||||
}
|
}
|
||||||
|
await config.api.automation.deleteAll()
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
|
|
|
@ -6,6 +6,7 @@ describe("test the delay logic", () => {
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await config.init()
|
await config.init()
|
||||||
|
await config.api.automation.deleteAll()
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
|
|
|
@ -13,6 +13,7 @@ describe("test the delete row action", () => {
|
||||||
await config.init()
|
await config.init()
|
||||||
table = await config.api.table.save(basicTable())
|
table = await config.api.table.save(basicTable())
|
||||||
row = await config.api.row.save(table._id!, {})
|
row = await config.api.row.save(table._id!, {})
|
||||||
|
await config.api.automation.deleteAll()
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
|
|
|
@ -7,6 +7,7 @@ describe("test the outgoing webhook action", () => {
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await config.init()
|
await config.init()
|
||||||
|
await config.api.automation.deleteAll()
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
|
|
|
@ -26,6 +26,7 @@ if (descriptions.length) {
|
||||||
const ds = await dsProvider()
|
const ds = await dsProvider()
|
||||||
datasource = ds.datasource!
|
datasource = ds.datasource!
|
||||||
client = ds.client!
|
client = ds.client!
|
||||||
|
await config.api.automation.deleteAll()
|
||||||
})
|
})
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
|
|
@ -13,6 +13,7 @@ describe("Execute Script Automations", () => {
|
||||||
await config.init()
|
await config.init()
|
||||||
table = await config.api.table.save(basicTable())
|
table = await config.api.table.save(basicTable())
|
||||||
await config.api.row.save(table._id!, {})
|
await config.api.row.save(table._id!, {})
|
||||||
|
await config.api.automation.deleteAll()
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
|
|
|
@ -26,6 +26,7 @@ describe("test the filter logic", () => {
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await config.init()
|
await config.init()
|
||||||
|
await config.api.automation.deleteAll()
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
|
|
|
@ -22,10 +22,7 @@ describe("Attempt to run a basic loop automation", () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
const { automations } = await config.api.automation.fetch()
|
await config.api.automation.deleteAll()
|
||||||
for (const automation of automations) {
|
|
||||||
await config.api.automation.delete(automation)
|
|
||||||
}
|
|
||||||
|
|
||||||
table = await config.api.table.save(basicTable())
|
table = await config.api.table.save(basicTable())
|
||||||
await config.api.row.save(table._id!, {})
|
await config.api.row.save(table._id!, {})
|
||||||
|
|
|
@ -7,6 +7,7 @@ describe("test the outgoing webhook action", () => {
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await config.init()
|
await config.init()
|
||||||
|
await config.api.automation.deleteAll()
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
|
|
|
@ -8,6 +8,7 @@ describe("test the outgoing webhook action", () => {
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await config.init()
|
await config.init()
|
||||||
|
await config.api.automation.deleteAll()
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
|
|
|
@ -16,6 +16,7 @@ describe("test the openai action", () => {
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await config.init()
|
await config.init()
|
||||||
|
await config.api.automation.deleteAll()
|
||||||
})
|
})
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|
|
@ -8,6 +8,7 @@ describe("test the outgoing webhook action", () => {
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await config.init()
|
await config.init()
|
||||||
|
await config.api.automation.deleteAll()
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(() => {
|
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.row.save(table._id!, row)
|
await config.api.row.save(table._id!, row)
|
||||||
|
await config.api.automation.deleteAll()
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
|
|
|
@ -28,6 +28,7 @@ describe("test the outgoing webhook action", () => {
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await config.init()
|
await config.init()
|
||||||
|
await config.api.automation.deleteAll()
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
|
|
|
@ -6,6 +6,7 @@ describe("test the server log action", () => {
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await config.init()
|
await config.init()
|
||||||
|
await config.api.automation.deleteAll()
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
|
|
|
@ -9,6 +9,7 @@ describe("Test triggering an automation from another automation", () => {
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await automation.init()
|
await automation.init()
|
||||||
await config.init()
|
await config.init()
|
||||||
|
await config.api.automation.deleteAll()
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
|
|
@ -23,6 +23,7 @@ describe("test the update row action", () => {
|
||||||
await config.init()
|
await config.init()
|
||||||
table = await config.createTable()
|
table = await config.createTable()
|
||||||
row = await config.createRow()
|
row = await config.createRow()
|
||||||
|
await config.api.automation.deleteAll()
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
|
|
|
@ -7,6 +7,7 @@ describe("test the outgoing webhook action", () => {
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await config.init()
|
await config.init()
|
||||||
|
await config.api.automation.deleteAll()
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
|
|
|
@ -9,6 +9,8 @@ describe("app action trigger", () => {
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await config.init()
|
await config.init()
|
||||||
|
await config.api.automation.deleteAll()
|
||||||
|
|
||||||
automation = await createAutomationBuilder(config)
|
automation = await createAutomationBuilder(config)
|
||||||
.onAppAction()
|
.onAppAction()
|
||||||
.serverLog({
|
.serverLog({
|
||||||
|
|
|
@ -16,6 +16,7 @@ describe("cron trigger", () => {
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await config.init()
|
await config.init()
|
||||||
|
await config.api.automation.deleteAll()
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
|
|
|
@ -11,6 +11,7 @@ describe("row deleted trigger", () => {
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await config.init()
|
await config.init()
|
||||||
|
await config.api.automation.deleteAll()
|
||||||
table = await config.api.table.save(basicTable())
|
table = await config.api.table.save(basicTable())
|
||||||
automation = await createAutomationBuilder(config)
|
automation = await createAutomationBuilder(config)
|
||||||
.onRowDeleted({ tableId: table._id! })
|
.onRowDeleted({ tableId: table._id! })
|
||||||
|
|
|
@ -11,6 +11,7 @@ describe("row saved trigger", () => {
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await config.init()
|
await config.init()
|
||||||
|
await config.api.automation.deleteAll()
|
||||||
table = await config.api.table.save(basicTable())
|
table = await config.api.table.save(basicTable())
|
||||||
automation = await createAutomationBuilder(config)
|
automation = await createAutomationBuilder(config)
|
||||||
.onRowSaved({ tableId: table._id! })
|
.onRowSaved({ tableId: table._id! })
|
||||||
|
|
|
@ -11,6 +11,7 @@ describe("row updated trigger", () => {
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await config.init()
|
await config.init()
|
||||||
|
await config.api.automation.deleteAll()
|
||||||
table = await config.api.table.save(basicTable())
|
table = await config.api.table.save(basicTable())
|
||||||
automation = await createAutomationBuilder(config)
|
automation = await createAutomationBuilder(config)
|
||||||
.onRowUpdated({ tableId: table._id! })
|
.onRowUpdated({ tableId: table._id! })
|
||||||
|
|
|
@ -37,6 +37,7 @@ describe("Webhook trigger test", () => {
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await config.init()
|
await config.init()
|
||||||
|
await config.api.automation.deleteAll()
|
||||||
table = await config.createTable()
|
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