From 46381c381dda7a879cf001fb6288abd849639f10 Mon Sep 17 00:00:00 2001 From: Pedro Silva Date: Sun, 26 Mar 2023 18:00:20 +0100 Subject: [PATCH] Update commands to run locally and in CI --- qa-core/package.json | 6 ++-- .../internal-api/dataSources/example.spec.ts | 36 +++++++++++++++++++ 2 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 qa-core/src/tests/internal-api/dataSources/example.spec.ts diff --git a/qa-core/package.json b/qa-core/package.json index 15246af294..6fb032cd04 100644 --- a/qa-core/package.json +++ b/qa-core/package.json @@ -13,13 +13,15 @@ "test:watch": "env-cmd jest --watch", "test:debug": "DEBUG=1 jest", "test:notify": "node scripts/testResultsWebhook", - "test:ci": "jest --runInBand --json --outputFile=testResults.json", + "test:ci": "jest --runInBand --testPathIgnorePatterns=\\\"\\/dataSources\\/\\\"", "docker:up": "docker-compose up -d", "docker:down": "docker-compose down", "api:server:setup": "npm run docker:up && env-cmd ts-node ../packages/builder/ts/setup.ts", "api:server:setup:ci": "env-cmd node ../packages/builder/setup.js", "api:test:ci": "start-server-and-test api:server:setup:ci http://localhost:4100/builder test", - "api:test": "start-server-and-test api:server:setup http://localhost:4100/builder test" + "api:test": "start-server-and-test api:server:setup http://localhost:4100/builder test", + "api:test:local": "env-cmd jest --runInBand --testPathIgnorePatterns=\\\"\\/dataSources\\/\\\"", + "api:test:local:withDataSources": "env-cmd jest --runInBand" }, "jest": { "preset": "ts-jest", diff --git a/qa-core/src/tests/internal-api/dataSources/example.spec.ts b/qa-core/src/tests/internal-api/dataSources/example.spec.ts new file mode 100644 index 0000000000..736e49bd89 --- /dev/null +++ b/qa-core/src/tests/internal-api/dataSources/example.spec.ts @@ -0,0 +1,36 @@ +import TestConfiguration from "../../../config/internal-api/TestConfiguration" +import { App } from "@budibase/types" +import InternalAPIClient from "../../../config/internal-api/TestConfiguration/InternalAPIClient" +import AccountsAPIClient from "../../../config/internal-api/TestConfiguration/accountsAPIClient" +import { generateApp } from "../../../config/internal-api/fixtures/applications" +import { Screen } from "@budibase/types" +import generateScreen from "../../../config/internal-api/fixtures/screens" + +describe("Internal API - Data Sources", () => { + const api = new InternalAPIClient() + const accountsAPI = new AccountsAPIClient() + const config = new TestConfiguration(api, accountsAPI) + const appConfig = new TestConfiguration(api, accountsAPI) + + beforeAll(async () => { + await config.setupAccountAndTenant() + }) + + afterAll(async () => { + await config.afterAll() + }) + + it("Create an app with a data source", async () => { + // Create app + const app = await appConfig.applications.create(generateApp()) + + // Create Screen + const roleArray = ["BASIC", "POWER", "ADMIN", "PUBLIC"] + appConfig.applications.api.appId = app.appId + for (let role in roleArray) { + const [response, screen] = await config.screen.create( + generateScreen(roleArray[role]) + ) + } + }) +})