simple-playwright-framework 0.0.16 → 0.0.17
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/fixtures/data.fixture.js +1 -1
- package/dist/fixtures/index.d.ts +1 -0
- package/dist/fixtures/index.js +12 -2
- package/dist/fixtures/projectConfig.fixture.d.ts +6 -0
- package/dist/fixtures/projectConfig.fixture.js +10 -0
- package/dist/loaders/projectConfig.loader.d.ts +9 -0
- package/dist/loaders/projectConfig.loader.js +41 -0
- package/dist/types/env.d.ts +1 -0
- package/package.json +1 -1
|
@@ -10,7 +10,7 @@ exports.dataFixture = {
|
|
|
10
10
|
let td;
|
|
11
11
|
try {
|
|
12
12
|
td = (0, data_loader_1.loadTestData)(testInfo, envName);
|
|
13
|
-
console.log("Loaded test data:", td, "Type:", Array.isArray(td) ? "array" : typeof td);
|
|
13
|
+
//console.log("Loaded test data:", td, "Type:", Array.isArray(td) ? "array" : typeof td);
|
|
14
14
|
}
|
|
15
15
|
catch (err) {
|
|
16
16
|
console.error(`❌ loadTestData threw for env '${envName}':`, err);
|
package/dist/fixtures/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Page } from "@playwright/test";
|
|
2
2
|
import { Fixtures } from "../types/fixtures";
|
|
3
3
|
export declare const test: import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & Fixtures & {
|
|
4
|
+
pc: Record<string, any>;
|
|
4
5
|
authStore: (page: Page, creds: {
|
|
5
6
|
username: string;
|
|
6
7
|
password: string;
|
package/dist/fixtures/index.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// ════════════════════════════════════════════════════════════════
|
|
3
|
+
// framework/src/fixtures/index.ts
|
|
4
|
+
//
|
|
5
|
+
// MODIFIED — added projectConfigFixture alongside existing fixtures.
|
|
6
|
+
// Only this block is new:
|
|
7
|
+
// ...projectConfigFixture,
|
|
8
|
+
// Everything else is unchanged from your original file.
|
|
9
|
+
// ════════════════════════════════════════════════════════════════
|
|
2
10
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
11
|
if (k2 === undefined) k2 = k;
|
|
4
12
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -19,13 +27,15 @@ const test_1 = require("@playwright/test");
|
|
|
19
27
|
const envConfig_fixture_1 = require("./envConfig.fixture");
|
|
20
28
|
const data_fixture_1 = require("./data.fixture");
|
|
21
29
|
const testrail_fixture_1 = require("./testrail.fixture");
|
|
22
|
-
const initAuthSession_1 = require("../utils/auth-session/initAuthSession");
|
|
23
30
|
const file_fixture_1 = require("./file.fixture");
|
|
31
|
+
const projectConfig_fixture_1 = require("./projectConfig.fixture"); // ← NEW
|
|
32
|
+
const initAuthSession_1 = require("../utils/auth-session/initAuthSession");
|
|
24
33
|
exports.test = test_1.test.extend({
|
|
25
34
|
...envConfig_fixture_1.envConfigFixture,
|
|
26
35
|
...data_fixture_1.dataFixture,
|
|
27
36
|
...testrail_fixture_1.testrailFixture,
|
|
28
37
|
...file_fixture_1.fileFixture,
|
|
38
|
+
...projectConfig_fixture_1.projectConfigFixture, // ← NEW
|
|
29
39
|
authStore: async ({ envConfig }, use) => {
|
|
30
40
|
await use(async (page, creds, providerRegistry) => {
|
|
31
41
|
if (!envConfig.authStorage) {
|
|
@@ -37,4 +47,4 @@ exports.test = test_1.test.extend({
|
|
|
37
47
|
});
|
|
38
48
|
var test_2 = require("@playwright/test");
|
|
39
49
|
Object.defineProperty(exports, "expect", { enumerable: true, get: function () { return test_2.expect; } });
|
|
40
|
-
__exportStar(require("../loaders/scenario.loader"), exports); //
|
|
50
|
+
__exportStar(require("../loaders/scenario.loader"), exports); // ← NEW
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.projectConfigFixture = void 0;
|
|
4
|
+
const projectConfig_loader_1 = require("../loaders/projectConfig.loader");
|
|
5
|
+
exports.projectConfigFixture = {
|
|
6
|
+
pc: async ({ page }, use) => {
|
|
7
|
+
const config = (0, projectConfig_loader_1.loadProjectConfig)();
|
|
8
|
+
await use(config);
|
|
9
|
+
},
|
|
10
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loads and returns the contents of config/projectConfig.json
|
|
3
|
+
* as a plain object. The shape is defined by each project —
|
|
4
|
+
* the framework imposes no type constraints here.
|
|
5
|
+
*
|
|
6
|
+
* @returns Plain object from projectConfig.json
|
|
7
|
+
* @throws If the file is missing or contains invalid JSON
|
|
8
|
+
*/
|
|
9
|
+
export declare function loadProjectConfig(): Record<string, any>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ════════════════════════════════════════════════════════════════
|
|
3
|
+
// framework/src/loaders/projectConfig.loader.ts
|
|
4
|
+
//
|
|
5
|
+
// Loads projectConfig.json from the consuming project's
|
|
6
|
+
// config/ directory. Follows the exact same pattern as
|
|
7
|
+
// envConfig.loader.ts — flat JSON, no env nesting.
|
|
8
|
+
//
|
|
9
|
+
// projectConfig.json is for project-wide constants that are
|
|
10
|
+
// not environment-specific (threshold, schema paths, etc).
|
|
11
|
+
// Anything env-specific belongs in environments.json instead.
|
|
12
|
+
// ════════════════════════════════════════════════════════════════
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.loadProjectConfig = loadProjectConfig;
|
|
18
|
+
const fs_1 = __importDefault(require("fs"));
|
|
19
|
+
const path_1 = __importDefault(require("path"));
|
|
20
|
+
/**
|
|
21
|
+
* Loads and returns the contents of config/projectConfig.json
|
|
22
|
+
* as a plain object. The shape is defined by each project —
|
|
23
|
+
* the framework imposes no type constraints here.
|
|
24
|
+
*
|
|
25
|
+
* @returns Plain object from projectConfig.json
|
|
26
|
+
* @throws If the file is missing or contains invalid JSON
|
|
27
|
+
*/
|
|
28
|
+
function loadProjectConfig() {
|
|
29
|
+
const configPath = path_1.default.join(process.cwd(), "config", "projectConfig.json");
|
|
30
|
+
if (!fs_1.default.existsSync(configPath)) {
|
|
31
|
+
throw new Error(`❌ projectConfig.json not found at ${configPath}\n` +
|
|
32
|
+
` Create config/projectConfig.json in your project root.`);
|
|
33
|
+
}
|
|
34
|
+
const raw = fs_1.default.readFileSync(configPath, "utf-8");
|
|
35
|
+
try {
|
|
36
|
+
return JSON.parse(raw);
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
throw new Error(`❌ projectConfig.json contains invalid JSON at ${configPath}\n${e}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
package/dist/types/env.d.ts
CHANGED
package/package.json
CHANGED