From 410d8700e4555c414b50f19b0d626758e030ce2b Mon Sep 17 00:00:00 2001 From: Pedro Silva Date: Mon, 5 Jun 2023 18:42:44 +0100 Subject: [PATCH 1/7] Add more tests for user settings --- qa-core/src/internal-api/api/apis/SelfAPI.ts | 18 +++++++++++++++--- .../tests/users/userManagement.spec.ts | 16 ++++++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/qa-core/src/internal-api/api/apis/SelfAPI.ts b/qa-core/src/internal-api/api/apis/SelfAPI.ts index cd162053a1..022a438249 100644 --- a/qa-core/src/internal-api/api/apis/SelfAPI.ts +++ b/qa-core/src/internal-api/api/apis/SelfAPI.ts @@ -14,10 +14,11 @@ export default class SelfAPI extends BaseAPI { return [response, json] } - async changeSelfPassword(body: Partial): Promise<[Response, User]> { + async changeSelfPassword(): Promise<[Response, User]> { + const body = { + password: "newPassword", + } const [response, json] = await this.post(`/global/self`, body) - expect(json._id).toEqual(body._id) - expect(json._rev).not.toEqual(body._rev) return [response, json] } @@ -26,4 +27,15 @@ export default class SelfAPI extends BaseAPI { expect(json).toHaveProperty("apiKey") return json } + + async changeUserInfo(body: Partial): Promise<[Response, User]> { + const [response, json] = await this.post(`/global/self`, body) + return [response, json] + } + + async generateApiKey(): Promise<[Response, ApiKeyResponse]> { + const [response, json] = await this.post(`/global/self/api_key`) + expect(json).toHaveProperty("apiKey") + return [response, json] + } } diff --git a/qa-core/src/internal-api/tests/users/userManagement.spec.ts b/qa-core/src/internal-api/tests/users/userManagement.spec.ts index 28096c08c9..d1bada05c0 100644 --- a/qa-core/src/internal-api/tests/users/userManagement.spec.ts +++ b/qa-core/src/internal-api/tests/users/userManagement.spec.ts @@ -87,4 +87,20 @@ describe("Internal API - User Management & Permissions", () => { expect(changedUserInfoJson.builder?.global).toBeDefined() expect(changedUserInfoJson.builder?.global).toEqual(true) }) + + it("Set First and Last Name", async () => { + const body: Partial = { + firstName: "newFirstName", + lastName: "newLastName", + } + await config.api.self.changeUserInfo(body) + }) + + it("Generate API key", async () => { + await config.api.self.generateApiKey() + }) + + it("Change Password", async () => { + await config.api.self.changeSelfPassword() + }) }) From 0aa3e19d095b1623972e3c269e0fa332c7d5cdd7 Mon Sep 17 00:00:00 2001 From: Pedro Silva Date: Fri, 9 Jun 2023 12:44:31 +0100 Subject: [PATCH 2/7] Add verifications --- .../src/internal-api/tests/users/userManagement.spec.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/qa-core/src/internal-api/tests/users/userManagement.spec.ts b/qa-core/src/internal-api/tests/users/userManagement.spec.ts index d1bada05c0..42bda21102 100644 --- a/qa-core/src/internal-api/tests/users/userManagement.spec.ts +++ b/qa-core/src/internal-api/tests/users/userManagement.spec.ts @@ -94,6 +94,11 @@ describe("Internal API - User Management & Permissions", () => { lastName: "newLastName", } await config.api.self.changeUserInfo(body) + + const [changedUserInfoResponse, changedUserInfoJson] = + await config.api.self.getSelf() + expect(changedUserInfoJson.firstName).toEqual("newFirstName") + expect(changedUserInfoJson.lastName).toEqual("newLastName") }) it("Generate API key", async () => { @@ -102,5 +107,9 @@ describe("Internal API - User Management & Permissions", () => { it("Change Password", async () => { await config.api.self.changeSelfPassword() + const [changedUserInfoResponse, changedUserInfoJson] = + await config.api.self.getSelf() + + await config.login(changedUserInfoJson.email!, "newPassword") }) }) From bac1a411e8466e2abfb1c4fe66403d7f20457bcb Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 3 Jul 2023 10:31:07 +0100 Subject: [PATCH 3/7] Ensure columns configured in the grid block are always visible, even if hidden in the parent table --- packages/client/src/components/app/GridBlock.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/client/src/components/app/GridBlock.svelte b/packages/client/src/components/app/GridBlock.svelte index 3f2509f19b..ae0acb50f0 100644 --- a/packages/client/src/components/app/GridBlock.svelte +++ b/packages/client/src/components/app/GridBlock.svelte @@ -26,6 +26,7 @@ columns?.forEach(column => { overrides[column.name] = { displayName: column.displayName || column.name, + visible: true, } }) return overrides From bc47f5b0b28debb3fc22f37f555a6fe71075940e Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 3 Jul 2023 09:32:27 +0000 Subject: [PATCH 4/7] Bump version to 2.7.37-alpha.4 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 2c240a88ad..a9cd175fd1 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.7.37-alpha.3", + "version": "2.7.37-alpha.4", "npmClient": "yarn", "packages": [ "packages/*" From 3aad1e8ca3d8d4dbfccebc50af3f380c00291bda Mon Sep 17 00:00:00 2001 From: Conor Webb <126772285+ConorWebb96@users.noreply.github.com> Date: Mon, 3 Jul 2023 12:07:45 +0100 Subject: [PATCH 5/7] Helpers functions bug fixes (#11003) * Helpers functions bug fixes * Corrected multiply example * Removing test for times. --------- Co-authored-by: mike12345567 --- packages/string-templates/manifest.json | 27 +++---------------- packages/string-templates/package.json | 2 +- .../scripts/gen-collection-info.js | 6 ++--- .../string-templates/test/helpers.spec.js | 8 ------ 4 files changed, 8 insertions(+), 35 deletions(-) diff --git a/packages/string-templates/manifest.json b/packages/string-templates/manifest.json index f837f3aa75..087f1fd8ab 100644 --- a/packages/string-templates/manifest.json +++ b/packages/string-templates/manifest.json @@ -75,7 +75,7 @@ ], "numArgs": 2, "example": "{{ multiply 10 5 }} -> 50", - "description": "

Return the product of a times b.

\n" + "description": "

Multiply number a by number b.

\n" }, "plus": { "args": [ @@ -128,15 +128,6 @@ "numArgs": 1, "example": "{{ sum [1, 2, 3] }} -> 6", "description": "

Returns the sum of all numbers in the given array.

\n" - }, - "times": { - "args": [ - "a", - "b" - ], - "numArgs": 2, - "example": "{{ times 10 5 }} -> 50", - "description": "

Multiply number a by number b.

\n" } }, "array": { @@ -497,19 +488,9 @@ "str" ], "numArgs": 1, - "example": "{{ escape 'https://myurl?Hello%20There' }} -> https://myurl?Hello+There", + "example": "{{ decodeURI 'https://myurl?Hello%20There' }} -> https://myurl?=Hello There", "description": "

Decode a Uniform Resource Identifier (URI) component.

\n" }, - "url_encode": { - "args": [], - "numArgs": 0, - "description": "

Alias for encodeURI.

\n" - }, - "url_decode": { - "args": [], - "numArgs": 0, - "description": "

Alias for decodeURI.

\n" - }, "urlResolve": { "args": [ "base", @@ -625,7 +606,7 @@ "length" ], "numArgs": 2, - "example": "{{ellipsis 'foo bar baz' 7}} -> foo bar…", + "example": "{{ellipsis 'foo bar baz', 7}} -> foo bar…", "description": "

Truncates a string to the specified length, and appends it with an elipsis, .

\n" }, "hyphenate": { @@ -1219,4 +1200,4 @@ "description": "

Produce a humanized duration left/until given an amount of time and the type of time measurement.

\n" } } -} +} \ No newline at end of file diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index b1a276369f..07326d31b7 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -25,7 +25,7 @@ "manifest": "node ./scripts/gen-collection-info.js" }, "dependencies": { - "@budibase/handlebars-helpers": "^0.11.8", + "@budibase/handlebars-helpers": "^0.11.9", "dayjs": "^1.10.4", "handlebars": "^4.7.6", "handlebars-utils": "^1.0.6", diff --git a/packages/string-templates/scripts/gen-collection-info.js b/packages/string-templates/scripts/gen-collection-info.js index bfc0ec79ac..1dbb20e5cf 100644 --- a/packages/string-templates/scripts/gen-collection-info.js +++ b/packages/string-templates/scripts/gen-collection-info.js @@ -9,8 +9,8 @@ const marked = require("marked") * full list of supported helpers can be found here: * https://github.com/budibase/handlebars-helpers */ - -const DIRECTORY = fs.existsSync("node_modules") ? "." : ".." +const { join } = require("path") +const DIRECTORY = join(__dirname, "..", "..", "..") const COLLECTIONS = [ "math", "array", @@ -20,7 +20,7 @@ const COLLECTIONS = [ "comparison", "object", ] -const FILENAME = `${DIRECTORY}/manifest.json` +const FILENAME = join(__dirname, "..", "manifest.json") const outputJSON = {} const ADDED_HELPERS = { date: { diff --git a/packages/string-templates/test/helpers.spec.js b/packages/string-templates/test/helpers.spec.js index 1969410993..a587ca60dd 100644 --- a/packages/string-templates/test/helpers.spec.js +++ b/packages/string-templates/test/helpers.spec.js @@ -48,14 +48,6 @@ describe("test the math helpers", () => { }) expect(parseInt(output)).toBe(2) }) - - it("should be able to times", async () => { - const output = await processString("{{times a b}}", { - a: 5, - b: 5, - }) - expect(parseInt(output)).toBe(25) - }) }) describe("test the array helpers", () => { From 71e44b1eab55982ef06afcab02402b6f16679a67 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 3 Jul 2023 11:08:02 +0000 Subject: [PATCH 6/7] Bump version to 2.7.37-alpha.5 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index a9cd175fd1..8da39031d3 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.7.37-alpha.4", + "version": "2.7.37-alpha.5", "npmClient": "yarn", "packages": [ "packages/*" From e4c5e67514f5a0ccc5dbefe639a21977c74100f8 Mon Sep 17 00:00:00 2001 From: Michael Drury Date: Mon, 3 Jul 2023 14:10:18 +0100 Subject: [PATCH 7/7] Revert "Add more tests for user settings" --- qa-core/src/internal-api/api/apis/SelfAPI.ts | 18 +++---------- .../tests/users/userManagement.spec.ts | 25 ------------------- 2 files changed, 3 insertions(+), 40 deletions(-) diff --git a/qa-core/src/internal-api/api/apis/SelfAPI.ts b/qa-core/src/internal-api/api/apis/SelfAPI.ts index 022a438249..cd162053a1 100644 --- a/qa-core/src/internal-api/api/apis/SelfAPI.ts +++ b/qa-core/src/internal-api/api/apis/SelfAPI.ts @@ -14,11 +14,10 @@ export default class SelfAPI extends BaseAPI { return [response, json] } - async changeSelfPassword(): Promise<[Response, User]> { - const body = { - password: "newPassword", - } + async changeSelfPassword(body: Partial): Promise<[Response, User]> { const [response, json] = await this.post(`/global/self`, body) + expect(json._id).toEqual(body._id) + expect(json._rev).not.toEqual(body._rev) return [response, json] } @@ -27,15 +26,4 @@ export default class SelfAPI extends BaseAPI { expect(json).toHaveProperty("apiKey") return json } - - async changeUserInfo(body: Partial): Promise<[Response, User]> { - const [response, json] = await this.post(`/global/self`, body) - return [response, json] - } - - async generateApiKey(): Promise<[Response, ApiKeyResponse]> { - const [response, json] = await this.post(`/global/self/api_key`) - expect(json).toHaveProperty("apiKey") - return [response, json] - } } diff --git a/qa-core/src/internal-api/tests/users/userManagement.spec.ts b/qa-core/src/internal-api/tests/users/userManagement.spec.ts index 42bda21102..28096c08c9 100644 --- a/qa-core/src/internal-api/tests/users/userManagement.spec.ts +++ b/qa-core/src/internal-api/tests/users/userManagement.spec.ts @@ -87,29 +87,4 @@ describe("Internal API - User Management & Permissions", () => { expect(changedUserInfoJson.builder?.global).toBeDefined() expect(changedUserInfoJson.builder?.global).toEqual(true) }) - - it("Set First and Last Name", async () => { - const body: Partial = { - firstName: "newFirstName", - lastName: "newLastName", - } - await config.api.self.changeUserInfo(body) - - const [changedUserInfoResponse, changedUserInfoJson] = - await config.api.self.getSelf() - expect(changedUserInfoJson.firstName).toEqual("newFirstName") - expect(changedUserInfoJson.lastName).toEqual("newLastName") - }) - - it("Generate API key", async () => { - await config.api.self.generateApiKey() - }) - - it("Change Password", async () => { - await config.api.self.changeSelfPassword() - const [changedUserInfoResponse, changedUserInfoJson] = - await config.api.self.getSelf() - - await config.login(changedUserInfoJson.email!, "newPassword") - }) })