@open-mercato/checkout 0.10.1-develop.7994.1.c9f31972aa → 0.10.1-develop.8022.1.b6753de892

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- [build:checkout] found 169 entry points
1
+ [build:checkout] found 170 entry points
2
2
  [build:checkout] built successfully
@@ -0,0 +1,132 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { expect, test } from "@playwright/test";
3
+ import { apiRequest, getAuthToken } from "@open-mercato/core/helpers/integration/api";
4
+ import { acknowledgeGlobalNotices } from "@open-mercato/core/helpers/integration/auth";
5
+ import { expectId, readJsonSafe } from "@open-mercato/core/helpers/integration/generalFixtures";
6
+ import { CHECKOUT_ENTITY_IDS } from "../lib/constants.js";
7
+ import { CHECKOUT_LINK_CUSTOM_FIELDS, CHECKOUT_LINK_FIELDSETS } from "../lib/customFields.js";
8
+ const editors = [
9
+ { path: "/backend/checkout/pay-links/create", entityId: CHECKOUT_ENTITY_IDS.link },
10
+ { path: "/backend/checkout/templates/create", entityId: CHECKOUT_ENTITY_IDS.template }
11
+ ];
12
+ const serviceFields = CHECKOUT_LINK_CUSTOM_FIELDS.filter((field) => field.fieldset === "service_package");
13
+ const fieldsets = ["donation_campaign", "service_package"].map((code) => CHECKOUT_LINK_FIELDSETS.find((fieldset) => fieldset.code === code));
14
+ for (const editor of editors) {
15
+ test.describe(`TC-CHKT-047: Polish Service package on ${editor.path}`, () => {
16
+ let token;
17
+ let tenantId;
18
+ let organizationId;
19
+ test.beforeEach(async ({ request }) => {
20
+ tenantId = null;
21
+ organizationId = null;
22
+ token = await getAuthToken(request, "superadmin");
23
+ const marker = `checkout-localization-${randomUUID()}`;
24
+ const tenantResponse = await apiRequest(request, "POST", "/api/directory/tenants", {
25
+ token,
26
+ data: { name: marker }
27
+ });
28
+ expect(tenantResponse.status()).toBe(201);
29
+ tenantId = expectId((await readJsonSafe(tenantResponse))?.id, "Owned tenant id");
30
+ const organizationResponse = await apiRequest(request, "POST", "/api/directory/organizations", {
31
+ token,
32
+ data: { tenantId, name: marker }
33
+ });
34
+ expect(organizationResponse.status()).toBe(201);
35
+ organizationId = expectId((await readJsonSafe(organizationResponse))?.id, "Owned organization id");
36
+ const response = await apiRequest(request, "POST", "/api/entities/definitions.batch", {
37
+ token,
38
+ headers: { Cookie: `om_selected_tenant=${tenantId}; om_selected_org=${organizationId}` },
39
+ data: {
40
+ entityId: editor.entityId,
41
+ definitions: serviceFields.map(({ key, kind, ...configJson }) => ({ key, kind, configJson })),
42
+ fieldsets,
43
+ singleFieldsetPerRecord: true
44
+ }
45
+ });
46
+ expect(response.ok(), "Create owned Service package definitions").toBeTruthy();
47
+ const ownedResponse = await apiRequest(request, "GET", `/api/entities/definitions.manage?entityId=${editor.entityId}`, {
48
+ token,
49
+ headers: { Cookie: `om_selected_tenant=${tenantId}; om_selected_org=${organizationId}` }
50
+ });
51
+ expect(ownedResponse.ok()).toBeTruthy();
52
+ const owned = await readJsonSafe(ownedResponse);
53
+ for (const field of serviceFields) {
54
+ expect(owned?.items.find((item) => item.key === field.key)).toMatchObject({ tenantId, organizationId });
55
+ }
56
+ });
57
+ test.afterEach(async ({ request }) => {
58
+ try {
59
+ if (tenantId && organizationId) {
60
+ const response = await apiRequest(request, "POST", "/api/entities/definitions.batch", {
61
+ token,
62
+ headers: { Cookie: `om_selected_tenant=${tenantId}; om_selected_org=${organizationId}` },
63
+ data: {
64
+ entityId: editor.entityId,
65
+ definitions: serviceFields.map(({ key, kind }) => ({ key, kind, isActive: false })),
66
+ fieldsets: []
67
+ }
68
+ });
69
+ expect(response.ok(), "Remove owned definitions and fieldsets").toBeTruthy();
70
+ }
71
+ } finally {
72
+ try {
73
+ if (organizationId) {
74
+ const response = await apiRequest(request, "DELETE", `/api/directory/organizations?id=${organizationId}`, { token });
75
+ expect(response.ok(), "Delete owned organization").toBeTruthy();
76
+ }
77
+ } finally {
78
+ if (tenantId) {
79
+ const response = await apiRequest(request, "DELETE", `/api/directory/tenants?id=${tenantId}`, { token });
80
+ expect(response.ok(), "Delete owned tenant").toBeTruthy();
81
+ }
82
+ }
83
+ }
84
+ });
85
+ test("translates shipped metadata and preserves a tenant-authored label", async ({ page, request, baseURL }, testInfo) => {
86
+ await acknowledgeGlobalNotices(page);
87
+ await page.context().addCookies([
88
+ { name: "auth_token", value: token, url: baseURL },
89
+ { name: "om_selected_tenant", value: tenantId, url: baseURL },
90
+ { name: "om_selected_org", value: organizationId, url: baseURL },
91
+ { name: "locale", value: "pl", url: baseURL }
92
+ ]);
93
+ await page.goto(editor.path);
94
+ const fieldsetSelector = page.getByRole("combobox").filter({ hasText: "Donation campaign" });
95
+ await fieldsetSelector.click();
96
+ await page.getByRole("option", { name: "Pakiet us\u0142ug", exact: true }).click();
97
+ await expect(page.getByRole("combobox").filter({ hasText: "Pakiet us\u0142ug" })).toBeVisible();
98
+ await expect(page.getByText("Termin realizacji", { exact: true })).toBeVisible();
99
+ await expect(page.getByText("Przed p\u0142atno\u015Bci\u0105", { exact: true })).toBeVisible();
100
+ await expect(page.getByText("Co obejmuje us\u0142uga", { exact: true })).toHaveCount(2);
101
+ await expect(page.getByText("Co obejmuje us\u0142uga", { exact: true }).first()).toBeVisible();
102
+ await expect(page.getByText("Co obejmuje us\u0142uga", { exact: true }).last()).toBeVisible();
103
+ await testInfo.attach("polish-service-package", {
104
+ body: await page.screenshot({ fullPage: true }),
105
+ contentType: "image/png"
106
+ });
107
+ const literalLabel = `Our delivery promise ${randomUUID()}`;
108
+ const deliveryField = serviceFields.find((field) => field.key === "delivery_timeline");
109
+ const { key, kind, ...configJson } = deliveryField;
110
+ const response = await apiRequest(request, "POST", "/api/entities/definitions", {
111
+ token,
112
+ headers: { Cookie: `om_selected_tenant=${tenantId}; om_selected_org=${organizationId}` },
113
+ data: { entityId: editor.entityId, key, kind, configJson: { ...configJson, label: literalLabel } }
114
+ });
115
+ expect(response.ok(), "Set tenant-authored label through the definitions API").toBeTruthy();
116
+ await page.reload();
117
+ await page.getByRole("combobox").filter({ hasText: "Donation campaign" }).click();
118
+ await page.getByRole("option", { name: "Pakiet us\u0142ug", exact: true }).click();
119
+ await expect(page.getByText(literalLabel, { exact: true })).toBeVisible();
120
+ await expect(page.getByText("Termin realizacji", { exact: true })).toHaveCount(0);
121
+ await expect(page.getByText("Przed p\u0142atno\u015Bci\u0105", { exact: true })).toBeVisible();
122
+ await expect(page.getByText("Co obejmuje us\u0142uga", { exact: true })).toHaveCount(2);
123
+ await expect(page.getByText("Co obejmuje us\u0142uga", { exact: true }).first()).toBeVisible();
124
+ await expect(page.getByText("Co obejmuje us\u0142uga", { exact: true }).last()).toBeVisible();
125
+ await testInfo.attach("polish-tenant-label", {
126
+ body: await page.screenshot({ fullPage: true }),
127
+ contentType: "image/png"
128
+ });
129
+ });
130
+ });
131
+ }
132
+ //# sourceMappingURL=TC-CHKT-047-service-package-localization.spec.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/modules/checkout/__integration__/TC-CHKT-047-service-package-localization.spec.ts"],
4
+ "sourcesContent": ["import { randomUUID } from 'node:crypto'\nimport { expect, test } from '@playwright/test'\nimport { apiRequest, getAuthToken } from '@open-mercato/core/helpers/integration/api'\nimport { acknowledgeGlobalNotices } from '@open-mercato/core/helpers/integration/auth'\nimport { expectId, readJsonSafe } from '@open-mercato/core/helpers/integration/generalFixtures'\nimport { CHECKOUT_ENTITY_IDS } from '../lib/constants'\nimport { CHECKOUT_LINK_CUSTOM_FIELDS, CHECKOUT_LINK_FIELDSETS } from '../lib/customFields'\n\nconst editors = [\n { path: '/backend/checkout/pay-links/create', entityId: CHECKOUT_ENTITY_IDS.link },\n { path: '/backend/checkout/templates/create', entityId: CHECKOUT_ENTITY_IDS.template },\n]\nconst serviceFields = CHECKOUT_LINK_CUSTOM_FIELDS.filter((field) => field.fieldset === 'service_package')\nconst fieldsets = ['donation_campaign', 'service_package'].map((code) => (\n CHECKOUT_LINK_FIELDSETS.find((fieldset) => fieldset.code === code)!\n))\n\nfor (const editor of editors) {\n test.describe(`TC-CHKT-047: Polish Service package on ${editor.path}`, () => {\n let token: string\n let tenantId: string | null\n let organizationId: string | null\n\n test.beforeEach(async ({ request }) => {\n tenantId = null\n organizationId = null\n token = await getAuthToken(request, 'superadmin')\n const marker = `checkout-localization-${randomUUID()}`\n const tenantResponse = await apiRequest(request, 'POST', '/api/directory/tenants', {\n token,\n data: { name: marker },\n })\n expect(tenantResponse.status()).toBe(201)\n tenantId = expectId((await readJsonSafe<{ id?: string }>(tenantResponse))?.id, 'Owned tenant id')\n const organizationResponse = await apiRequest(request, 'POST', '/api/directory/organizations', {\n token,\n data: { tenantId, name: marker },\n })\n expect(organizationResponse.status()).toBe(201)\n organizationId = expectId((await readJsonSafe<{ id?: string }>(organizationResponse))?.id, 'Owned organization id')\n const response = await apiRequest(request, 'POST', '/api/entities/definitions.batch', {\n token,\n headers: { Cookie: `om_selected_tenant=${tenantId}; om_selected_org=${organizationId}` },\n data: {\n entityId: editor.entityId,\n definitions: serviceFields.map(({ key, kind, ...configJson }) => ({ key, kind, configJson })),\n fieldsets,\n singleFieldsetPerRecord: true,\n },\n })\n expect(response.ok(), 'Create owned Service package definitions').toBeTruthy()\n const ownedResponse = await apiRequest(request, 'GET', `/api/entities/definitions.manage?entityId=${editor.entityId}`, {\n token,\n headers: { Cookie: `om_selected_tenant=${tenantId}; om_selected_org=${organizationId}` },\n })\n expect(ownedResponse.ok()).toBeTruthy()\n const owned = await readJsonSafe<{ items: Array<{ key: string; tenantId: string; organizationId: string }> }>(ownedResponse)\n for (const field of serviceFields) {\n expect(owned?.items.find((item) => item.key === field.key)).toMatchObject({ tenantId, organizationId })\n }\n })\n\n test.afterEach(async ({ request }) => {\n try {\n if (tenantId && organizationId) {\n const response = await apiRequest(request, 'POST', '/api/entities/definitions.batch', {\n token,\n headers: { Cookie: `om_selected_tenant=${tenantId}; om_selected_org=${organizationId}` },\n data: {\n entityId: editor.entityId,\n definitions: serviceFields.map(({ key, kind }) => ({ key, kind, isActive: false })),\n fieldsets: [],\n },\n })\n expect(response.ok(), 'Remove owned definitions and fieldsets').toBeTruthy()\n }\n } finally {\n try {\n if (organizationId) {\n const response = await apiRequest(request, 'DELETE', `/api/directory/organizations?id=${organizationId}`, { token })\n expect(response.ok(), 'Delete owned organization').toBeTruthy()\n }\n } finally {\n if (tenantId) {\n const response = await apiRequest(request, 'DELETE', `/api/directory/tenants?id=${tenantId}`, { token })\n expect(response.ok(), 'Delete owned tenant').toBeTruthy()\n }\n }\n }\n })\n\n test('translates shipped metadata and preserves a tenant-authored label', async ({ page, request, baseURL }, testInfo) => {\n await acknowledgeGlobalNotices(page)\n await page.context().addCookies([\n { name: 'auth_token', value: token, url: baseURL! },\n { name: 'om_selected_tenant', value: tenantId!, url: baseURL! },\n { name: 'om_selected_org', value: organizationId!, url: baseURL! },\n { name: 'locale', value: 'pl', url: baseURL! },\n ])\n await page.goto(editor.path)\n const fieldsetSelector = page.getByRole('combobox').filter({ hasText: 'Donation campaign' })\n await fieldsetSelector.click()\n await page.getByRole('option', { name: 'Pakiet us\u0142ug', exact: true }).click()\n await expect(page.getByRole('combobox').filter({ hasText: 'Pakiet us\u0142ug' })).toBeVisible()\n await expect(page.getByText('Termin realizacji', { exact: true })).toBeVisible()\n await expect(page.getByText('Przed p\u0142atno\u015Bci\u0105', { exact: true })).toBeVisible()\n await expect(page.getByText('Co obejmuje us\u0142uga', { exact: true })).toHaveCount(2)\n await expect(page.getByText('Co obejmuje us\u0142uga', { exact: true }).first()).toBeVisible()\n await expect(page.getByText('Co obejmuje us\u0142uga', { exact: true }).last()).toBeVisible()\n\n await testInfo.attach('polish-service-package', {\n body: await page.screenshot({ fullPage: true }),\n contentType: 'image/png',\n })\n\n const literalLabel = `Our delivery promise ${randomUUID()}`\n const deliveryField = serviceFields.find((field) => field.key === 'delivery_timeline')!\n const { key, kind, ...configJson } = deliveryField\n const response = await apiRequest(request, 'POST', '/api/entities/definitions', {\n token,\n headers: { Cookie: `om_selected_tenant=${tenantId}; om_selected_org=${organizationId}` },\n data: { entityId: editor.entityId, key, kind, configJson: { ...configJson, label: literalLabel } },\n })\n expect(response.ok(), 'Set tenant-authored label through the definitions API').toBeTruthy()\n await page.reload()\n await page.getByRole('combobox').filter({ hasText: 'Donation campaign' }).click()\n await page.getByRole('option', { name: 'Pakiet us\u0142ug', exact: true }).click()\n await expect(page.getByText(literalLabel, { exact: true })).toBeVisible()\n await expect(page.getByText('Termin realizacji', { exact: true })).toHaveCount(0)\n await expect(page.getByText('Przed p\u0142atno\u015Bci\u0105', { exact: true })).toBeVisible()\n await expect(page.getByText('Co obejmuje us\u0142uga', { exact: true })).toHaveCount(2)\n await expect(page.getByText('Co obejmuje us\u0142uga', { exact: true }).first()).toBeVisible()\n await expect(page.getByText('Co obejmuje us\u0142uga', { exact: true }).last()).toBeVisible()\n await testInfo.attach('polish-tenant-label', {\n body: await page.screenshot({ fullPage: true }),\n contentType: 'image/png',\n })\n })\n })\n}\n"],
5
+ "mappings": "AAAA,SAAS,kBAAkB;AAC3B,SAAS,QAAQ,YAAY;AAC7B,SAAS,YAAY,oBAAoB;AACzC,SAAS,gCAAgC;AACzC,SAAS,UAAU,oBAAoB;AACvC,SAAS,2BAA2B;AACpC,SAAS,6BAA6B,+BAA+B;AAErE,MAAM,UAAU;AAAA,EACd,EAAE,MAAM,sCAAsC,UAAU,oBAAoB,KAAK;AAAA,EACjF,EAAE,MAAM,sCAAsC,UAAU,oBAAoB,SAAS;AACvF;AACA,MAAM,gBAAgB,4BAA4B,OAAO,CAAC,UAAU,MAAM,aAAa,iBAAiB;AACxG,MAAM,YAAY,CAAC,qBAAqB,iBAAiB,EAAE,IAAI,CAAC,SAC9D,wBAAwB,KAAK,CAAC,aAAa,SAAS,SAAS,IAAI,CAClE;AAED,WAAW,UAAU,SAAS;AAC5B,OAAK,SAAS,0CAA0C,OAAO,IAAI,IAAI,MAAM;AAC3E,QAAI;AACJ,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,6 @@
1
1
  {
2
2
  "name": "@open-mercato/checkout",
3
- "version": "0.10.1-develop.7994.1.c9f31972aa",
3
+ "version": "0.10.1-develop.8022.1.b6753de892",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -62,18 +62,21 @@
62
62
  }
63
63
  },
64
64
  "dependencies": {
65
- "@open-mercato/core": "0.10.1-develop.7994.1.c9f31972aa",
66
- "@open-mercato/ui": "0.10.1-develop.7994.1.c9f31972aa",
65
+ "@open-mercato/core": "0.10.1-develop.8022.1.b6753de892",
66
+ "@open-mercato/ui": "0.10.1-develop.8022.1.b6753de892",
67
67
  "bcryptjs": "^3.0.3"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "@mikro-orm/postgresql": "^7.0.14",
71
- "@open-mercato/shared": "0.10.1-develop.7994.1.c9f31972aa",
71
+ "@open-mercato/ai-assistant": "0.10.1-develop.8022.1.b6753de892",
72
+ "@open-mercato/shared": "0.10.1-develop.8022.1.b6753de892",
72
73
  "react": "^19.0.0",
73
- "react-dom": "^19.0.0"
74
+ "react-dom": "^19.0.0",
75
+ "react-is": ">=18.0.0"
74
76
  },
75
77
  "devDependencies": {
76
- "@open-mercato/shared": "0.10.1-develop.7994.1.c9f31972aa",
78
+ "@open-mercato/ai-assistant": "0.10.1-develop.8022.1.b6753de892",
79
+ "@open-mercato/shared": "0.10.1-develop.8022.1.b6753de892",
77
80
  "@types/jest": "^30.0.0",
78
81
  "@types/react": "^19.2.18",
79
82
  "@types/react-dom": "^19.2.5",
@@ -82,6 +85,7 @@
82
85
  "jest": "^30.4.2",
83
86
  "react": "19.2.8",
84
87
  "react-dom": "19.2.8",
88
+ "react-is": "^19.2.8",
85
89
  "ts-jest": "^29.4.12",
86
90
  "typescript": "7.0.2"
87
91
  },
@@ -0,0 +1,140 @@
1
+ import { randomUUID } from 'node:crypto'
2
+ import { expect, test } from '@playwright/test'
3
+ import { apiRequest, getAuthToken } from '@open-mercato/core/helpers/integration/api'
4
+ import { acknowledgeGlobalNotices } from '@open-mercato/core/helpers/integration/auth'
5
+ import { expectId, readJsonSafe } from '@open-mercato/core/helpers/integration/generalFixtures'
6
+ import { CHECKOUT_ENTITY_IDS } from '../lib/constants'
7
+ import { CHECKOUT_LINK_CUSTOM_FIELDS, CHECKOUT_LINK_FIELDSETS } from '../lib/customFields'
8
+
9
+ const editors = [
10
+ { path: '/backend/checkout/pay-links/create', entityId: CHECKOUT_ENTITY_IDS.link },
11
+ { path: '/backend/checkout/templates/create', entityId: CHECKOUT_ENTITY_IDS.template },
12
+ ]
13
+ const serviceFields = CHECKOUT_LINK_CUSTOM_FIELDS.filter((field) => field.fieldset === 'service_package')
14
+ const fieldsets = ['donation_campaign', 'service_package'].map((code) => (
15
+ CHECKOUT_LINK_FIELDSETS.find((fieldset) => fieldset.code === code)!
16
+ ))
17
+
18
+ for (const editor of editors) {
19
+ test.describe(`TC-CHKT-047: Polish Service package on ${editor.path}`, () => {
20
+ let token: string
21
+ let tenantId: string | null
22
+ let organizationId: string | null
23
+
24
+ test.beforeEach(async ({ request }) => {
25
+ tenantId = null
26
+ organizationId = null
27
+ token = await getAuthToken(request, 'superadmin')
28
+ const marker = `checkout-localization-${randomUUID()}`
29
+ const tenantResponse = await apiRequest(request, 'POST', '/api/directory/tenants', {
30
+ token,
31
+ data: { name: marker },
32
+ })
33
+ expect(tenantResponse.status()).toBe(201)
34
+ tenantId = expectId((await readJsonSafe<{ id?: string }>(tenantResponse))?.id, 'Owned tenant id')
35
+ const organizationResponse = await apiRequest(request, 'POST', '/api/directory/organizations', {
36
+ token,
37
+ data: { tenantId, name: marker },
38
+ })
39
+ expect(organizationResponse.status()).toBe(201)
40
+ organizationId = expectId((await readJsonSafe<{ id?: string }>(organizationResponse))?.id, 'Owned organization id')
41
+ const response = await apiRequest(request, 'POST', '/api/entities/definitions.batch', {
42
+ token,
43
+ headers: { Cookie: `om_selected_tenant=${tenantId}; om_selected_org=${organizationId}` },
44
+ data: {
45
+ entityId: editor.entityId,
46
+ definitions: serviceFields.map(({ key, kind, ...configJson }) => ({ key, kind, configJson })),
47
+ fieldsets,
48
+ singleFieldsetPerRecord: true,
49
+ },
50
+ })
51
+ expect(response.ok(), 'Create owned Service package definitions').toBeTruthy()
52
+ const ownedResponse = await apiRequest(request, 'GET', `/api/entities/definitions.manage?entityId=${editor.entityId}`, {
53
+ token,
54
+ headers: { Cookie: `om_selected_tenant=${tenantId}; om_selected_org=${organizationId}` },
55
+ })
56
+ expect(ownedResponse.ok()).toBeTruthy()
57
+ const owned = await readJsonSafe<{ items: Array<{ key: string; tenantId: string; organizationId: string }> }>(ownedResponse)
58
+ for (const field of serviceFields) {
59
+ expect(owned?.items.find((item) => item.key === field.key)).toMatchObject({ tenantId, organizationId })
60
+ }
61
+ })
62
+
63
+ test.afterEach(async ({ request }) => {
64
+ try {
65
+ if (tenantId && organizationId) {
66
+ const response = await apiRequest(request, 'POST', '/api/entities/definitions.batch', {
67
+ token,
68
+ headers: { Cookie: `om_selected_tenant=${tenantId}; om_selected_org=${organizationId}` },
69
+ data: {
70
+ entityId: editor.entityId,
71
+ definitions: serviceFields.map(({ key, kind }) => ({ key, kind, isActive: false })),
72
+ fieldsets: [],
73
+ },
74
+ })
75
+ expect(response.ok(), 'Remove owned definitions and fieldsets').toBeTruthy()
76
+ }
77
+ } finally {
78
+ try {
79
+ if (organizationId) {
80
+ const response = await apiRequest(request, 'DELETE', `/api/directory/organizations?id=${organizationId}`, { token })
81
+ expect(response.ok(), 'Delete owned organization').toBeTruthy()
82
+ }
83
+ } finally {
84
+ if (tenantId) {
85
+ const response = await apiRequest(request, 'DELETE', `/api/directory/tenants?id=${tenantId}`, { token })
86
+ expect(response.ok(), 'Delete owned tenant').toBeTruthy()
87
+ }
88
+ }
89
+ }
90
+ })
91
+
92
+ test('translates shipped metadata and preserves a tenant-authored label', async ({ page, request, baseURL }, testInfo) => {
93
+ await acknowledgeGlobalNotices(page)
94
+ await page.context().addCookies([
95
+ { name: 'auth_token', value: token, url: baseURL! },
96
+ { name: 'om_selected_tenant', value: tenantId!, url: baseURL! },
97
+ { name: 'om_selected_org', value: organizationId!, url: baseURL! },
98
+ { name: 'locale', value: 'pl', url: baseURL! },
99
+ ])
100
+ await page.goto(editor.path)
101
+ const fieldsetSelector = page.getByRole('combobox').filter({ hasText: 'Donation campaign' })
102
+ await fieldsetSelector.click()
103
+ await page.getByRole('option', { name: 'Pakiet usług', exact: true }).click()
104
+ await expect(page.getByRole('combobox').filter({ hasText: 'Pakiet usług' })).toBeVisible()
105
+ await expect(page.getByText('Termin realizacji', { exact: true })).toBeVisible()
106
+ await expect(page.getByText('Przed płatnością', { exact: true })).toBeVisible()
107
+ await expect(page.getByText('Co obejmuje usługa', { exact: true })).toHaveCount(2)
108
+ await expect(page.getByText('Co obejmuje usługa', { exact: true }).first()).toBeVisible()
109
+ await expect(page.getByText('Co obejmuje usługa', { exact: true }).last()).toBeVisible()
110
+
111
+ await testInfo.attach('polish-service-package', {
112
+ body: await page.screenshot({ fullPage: true }),
113
+ contentType: 'image/png',
114
+ })
115
+
116
+ const literalLabel = `Our delivery promise ${randomUUID()}`
117
+ const deliveryField = serviceFields.find((field) => field.key === 'delivery_timeline')!
118
+ const { key, kind, ...configJson } = deliveryField
119
+ const response = await apiRequest(request, 'POST', '/api/entities/definitions', {
120
+ token,
121
+ headers: { Cookie: `om_selected_tenant=${tenantId}; om_selected_org=${organizationId}` },
122
+ data: { entityId: editor.entityId, key, kind, configJson: { ...configJson, label: literalLabel } },
123
+ })
124
+ expect(response.ok(), 'Set tenant-authored label through the definitions API').toBeTruthy()
125
+ await page.reload()
126
+ await page.getByRole('combobox').filter({ hasText: 'Donation campaign' }).click()
127
+ await page.getByRole('option', { name: 'Pakiet usług', exact: true }).click()
128
+ await expect(page.getByText(literalLabel, { exact: true })).toBeVisible()
129
+ await expect(page.getByText('Termin realizacji', { exact: true })).toHaveCount(0)
130
+ await expect(page.getByText('Przed płatnością', { exact: true })).toBeVisible()
131
+ await expect(page.getByText('Co obejmuje usługa', { exact: true })).toHaveCount(2)
132
+ await expect(page.getByText('Co obejmuje usługa', { exact: true }).first()).toBeVisible()
133
+ await expect(page.getByText('Co obejmuje usługa', { exact: true }).last()).toBeVisible()
134
+ await testInfo.attach('polish-tenant-label', {
135
+ body: await page.screenshot({ fullPage: true }),
136
+ contentType: 'image/png',
137
+ })
138
+ })
139
+ })
140
+ }