@prostgles/app 2.3.6-dev.1789046358 → 2.3.6-dev.1789048658

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.
Files changed (75) hide show
  1. package/dist/common/constants.d.ts +1 -0
  2. package/dist/common/constants.d.ts.map +1 -0
  3. package/dist/common/constants.js +4 -0
  4. package/dist/common/constants.js.map +1 -0
  5. package/dist/e2e/cli/index.d.ts +18 -0
  6. package/dist/e2e/cli/index.js +70 -0
  7. package/dist/e2e/cli/template.d.ts +13 -0
  8. package/dist/e2e/cli/template.d.ts.map +1 -0
  9. package/dist/e2e/cli/template.js +57 -0
  10. package/dist/e2e/cli/template.js.map +1 -0
  11. package/dist/e2e/shared/Testing.d.ts +665 -0
  12. package/dist/e2e/shared/Testing.js +584 -0
  13. package/dist/e2e/shared/constants.d.ts +19 -0
  14. package/dist/e2e/shared/constants.js +23 -0
  15. package/dist/e2e/shared/fixtures.d.ts +4 -0
  16. package/dist/e2e/shared/fixtures.js +40 -0
  17. package/dist/e2e/shared/goTo.d.ts +2 -0
  18. package/dist/e2e/shared/goTo.js +85 -0
  19. package/dist/e2e/shared/utils/constants.d.ts +19 -0
  20. package/dist/e2e/shared/utils/constants.js +23 -0
  21. package/dist/e2e/shared/utils/goTo.d.ts +2 -0
  22. package/dist/e2e/shared/utils/goTo.js +85 -0
  23. package/dist/e2e/shared/utils/utils.d.ts +144 -0
  24. package/dist/e2e/shared/utils/utils.js +1041 -0
  25. package/dist/e2e/shared/utils.d.ts +144 -0
  26. package/dist/e2e/shared/utils.js +1041 -0
  27. package/dist/e2e/tests/Testing.d.ts +665 -0
  28. package/dist/e2e/tests/Testing.d.ts.map +1 -0
  29. package/dist/e2e/tests/Testing.js +584 -0
  30. package/dist/e2e/tests/Testing.js.map +1 -0
  31. package/dist/e2e/tests/fixtures.d.ts +4 -0
  32. package/dist/e2e/tests/fixtures.d.ts.map +1 -0
  33. package/dist/e2e/tests/fixtures.js +40 -0
  34. package/dist/e2e/tests/fixtures.js.map +1 -0
  35. package/dist/e2e/tests/utils/Testing.d.ts +665 -0
  36. package/dist/e2e/tests/utils/Testing.js +584 -0
  37. package/dist/e2e/tests/utils/constants.d.ts +19 -0
  38. package/dist/e2e/tests/utils/constants.d.ts.map +1 -0
  39. package/dist/e2e/tests/utils/constants.js +23 -0
  40. package/dist/e2e/tests/utils/constants.js.map +1 -0
  41. package/dist/e2e/tests/utils/fixtures.d.ts +4 -0
  42. package/dist/e2e/tests/utils/fixtures.js +40 -0
  43. package/dist/e2e/tests/utils/goTo.d.ts +2 -0
  44. package/dist/e2e/tests/utils/goTo.d.ts.map +1 -0
  45. package/dist/e2e/tests/utils/goTo.js +85 -0
  46. package/dist/e2e/tests/utils/goTo.js.map +1 -0
  47. package/dist/e2e/tests/utils/utils.d.ts +144 -0
  48. package/dist/e2e/tests/utils/utils.d.ts.map +1 -0
  49. package/dist/e2e/tests/utils/utils.js +1041 -0
  50. package/dist/e2e/tests/utils/utils.js.map +1 -0
  51. package/dist/server/package.json +16 -3
  52. package/dist/server/src/cli/cliTemplateFiles.d.ts.map +1 -1
  53. package/dist/server/src/cli/cliTemplateFiles.js +12 -1
  54. package/dist/server/src/cli/cliTemplateFiles.js.map +1 -1
  55. package/dist/server/src/cli/testing/createTestDeployment.d.ts +15 -0
  56. package/dist/server/src/cli/testing/createTestDeployment.d.ts.map +1 -1
  57. package/dist/server/src/cli/testing/createTestDeployment.js +18 -0
  58. package/dist/server/src/cli/testing/createTestDeployment.js.map +1 -1
  59. package/dist/server/src/cli/testing/e2e/index.d.ts +18 -0
  60. package/dist/server/src/cli/testing/e2e/index.d.ts.map +1 -0
  61. package/dist/server/src/cli/testing/e2e/index.js +70 -0
  62. package/dist/server/src/cli/testing/e2e/index.js.map +1 -0
  63. package/dist/server/src/cli/testing/e2e/template.d.ts +13 -0
  64. package/dist/server/src/cli/testing/e2e/template.d.ts.map +1 -0
  65. package/dist/server/src/cli/testing/e2e/template.js +57 -0
  66. package/dist/server/src/cli/testing/e2e/template.js.map +1 -0
  67. package/dist/server/src/cli/testing/ui/index.d.ts +7 -0
  68. package/dist/server/src/cli/testing/ui/index.d.ts.map +1 -0
  69. package/dist/server/src/cli/testing/ui/index.js +67 -0
  70. package/dist/server/src/cli/testing/ui/index.js.map +1 -0
  71. package/dist/server/src/cli/testing/ui/template.d.ts +13 -0
  72. package/dist/server/src/cli/testing/ui/template.d.ts.map +1 -0
  73. package/dist/server/src/cli/testing/ui/template.js +49 -0
  74. package/dist/server/src/cli/testing/ui/template.js.map +1 -0
  75. package/package.json +16 -3
@@ -0,0 +1 @@
1
+ export declare const CLIENT_LOGS_KEY = "__PRGL_DEBUG_LOGS";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../common/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,sBAAsB,CAAC"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CLIENT_LOGS_KEY = void 0;
4
+ exports.CLIENT_LOGS_KEY = "__PRGL_DEBUG_LOGS";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../common/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,mBAAmB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { type CreateTestDeploymentOptions, type TestDeployment } from "@prostgles/app/testing";
2
+ import type { PageWIds } from "../tests/utils/utils";
3
+ export { expect } from "@playwright/test";
4
+ export { openTable, getTableWindow, insertRow, clickInsertRow, fillSmartForm, fillSmartFormAndInsert, setOrAddWorkspace, getDashboardUtils, type PageWIds, type LocatorWIds, } from "../tests/utils/utils";
5
+ /** One isolated app per test; Playwright owns contexts and recording cleanup. */
6
+ export declare const test: import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & {
7
+ clientLogs: void;
8
+ } & {
9
+ deploymentOptions: CreateTestDeploymentOptions;
10
+ userKey: string;
11
+ deployment: TestDeployment;
12
+ app: {
13
+ page: PageWIds;
14
+ open: () => Promise<void>;
15
+ };
16
+ }, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions>;
17
+ /** Paths are relative to the generated app's e2e/playwright.config.ts. */
18
+ export declare const defineE2EConfig: () => import("@playwright/test").PlaywrightTestConfig<{}, {}>;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defineE2EConfig = exports.test = exports.getDashboardUtils = exports.setOrAddWorkspace = exports.fillSmartFormAndInsert = exports.fillSmartForm = exports.clickInsertRow = exports.insertRow = exports.getTableWindow = exports.openTable = exports.expect = void 0;
4
+ const fixtures_1 = require("../tests/utils/fixtures");
5
+ const test_1 = require("@playwright/test");
6
+ const testing_1 = require("@prostgles/app/testing");
7
+ var test_2 = require("@playwright/test");
8
+ Object.defineProperty(exports, "expect", { enumerable: true, get: function () { return test_2.expect; } });
9
+ var utils_1 = require("../tests/utils/utils");
10
+ Object.defineProperty(exports, "openTable", { enumerable: true, get: function () { return utils_1.openTable; } });
11
+ Object.defineProperty(exports, "getTableWindow", { enumerable: true, get: function () { return utils_1.getTableWindow; } });
12
+ Object.defineProperty(exports, "insertRow", { enumerable: true, get: function () { return utils_1.insertRow; } });
13
+ Object.defineProperty(exports, "clickInsertRow", { enumerable: true, get: function () { return utils_1.clickInsertRow; } });
14
+ Object.defineProperty(exports, "fillSmartForm", { enumerable: true, get: function () { return utils_1.fillSmartForm; } });
15
+ Object.defineProperty(exports, "fillSmartFormAndInsert", { enumerable: true, get: function () { return utils_1.fillSmartFormAndInsert; } });
16
+ Object.defineProperty(exports, "setOrAddWorkspace", { enumerable: true, get: function () { return utils_1.setOrAddWorkspace; } });
17
+ Object.defineProperty(exports, "getDashboardUtils", { enumerable: true, get: function () { return utils_1.getDashboardUtils; } });
18
+ /** One isolated app per test; Playwright owns contexts and recording cleanup. */
19
+ exports.test = fixtures_1.test.extend({
20
+ deploymentOptions: [{ configId: "e2e" }, { option: true }],
21
+ userKey: ["admin", { option: true }],
22
+ deployment: [
23
+ async ({ deploymentOptions }, use, testInfo) => {
24
+ const deployment = await (0, testing_1.createTestDeployment)({
25
+ ...deploymentOptions,
26
+ logPath: testInfo.outputPath("deployment.log"),
27
+ });
28
+ try {
29
+ await use(deployment);
30
+ }
31
+ finally {
32
+ await deployment.dispose();
33
+ }
34
+ },
35
+ { timeout: 120_000 },
36
+ ],
37
+ baseURL: async ({ deployment }, use) => await use(deployment.endpoint),
38
+ storageState: async ({ deployment, userKey }, use) => await use(deployment.storageStateAs(userKey)),
39
+ app: async ({ page, deployment }, use) => {
40
+ await use({
41
+ page: page,
42
+ open: async () => {
43
+ await page.goto(deployment.dashboardUrl);
44
+ await page.getByTestId("dashboard.menu").waitFor({ state: "visible" });
45
+ },
46
+ });
47
+ },
48
+ });
49
+ /** Paths are relative to the generated app's e2e/playwright.config.ts. */
50
+ const defineE2EConfig = () => (0, test_1.defineConfig)({
51
+ testDir: "./tests",
52
+ outputDir: "./test-results",
53
+ reporter: [
54
+ ["html", { outputFolder: "./playwright-report", open: "never" }],
55
+ ],
56
+ timeout: 120_000,
57
+ workers: 1,
58
+ fullyParallel: false,
59
+ forbidOnly: !!process.env.CI,
60
+ retries: 0,
61
+ use: {
62
+ ...test_1.devices["Desktop Chrome"],
63
+ testIdAttribute: "data-command",
64
+ video: "on",
65
+ trace: "on",
66
+ screenshot: "only-on-failure",
67
+ actionTimeout: 15_000,
68
+ },
69
+ });
70
+ exports.defineE2EConfig = defineE2EConfig;
@@ -0,0 +1,13 @@
1
+ export declare const getE2ETemplate: (configId: string) => {
2
+ "playwright.config.ts": string;
3
+ "tsconfig.json": string;
4
+ ".gitignore": string;
5
+ "AGENTS.md": string;
6
+ tests: {
7
+ "fixtures.ts": string;
8
+ admin: {
9
+ "dashboard.spec.ts": string;
10
+ };
11
+ };
12
+ };
13
+ //# sourceMappingURL=template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../../e2e/cli/template.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,GAAI,UAAU,MAAM;;;;;;;;;;;CAuD7C,CAAC"}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getE2ETemplate = void 0;
4
+ const getE2ETemplate = (configId) => ({
5
+ "playwright.config.ts": `
6
+ import { defineE2EConfig } from "@prostgles/app/testing/ui";
7
+ export default defineE2EConfig();`,
8
+ "tsconfig.json": JSON.stringify({
9
+ compilerOptions: {
10
+ target: "ES2022",
11
+ module: "Node16",
12
+ moduleResolution: "Node16",
13
+ strict: true,
14
+ esModuleInterop: true,
15
+ skipLibCheck: true,
16
+ noEmit: true,
17
+ },
18
+ include: ["**/*.ts"],
19
+ }, null, 2),
20
+ ".gitignore": "test-results/\nplaywright-report/\n",
21
+ "AGENTS.md": `
22
+ # UI workflow tests
23
+
24
+ - Put business workflows in tests/<role>/*.spec.ts. Import test and expect from ../fixtures and UI helpers from @prostgles/app/testing/ui.
25
+ - Configure seeded users and deterministic data in tests/fixtures.ts using deploymentOptions.users and deploymentOptions.seed. Each test gets a fresh app and database; Docker must be available.
26
+ - Select a seeded user with test.use({ userKey: "member" }). Configure actual app permissions in src/; a user key is only a fixture name, not an authorization role.
27
+ - Start with await app.open(). Reuse openTable(app.page, tableName, true), getTableWindow(app.page, tableName), insertRow(app.page, tableName, values), fillSmartForm, fillSmartFormAndInsert, clickInsertRow and setOrAddWorkspace before adding selectors. These are the same helpers used by Prostgles UI's e2e tests.
28
+ - Assert visible business outcomes and denied actions for each role. Use deployment.connectProjectAs(userKey) when a database assertion helps. Keep app-specific helper functions here beside the workflows.
29
+ - Run npm run test:e2e:install once to install Chromium, then npm run test:e2e. To run a role or workflow: npm run test:e2e -- tests/admin or npm run test:e2e -- -g "workflow name".
30
+ - Videos and traces for every test, including passing tests, are saved in e2e/test-results/. Deployment and PostgreSQL logs are saved alongside them. Artifacts may contain test data and sessions; do not commit them.
31
+ - Run npm run test:e2e:report and select a test to play its video or inspect its trace. The HTML report is in e2e/playwright-report/. Results are replaced on the next run; copy them elsewhere inside the project if they must be kept.
32
+ `,
33
+ tests: {
34
+ "fixtures.ts": `
35
+ import { test as base } from "@prostgles/app/testing/ui";
36
+ export { expect } from "@prostgles/app/testing/ui";
37
+ export const test = base.extend({
38
+ deploymentOptions: {
39
+ configId: ${JSON.stringify(configId)},
40
+ users: [{ key: "admin", type: "admin" }, { key: "member", type: "default" }],
41
+ // seed: async ({ projectDatabase, stateDatabase }) => { ... },
42
+ },
43
+ });`,
44
+ admin: {
45
+ "dashboard.spec.ts": `
46
+ import { test, expect } from "../fixtures";
47
+ test.use({ userKey: "admin" });
48
+ test("admin opens the configured app", async ({ app }) => {
49
+ await app.open();
50
+ await expect(app.page.getByTestId("dashboard.menu")).toBeVisible();
51
+ // Add business workflows using openTable, insertRow and getTableWindow.
52
+ });`,
53
+ },
54
+ },
55
+ });
56
+ exports.getE2ETemplate = getE2ETemplate;
57
+ //# sourceMappingURL=template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../e2e/cli/template.ts"],"names":[],"mappings":";;;AAAO,MAAM,cAAc,GAAG,CAAC,QAAgB,EAAE,EAAE,CAAC,CAAC;IACnD,sBAAsB,EAAE;;sCAEY;IACpC,eAAe,EAAE,IAAI,CAAC,SAAS,CAC7B;QACE,eAAe,EAAE;YACf,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE,QAAQ;YAChB,gBAAgB,EAAE,QAAQ;YAC1B,MAAM,EAAE,IAAI;YACZ,eAAe,EAAE,IAAI;YACrB,YAAY,EAAE,IAAI;YAClB,MAAM,EAAE,IAAI;SACb;QACD,OAAO,EAAE,CAAC,SAAS,CAAC;KACrB,EACD,IAAI,EACJ,CAAC,CACF;IACD,YAAY,EAAE,qCAAqC;IACnD,WAAW,EAAE;;;;;;;;;;;GAWZ;IACD,KAAK,EAAE;QACL,aAAa,EAAE;;;;;sBAKG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;;;;UAIpC;QACN,KAAK,EAAE;YACL,mBAAmB,EAAE;;;;;;;YAOf;SACP;KACF;CACF,CAAC,CAAC;AAvDU,QAAA,cAAc,kBAuDxB"}