@testdino/playwright 1.0.5 → 1.0.6
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/index.d.mts +36 -1
- package/dist/index.d.ts +36 -1
- package/dist/index.js +153 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +153 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -150,15 +150,50 @@ interface RunSkeleton {
|
|
|
150
150
|
totalTests: number;
|
|
151
151
|
suites: SkeletonSuite[];
|
|
152
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Project use options (browser, viewport, etc.)
|
|
155
|
+
* @see docs/PLAYWRIGHT-TYPES-REFERENCE.md
|
|
156
|
+
*/
|
|
157
|
+
interface ProjectUseOptions {
|
|
158
|
+
browserName?: 'chromium' | 'firefox' | 'webkit';
|
|
159
|
+
channel?: string;
|
|
160
|
+
headless?: boolean;
|
|
161
|
+
viewport?: {
|
|
162
|
+
width: number;
|
|
163
|
+
height: number;
|
|
164
|
+
} | null;
|
|
165
|
+
baseURL?: string;
|
|
166
|
+
trace?: 'off' | 'on' | 'retain-on-failure' | 'on-first-retry' | string;
|
|
167
|
+
screenshot?: 'off' | 'on' | 'only-on-failure' | string;
|
|
168
|
+
video?: 'off' | 'on' | 'retain-on-failure' | 'on-first-retry' | string;
|
|
169
|
+
isMobile?: boolean;
|
|
170
|
+
locale?: string;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Project configuration (from FullProject)
|
|
174
|
+
* @see docs/PLAYWRIGHT-TYPES-REFERENCE.md
|
|
175
|
+
*/
|
|
176
|
+
interface ProjectConfig {
|
|
177
|
+
name: string;
|
|
178
|
+
testDir?: string;
|
|
179
|
+
timeout?: number;
|
|
180
|
+
retries?: number;
|
|
181
|
+
repeatEach?: number;
|
|
182
|
+
dependencies?: string[];
|
|
183
|
+
grep?: string[];
|
|
184
|
+
use?: ProjectUseOptions;
|
|
185
|
+
}
|
|
153
186
|
/**
|
|
154
187
|
* Playwright metadata structure
|
|
188
|
+
*
|
|
189
|
+
* @see docs/PLAYWRIGHT-TYPES-REFERENCE.md for field sources and extraction details
|
|
155
190
|
*/
|
|
156
191
|
interface PlaywrightMetadata {
|
|
157
192
|
version?: string;
|
|
158
193
|
parallel?: boolean;
|
|
159
194
|
workers?: number;
|
|
160
195
|
shard?: ShardMetadata;
|
|
161
|
-
projects?:
|
|
196
|
+
projects?: ProjectConfig[];
|
|
162
197
|
browsers?: string[];
|
|
163
198
|
configFile?: string;
|
|
164
199
|
forbidOnly?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -150,15 +150,50 @@ interface RunSkeleton {
|
|
|
150
150
|
totalTests: number;
|
|
151
151
|
suites: SkeletonSuite[];
|
|
152
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Project use options (browser, viewport, etc.)
|
|
155
|
+
* @see docs/PLAYWRIGHT-TYPES-REFERENCE.md
|
|
156
|
+
*/
|
|
157
|
+
interface ProjectUseOptions {
|
|
158
|
+
browserName?: 'chromium' | 'firefox' | 'webkit';
|
|
159
|
+
channel?: string;
|
|
160
|
+
headless?: boolean;
|
|
161
|
+
viewport?: {
|
|
162
|
+
width: number;
|
|
163
|
+
height: number;
|
|
164
|
+
} | null;
|
|
165
|
+
baseURL?: string;
|
|
166
|
+
trace?: 'off' | 'on' | 'retain-on-failure' | 'on-first-retry' | string;
|
|
167
|
+
screenshot?: 'off' | 'on' | 'only-on-failure' | string;
|
|
168
|
+
video?: 'off' | 'on' | 'retain-on-failure' | 'on-first-retry' | string;
|
|
169
|
+
isMobile?: boolean;
|
|
170
|
+
locale?: string;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Project configuration (from FullProject)
|
|
174
|
+
* @see docs/PLAYWRIGHT-TYPES-REFERENCE.md
|
|
175
|
+
*/
|
|
176
|
+
interface ProjectConfig {
|
|
177
|
+
name: string;
|
|
178
|
+
testDir?: string;
|
|
179
|
+
timeout?: number;
|
|
180
|
+
retries?: number;
|
|
181
|
+
repeatEach?: number;
|
|
182
|
+
dependencies?: string[];
|
|
183
|
+
grep?: string[];
|
|
184
|
+
use?: ProjectUseOptions;
|
|
185
|
+
}
|
|
153
186
|
/**
|
|
154
187
|
* Playwright metadata structure
|
|
188
|
+
*
|
|
189
|
+
* @see docs/PLAYWRIGHT-TYPES-REFERENCE.md for field sources and extraction details
|
|
155
190
|
*/
|
|
156
191
|
interface PlaywrightMetadata {
|
|
157
192
|
version?: string;
|
|
158
193
|
parallel?: boolean;
|
|
159
194
|
workers?: number;
|
|
160
195
|
shard?: ShardMetadata;
|
|
161
|
-
projects?:
|
|
196
|
+
projects?: ProjectConfig[];
|
|
162
197
|
browsers?: string[];
|
|
163
198
|
configFile?: string;
|
|
164
199
|
forbidOnly?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -1324,9 +1324,13 @@ var PlaywrightMetadataCollector = class extends BaseMetadataCollector {
|
|
|
1324
1324
|
metadata.workers = config.workers;
|
|
1325
1325
|
}
|
|
1326
1326
|
if (Array.isArray(config.projects) && config.projects.length > 0) {
|
|
1327
|
-
const
|
|
1328
|
-
if (
|
|
1329
|
-
metadata.projects =
|
|
1327
|
+
const projectConfigs = config.projects.filter((project) => this.isNonEmptyString(project.name)).map((project) => this.extractProjectConfig(project));
|
|
1328
|
+
if (projectConfigs.length > 0) {
|
|
1329
|
+
metadata.projects = projectConfigs;
|
|
1330
|
+
const browsers = this.extractBrowsersFromProjects(config.projects);
|
|
1331
|
+
if (browsers.length > 0) {
|
|
1332
|
+
metadata.browsers = browsers;
|
|
1333
|
+
}
|
|
1330
1334
|
}
|
|
1331
1335
|
}
|
|
1332
1336
|
if (config.reportSlowTests && typeof config.reportSlowTests === "object") {
|
|
@@ -1352,6 +1356,151 @@ var PlaywrightMetadataCollector = class extends BaseMetadataCollector {
|
|
|
1352
1356
|
}
|
|
1353
1357
|
return metadata;
|
|
1354
1358
|
}
|
|
1359
|
+
/**
|
|
1360
|
+
* Extract project configuration from FullProject
|
|
1361
|
+
*/
|
|
1362
|
+
extractProjectConfig(project) {
|
|
1363
|
+
const config = {
|
|
1364
|
+
name: project.name || ""
|
|
1365
|
+
};
|
|
1366
|
+
if (this.isNonEmptyString(project.testDir)) {
|
|
1367
|
+
config.testDir = project.testDir;
|
|
1368
|
+
}
|
|
1369
|
+
if (typeof project.timeout === "number") {
|
|
1370
|
+
config.timeout = project.timeout;
|
|
1371
|
+
}
|
|
1372
|
+
if (typeof project.retries === "number") {
|
|
1373
|
+
config.retries = project.retries;
|
|
1374
|
+
}
|
|
1375
|
+
if (typeof project.repeatEach === "number" && project.repeatEach > 1) {
|
|
1376
|
+
config.repeatEach = project.repeatEach;
|
|
1377
|
+
}
|
|
1378
|
+
if (Array.isArray(project.dependencies) && project.dependencies.length > 0) {
|
|
1379
|
+
config.dependencies = project.dependencies;
|
|
1380
|
+
}
|
|
1381
|
+
if (project.grep) {
|
|
1382
|
+
const patterns = Array.isArray(project.grep) ? project.grep : [project.grep];
|
|
1383
|
+
const grepStrings = patterns.map((p) => p.source);
|
|
1384
|
+
if (grepStrings.length > 0) {
|
|
1385
|
+
config.grep = grepStrings;
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
if (project.use) {
|
|
1389
|
+
const useOptions = this.extractUseOptions(project.use);
|
|
1390
|
+
if (Object.keys(useOptions).length > 0) {
|
|
1391
|
+
config.use = useOptions;
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
return config;
|
|
1395
|
+
}
|
|
1396
|
+
/**
|
|
1397
|
+
* Extract use options from project.use
|
|
1398
|
+
*/
|
|
1399
|
+
extractUseOptions(use) {
|
|
1400
|
+
const options = {};
|
|
1401
|
+
if (!use) return options;
|
|
1402
|
+
if (this.isNonEmptyString(use.channel)) {
|
|
1403
|
+
options.channel = use.channel;
|
|
1404
|
+
}
|
|
1405
|
+
const browserName = this.resolveBrowserName(use.browserName, use.defaultBrowserType, use.channel);
|
|
1406
|
+
if (browserName) {
|
|
1407
|
+
options.browserName = browserName;
|
|
1408
|
+
}
|
|
1409
|
+
if (typeof use.headless === "boolean") {
|
|
1410
|
+
options.headless = use.headless;
|
|
1411
|
+
}
|
|
1412
|
+
if (use.viewport && typeof use.viewport === "object") {
|
|
1413
|
+
options.viewport = {
|
|
1414
|
+
width: use.viewport.width,
|
|
1415
|
+
height: use.viewport.height
|
|
1416
|
+
};
|
|
1417
|
+
} else if (use.viewport === null) {
|
|
1418
|
+
options.viewport = null;
|
|
1419
|
+
}
|
|
1420
|
+
if (this.isNonEmptyString(use.baseURL)) {
|
|
1421
|
+
options.baseURL = use.baseURL;
|
|
1422
|
+
}
|
|
1423
|
+
const trace = this.normalizeArtifactMode(use.trace);
|
|
1424
|
+
if (trace) {
|
|
1425
|
+
options.trace = trace;
|
|
1426
|
+
}
|
|
1427
|
+
const screenshot = this.normalizeArtifactMode(use.screenshot);
|
|
1428
|
+
if (screenshot) {
|
|
1429
|
+
options.screenshot = screenshot;
|
|
1430
|
+
}
|
|
1431
|
+
const video = this.normalizeArtifactMode(use.video);
|
|
1432
|
+
if (video) {
|
|
1433
|
+
options.video = video;
|
|
1434
|
+
}
|
|
1435
|
+
if (typeof use.isMobile === "boolean") {
|
|
1436
|
+
options.isMobile = use.isMobile;
|
|
1437
|
+
}
|
|
1438
|
+
if (this.isNonEmptyString(use.locale)) {
|
|
1439
|
+
options.locale = use.locale;
|
|
1440
|
+
}
|
|
1441
|
+
return options;
|
|
1442
|
+
}
|
|
1443
|
+
/**
|
|
1444
|
+
* Normalize artifact mode (trace/screenshot/video can be string or { mode: string })
|
|
1445
|
+
*/
|
|
1446
|
+
normalizeArtifactMode(value) {
|
|
1447
|
+
if (!value) return void 0;
|
|
1448
|
+
if (typeof value === "string" && value !== "off") {
|
|
1449
|
+
return value;
|
|
1450
|
+
}
|
|
1451
|
+
if (typeof value === "object" && value !== null && "mode" in value) {
|
|
1452
|
+
const mode = value.mode;
|
|
1453
|
+
if (mode && mode !== "off") {
|
|
1454
|
+
return mode;
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
return void 0;
|
|
1458
|
+
}
|
|
1459
|
+
/**
|
|
1460
|
+
* Resolve browserName from explicit value, defaultBrowserType (device presets), or channel
|
|
1461
|
+
* Priority: browserName > defaultBrowserType > channel inference
|
|
1462
|
+
*/
|
|
1463
|
+
resolveBrowserName(browserName, defaultBrowserType, channel) {
|
|
1464
|
+
const validBrowsers = ["chromium", "firefox", "webkit"];
|
|
1465
|
+
if (browserName && validBrowsers.includes(browserName)) {
|
|
1466
|
+
return browserName;
|
|
1467
|
+
}
|
|
1468
|
+
if (defaultBrowserType && validBrowsers.includes(defaultBrowserType)) {
|
|
1469
|
+
return defaultBrowserType;
|
|
1470
|
+
}
|
|
1471
|
+
if (channel) {
|
|
1472
|
+
if ([
|
|
1473
|
+
"chrome",
|
|
1474
|
+
"chrome-beta",
|
|
1475
|
+
"chrome-dev",
|
|
1476
|
+
"chrome-canary",
|
|
1477
|
+
"msedge",
|
|
1478
|
+
"msedge-beta",
|
|
1479
|
+
"msedge-dev",
|
|
1480
|
+
"msedge-canary"
|
|
1481
|
+
].includes(channel)) {
|
|
1482
|
+
return "chromium";
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
return void 0;
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* Extract unique browsers from all projects
|
|
1489
|
+
*/
|
|
1490
|
+
extractBrowsersFromProjects(projects) {
|
|
1491
|
+
const browsers = /* @__PURE__ */ new Set();
|
|
1492
|
+
for (const project of projects) {
|
|
1493
|
+
const browserName = this.resolveBrowserName(
|
|
1494
|
+
project.use?.browserName,
|
|
1495
|
+
project.use?.defaultBrowserType,
|
|
1496
|
+
project.use?.channel
|
|
1497
|
+
);
|
|
1498
|
+
if (browserName) {
|
|
1499
|
+
browsers.add(browserName);
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
return Array.from(browsers);
|
|
1503
|
+
}
|
|
1355
1504
|
/**
|
|
1356
1505
|
* Build skeleton from Suite
|
|
1357
1506
|
*/
|
|
@@ -1984,6 +2133,7 @@ var TestdinoReporter = class {
|
|
|
1984
2133
|
`run:begin runId=${this.runId} ciRunId=${this.config.ciRunId ?? "none"} shard=${shardInfo} skeleton=(${skeletonInfo})`
|
|
1985
2134
|
);
|
|
1986
2135
|
}
|
|
2136
|
+
console.log("[TEMP DEBUG] run:begin metadata:", JSON.stringify(metadata, null, 2));
|
|
1987
2137
|
await this.sendEvents([beginEvent]);
|
|
1988
2138
|
this.registerSignalHandlers();
|
|
1989
2139
|
return true;
|