@open-mercato/core 0.4.9-develop-e55592929f → 0.4.9-develop-ce96cffe00
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.
- package/dist/helpers/integration/api.js +66 -0
- package/dist/helpers/integration/api.js.map +7 -0
- package/dist/helpers/integration/apiKeysFixtures.js +16 -0
- package/dist/helpers/integration/apiKeysFixtures.js.map +7 -0
- package/dist/helpers/integration/attachmentsFixtures.js +61 -0
- package/dist/helpers/integration/attachmentsFixtures.js.map +7 -0
- package/dist/helpers/integration/auth.js +190 -0
- package/dist/helpers/integration/auth.js.map +7 -0
- package/dist/helpers/integration/authFixtures.js +39 -0
- package/dist/helpers/integration/authFixtures.js.map +7 -0
- package/dist/helpers/integration/authUi.js +31 -0
- package/dist/helpers/integration/authUi.js.map +7 -0
- package/dist/helpers/integration/businessRulesFixtures.js +40 -0
- package/dist/helpers/integration/businessRulesFixtures.js.map +7 -0
- package/dist/helpers/integration/catalogFixtures.js +49 -0
- package/dist/helpers/integration/catalogFixtures.js.map +7 -0
- package/dist/helpers/integration/crmFixtures.js +91 -0
- package/dist/helpers/integration/crmFixtures.js.map +7 -0
- package/dist/helpers/integration/currenciesFixtures.js +39 -0
- package/dist/helpers/integration/currenciesFixtures.js.map +7 -0
- package/dist/helpers/integration/dictionariesFixtures.js +16 -0
- package/dist/helpers/integration/dictionariesFixtures.js.map +7 -0
- package/dist/helpers/integration/featureTogglesFixtures.js +23 -0
- package/dist/helpers/integration/featureTogglesFixtures.js.map +7 -0
- package/dist/helpers/integration/generalFixtures.js +56 -0
- package/dist/helpers/integration/generalFixtures.js.map +7 -0
- package/dist/helpers/integration/inboxFixtures.js +67 -0
- package/dist/helpers/integration/inboxFixtures.js.map +7 -0
- package/dist/helpers/integration/notificationsFixtures.js +48 -0
- package/dist/helpers/integration/notificationsFixtures.js.map +7 -0
- package/dist/helpers/integration/salesFixtures.js +63 -0
- package/dist/helpers/integration/salesFixtures.js.map +7 -0
- package/dist/helpers/integration/salesUi.js +827 -0
- package/dist/helpers/integration/salesUi.js.map +7 -0
- package/dist/helpers/integration/sseEventCollector.js +27 -0
- package/dist/helpers/integration/sseEventCollector.js.map +7 -0
- package/dist/helpers/integration/staffFixtures.js +47 -0
- package/dist/helpers/integration/staffFixtures.js.map +7 -0
- package/dist/testing/integration/api.js +2 -0
- package/dist/testing/integration/api.js.map +7 -0
- package/dist/testing/integration/auth.js +2 -0
- package/dist/testing/integration/auth.js.map +7 -0
- package/dist/testing/integration/authFixtures.js +2 -0
- package/dist/testing/integration/authFixtures.js.map +7 -0
- package/dist/testing/integration/authUi.js +2 -0
- package/dist/testing/integration/authUi.js.map +7 -0
- package/dist/testing/integration/crmFixtures.js +2 -0
- package/dist/testing/integration/crmFixtures.js.map +7 -0
- package/dist/testing/integration/dictionariesFixtures.js +2 -0
- package/dist/testing/integration/dictionariesFixtures.js.map +7 -0
- package/dist/testing/integration/generalFixtures.js +2 -0
- package/dist/testing/integration/generalFixtures.js.map +7 -0
- package/dist/testing/integration/index.js +48 -0
- package/dist/testing/integration/index.js.map +7 -0
- package/package.json +11 -3
- package/src/helpers/integration/api.ts +87 -0
- package/src/helpers/integration/apiKeysFixtures.ts +17 -0
- package/src/helpers/integration/attachmentsFixtures.ts +114 -0
- package/src/helpers/integration/auth.ts +208 -0
- package/src/helpers/integration/authFixtures.ts +52 -0
- package/src/helpers/integration/authUi.ts +33 -0
- package/src/helpers/integration/businessRulesFixtures.ts +53 -0
- package/src/helpers/integration/catalogFixtures.ts +73 -0
- package/src/helpers/integration/crmFixtures.ts +132 -0
- package/src/helpers/integration/currenciesFixtures.ts +49 -0
- package/src/helpers/integration/dictionariesFixtures.ts +17 -0
- package/src/helpers/integration/featureTogglesFixtures.ts +28 -0
- package/src/helpers/integration/generalFixtures.ts +71 -0
- package/src/helpers/integration/inboxFixtures.ts +94 -0
- package/src/helpers/integration/notificationsFixtures.ts +67 -0
- package/src/helpers/integration/salesFixtures.ts +89 -0
- package/src/helpers/integration/salesUi.ts +936 -0
- package/src/helpers/integration/sseEventCollector.ts +30 -0
- package/src/helpers/integration/staffFixtures.ts +61 -0
- package/src/testing/integration/api.ts +1 -0
- package/src/testing/integration/auth.ts +1 -0
- package/src/testing/integration/authFixtures.ts +1 -0
- package/src/testing/integration/authUi.ts +1 -0
- package/src/testing/integration/crmFixtures.ts +1 -0
- package/src/testing/integration/dictionariesFixtures.ts +1 -0
- package/src/testing/integration/generalFixtures.ts +1 -0
- package/src/testing/integration/index.ts +22 -0
- package/tsconfig.json +3 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Page } from '@playwright/test'
|
|
2
|
+
|
|
3
|
+
const OM_EVENT_NAME = 'om:event'
|
|
4
|
+
const CAPTURED_EVENTS_KEY = '__capturedOmEvents'
|
|
5
|
+
|
|
6
|
+
export type CapturedEvent = {
|
|
7
|
+
id: string
|
|
8
|
+
payload?: Record<string, unknown>
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export async function installOmEventCollector(page: Page): Promise<void> {
|
|
12
|
+
await page.evaluate(({ eventName, storageKey }) => {
|
|
13
|
+
;(window as unknown as Record<string, unknown>)[storageKey] = []
|
|
14
|
+
window.addEventListener(eventName, (event: Event) => {
|
|
15
|
+
const detail = (event as CustomEvent<CapturedEvent>).detail
|
|
16
|
+
if (!detail || typeof detail !== 'object') return
|
|
17
|
+
const store = (window as unknown as Record<string, unknown>)[storageKey]
|
|
18
|
+
if (!Array.isArray(store)) return
|
|
19
|
+
store.push(detail)
|
|
20
|
+
})
|
|
21
|
+
}, { eventName: OM_EVENT_NAME, storageKey: CAPTURED_EVENTS_KEY })
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export async function getCapturedOmEvents(page: Page): Promise<CapturedEvent[]> {
|
|
25
|
+
return page.evaluate((storageKey) => {
|
|
26
|
+
const store = (window as unknown as Record<string, unknown>)[storageKey]
|
|
27
|
+
if (!Array.isArray(store)) return []
|
|
28
|
+
return store as CapturedEvent[]
|
|
29
|
+
}, CAPTURED_EVENTS_KEY)
|
|
30
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { expect, type APIRequestContext } from '@playwright/test';
|
|
2
|
+
import { apiRequest } from './api';
|
|
3
|
+
|
|
4
|
+
export async function createStaffTeamFixture(
|
|
5
|
+
request: APIRequestContext,
|
|
6
|
+
token: string,
|
|
7
|
+
name?: string,
|
|
8
|
+
): Promise<string> {
|
|
9
|
+
const response = await apiRequest(request, 'POST', '/api/staff/teams', {
|
|
10
|
+
token,
|
|
11
|
+
data: { name: name ?? `QA Team ${Date.now()}` },
|
|
12
|
+
});
|
|
13
|
+
expect(response.ok(), `Failed to create staff team fixture: ${response.status()}`).toBeTruthy();
|
|
14
|
+
const body = (await response.json()) as { id?: string };
|
|
15
|
+
expect(typeof body.id === 'string' && body.id.length > 0).toBeTruthy();
|
|
16
|
+
return body.id as string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export async function createStaffTeamMemberFixture(
|
|
20
|
+
request: APIRequestContext,
|
|
21
|
+
token: string,
|
|
22
|
+
input?: { displayName?: string },
|
|
23
|
+
): Promise<string> {
|
|
24
|
+
const response = await apiRequest(request, 'POST', '/api/staff/team-members', {
|
|
25
|
+
token,
|
|
26
|
+
data: { displayName: input?.displayName ?? `QA Member ${Date.now()}` },
|
|
27
|
+
});
|
|
28
|
+
expect(response.ok(), `Failed to create staff team member fixture: ${response.status()}`).toBeTruthy();
|
|
29
|
+
const body = (await response.json()) as { id?: string };
|
|
30
|
+
expect(typeof body.id === 'string' && body.id.length > 0).toBeTruthy();
|
|
31
|
+
return body.id as string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export async function createStaffTeamRoleFixture(
|
|
35
|
+
request: APIRequestContext,
|
|
36
|
+
token: string,
|
|
37
|
+
input?: { name?: string },
|
|
38
|
+
): Promise<string> {
|
|
39
|
+
const response = await apiRequest(request, 'POST', '/api/staff/team-roles', {
|
|
40
|
+
token,
|
|
41
|
+
data: { name: input?.name ?? `QA Role ${Date.now()}` },
|
|
42
|
+
});
|
|
43
|
+
expect(response.ok(), `Failed to create staff team role fixture: ${response.status()}`).toBeTruthy();
|
|
44
|
+
const body = (await response.json()) as { id?: string };
|
|
45
|
+
expect(typeof body.id === 'string' && body.id.length > 0).toBeTruthy();
|
|
46
|
+
return body.id as string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export async function deleteStaffEntityIfExists(
|
|
50
|
+
request: APIRequestContext,
|
|
51
|
+
token: string | null,
|
|
52
|
+
path: string,
|
|
53
|
+
id: string | null,
|
|
54
|
+
): Promise<void> {
|
|
55
|
+
if (!token || !id) return;
|
|
56
|
+
try {
|
|
57
|
+
await apiRequest(request, 'DELETE', `${path}?id=${encodeURIComponent(id)}`, { token });
|
|
58
|
+
} catch {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../helpers/integration/api'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../helpers/integration/auth'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../helpers/integration/authFixtures'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../helpers/integration/authUi'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../helpers/integration/crmFixtures'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../helpers/integration/dictionariesFixtures'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../helpers/integration/generalFixtures'
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { getAuthToken, apiRequest, postForm } from '../../helpers/integration/api'
|
|
2
|
+
export { DEFAULT_CREDENTIALS, type Role } from '../../helpers/integration/auth'
|
|
3
|
+
export { createUserViaUi } from '../../helpers/integration/authUi'
|
|
4
|
+
export {
|
|
5
|
+
createCompanyFixture,
|
|
6
|
+
createPersonFixture,
|
|
7
|
+
createDealFixture,
|
|
8
|
+
createPipelineFixture,
|
|
9
|
+
createPipelineStageFixture,
|
|
10
|
+
deleteEntityByBody,
|
|
11
|
+
deleteEntityIfExists,
|
|
12
|
+
} from '../../helpers/integration/crmFixtures'
|
|
13
|
+
export {
|
|
14
|
+
readJsonSafe,
|
|
15
|
+
getTokenContext,
|
|
16
|
+
getTokenScope,
|
|
17
|
+
expectId,
|
|
18
|
+
deleteEntityByPathIfExists,
|
|
19
|
+
deleteGeneralEntityIfExists,
|
|
20
|
+
} from '../../helpers/integration/generalFixtures'
|
|
21
|
+
export { createDictionaryFixture } from '../../helpers/integration/dictionariesFixtures'
|
|
22
|
+
export { createRoleFixture, deleteRoleIfExists, createUserFixture, deleteUserIfExists } from '../../helpers/integration/authFixtures'
|