diff --git a/packages/server/src/api/controllers/dev.js b/packages/server/src/api/controllers/dev.js index e5582be5b3..c8f134756b 100644 --- a/packages/server/src/api/controllers/dev.js +++ b/packages/server/src/api/controllers/dev.js @@ -103,7 +103,7 @@ exports.revert = async ctx => { target: appId, }) try { - if (!env.isCypress()) { + if (env.COUCH_DB_URL) { // in-memory db stalls on rollback await replication.rollback() } diff --git a/packages/server/src/api/controllers/table/internal.ts b/packages/server/src/api/controllers/table/internal.ts index 22c9b6dc55..7e55c71aea 100644 --- a/packages/server/src/api/controllers/table/internal.ts +++ b/packages/server/src/api/controllers/table/internal.ts @@ -18,6 +18,7 @@ import { Table } from "@budibase/types" import { quotas } from "@budibase/pro" import { isEqual } from "lodash" import { cloneDeep } from "lodash/fp" +import env from "../../../environment" function checkAutoColumns(table: Table, oldTable: Table) { if (!table.schema) { @@ -167,7 +168,7 @@ export async function destroy(ctx: any) { await db.remove(tableToDelete) // remove table search index - if (!isTest()) { + if (!isTest() || env.COUCH_DB_URL) { const currentIndexes = await db.getIndexes() const existingIndex = currentIndexes.indexes.find( (existing: any) => existing.name === `search:${ctx.params.tableId}` diff --git a/qa-core/src/config/internal-api/TestConfiguration/applications.ts b/qa-core/src/config/internal-api/TestConfiguration/applications.ts index 8c88819ef5..0372e50b0b 100644 --- a/qa-core/src/config/internal-api/TestConfiguration/applications.ts +++ b/qa-core/src/config/internal-api/TestConfiguration/applications.ts @@ -59,8 +59,8 @@ export default class AppApi { return [response, json] } - async revert(appId: string): Promise<[Response, Application]> { - const response = await this.api.post(`/applications/${appId}/client/revert`) + async revert(appId: string): Promise<[Response, { message: string }]> { + const response = await this.api.post(`/dev/${appId}/revert`) const json = await response.json() return [response, json] } @@ -82,8 +82,8 @@ export default class AppApi { const json = await response.json() return [response, json] } - async addScreentoApp(body: any): Promise<[Response, Application]> { + async addScreentoApp(body: any): Promise<[Response, Application]> { const response = await this.api.post(`/screens`, { body }) const json = await response.json() return [response, json] diff --git a/qa-core/src/tests/internal-api/applications/create.spec.ts b/qa-core/src/tests/internal-api/applications/create.spec.ts index 4b9a21319d..fc7901cc6f 100644 --- a/qa-core/src/tests/internal-api/applications/create.spec.ts +++ b/qa-core/src/tests/internal-api/applications/create.spec.ts @@ -158,11 +158,11 @@ describe("Internal API - /applications endpoints", () => { expect(screenResponse).toHaveStatusCode(200) expect(screen._id).toBeDefined() - - const [revertResponse, revert] = await config.applications.revert(app.appId ? app.appId : "") + // // Revert the app to published state + const [revertResponse, revert] = await config.applications.revert(app.appId as string) expect(revertResponse).toHaveStatusCode(200) expect(revert).toEqual({ - message: "App reverted successfully." + message: "Reverted changes successfully." }) // Check screen is removed