@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.mjs CHANGED
@@ -1317,9 +1317,13 @@ var PlaywrightMetadataCollector = class extends BaseMetadataCollector {
1317
1317
  metadata.workers = config.workers;
1318
1318
  }
1319
1319
  if (Array.isArray(config.projects) && config.projects.length > 0) {
1320
- const projectNames = config.projects.map((project) => project.name).filter((name) => this.isNonEmptyString(name));
1321
- if (projectNames.length > 0) {
1322
- metadata.projects = projectNames;
1320
+ const projectConfigs = config.projects.filter((project) => this.isNonEmptyString(project.name)).map((project) => this.extractProjectConfig(project));
1321
+ if (projectConfigs.length > 0) {
1322
+ metadata.projects = projectConfigs;
1323
+ const browsers = this.extractBrowsersFromProjects(config.projects);
1324
+ if (browsers.length > 0) {
1325
+ metadata.browsers = browsers;
1326
+ }
1323
1327
  }
1324
1328
  }
1325
1329
  if (config.reportSlowTests && typeof config.reportSlowTests === "object") {
@@ -1345,6 +1349,151 @@ var PlaywrightMetadataCollector = class extends BaseMetadataCollector {
1345
1349
  }
1346
1350
  return metadata;
1347
1351
  }
1352
+ /**
1353
+ * Extract project configuration from FullProject
1354
+ */
1355
+ extractProjectConfig(project) {
1356
+ const config = {
1357
+ name: project.name || ""
1358
+ };
1359
+ if (this.isNonEmptyString(project.testDir)) {
1360
+ config.testDir = project.testDir;
1361
+ }
1362
+ if (typeof project.timeout === "number") {
1363
+ config.timeout = project.timeout;
1364
+ }
1365
+ if (typeof project.retries === "number") {
1366
+ config.retries = project.retries;
1367
+ }
1368
+ if (typeof project.repeatEach === "number" && project.repeatEach > 1) {
1369
+ config.repeatEach = project.repeatEach;
1370
+ }
1371
+ if (Array.isArray(project.dependencies) && project.dependencies.length > 0) {
1372
+ config.dependencies = project.dependencies;
1373
+ }
1374
+ if (project.grep) {
1375
+ const patterns = Array.isArray(project.grep) ? project.grep : [project.grep];
1376
+ const grepStrings = patterns.map((p) => p.source);
1377
+ if (grepStrings.length > 0) {
1378
+ config.grep = grepStrings;
1379
+ }
1380
+ }
1381
+ if (project.use) {
1382
+ const useOptions = this.extractUseOptions(project.use);
1383
+ if (Object.keys(useOptions).length > 0) {
1384
+ config.use = useOptions;
1385
+ }
1386
+ }
1387
+ return config;
1388
+ }
1389
+ /**
1390
+ * Extract use options from project.use
1391
+ */
1392
+ extractUseOptions(use) {
1393
+ const options = {};
1394
+ if (!use) return options;
1395
+ if (this.isNonEmptyString(use.channel)) {
1396
+ options.channel = use.channel;
1397
+ }
1398
+ const browserName = this.resolveBrowserName(use.browserName, use.defaultBrowserType, use.channel);
1399
+ if (browserName) {
1400
+ options.browserName = browserName;
1401
+ }
1402
+ if (typeof use.headless === "boolean") {
1403
+ options.headless = use.headless;
1404
+ }
1405
+ if (use.viewport && typeof use.viewport === "object") {
1406
+ options.viewport = {
1407
+ width: use.viewport.width,
1408
+ height: use.viewport.height
1409
+ };
1410
+ } else if (use.viewport === null) {
1411
+ options.viewport = null;
1412
+ }
1413
+ if (this.isNonEmptyString(use.baseURL)) {
1414
+ options.baseURL = use.baseURL;
1415
+ }
1416
+ const trace = this.normalizeArtifactMode(use.trace);
1417
+ if (trace) {
1418
+ options.trace = trace;
1419
+ }
1420
+ const screenshot = this.normalizeArtifactMode(use.screenshot);
1421
+ if (screenshot) {
1422
+ options.screenshot = screenshot;
1423
+ }
1424
+ const video = this.normalizeArtifactMode(use.video);
1425
+ if (video) {
1426
+ options.video = video;
1427
+ }
1428
+ if (typeof use.isMobile === "boolean") {
1429
+ options.isMobile = use.isMobile;
1430
+ }
1431
+ if (this.isNonEmptyString(use.locale)) {
1432
+ options.locale = use.locale;
1433
+ }
1434
+ return options;
1435
+ }
1436
+ /**
1437
+ * Normalize artifact mode (trace/screenshot/video can be string or { mode: string })
1438
+ */
1439
+ normalizeArtifactMode(value) {
1440
+ if (!value) return void 0;
1441
+ if (typeof value === "string" && value !== "off") {
1442
+ return value;
1443
+ }
1444
+ if (typeof value === "object" && value !== null && "mode" in value) {
1445
+ const mode = value.mode;
1446
+ if (mode && mode !== "off") {
1447
+ return mode;
1448
+ }
1449
+ }
1450
+ return void 0;
1451
+ }
1452
+ /**
1453
+ * Resolve browserName from explicit value, defaultBrowserType (device presets), or channel
1454
+ * Priority: browserName > defaultBrowserType > channel inference
1455
+ */
1456
+ resolveBrowserName(browserName, defaultBrowserType, channel) {
1457
+ const validBrowsers = ["chromium", "firefox", "webkit"];
1458
+ if (browserName && validBrowsers.includes(browserName)) {
1459
+ return browserName;
1460
+ }
1461
+ if (defaultBrowserType && validBrowsers.includes(defaultBrowserType)) {
1462
+ return defaultBrowserType;
1463
+ }
1464
+ if (channel) {
1465
+ if ([
1466
+ "chrome",
1467
+ "chrome-beta",
1468
+ "chrome-dev",
1469
+ "chrome-canary",
1470
+ "msedge",
1471
+ "msedge-beta",
1472
+ "msedge-dev",
1473
+ "msedge-canary"
1474
+ ].includes(channel)) {
1475
+ return "chromium";
1476
+ }
1477
+ }
1478
+ return void 0;
1479
+ }
1480
+ /**
1481
+ * Extract unique browsers from all projects
1482
+ */
1483
+ extractBrowsersFromProjects(projects) {
1484
+ const browsers = /* @__PURE__ */ new Set();
1485
+ for (const project of projects) {
1486
+ const browserName = this.resolveBrowserName(
1487
+ project.use?.browserName,
1488
+ project.use?.defaultBrowserType,
1489
+ project.use?.channel
1490
+ );
1491
+ if (browserName) {
1492
+ browsers.add(browserName);
1493
+ }
1494
+ }
1495
+ return Array.from(browsers);
1496
+ }
1348
1497
  /**
1349
1498
  * Build skeleton from Suite
1350
1499
  */
@@ -1977,6 +2126,7 @@ var TestdinoReporter = class {
1977
2126
  `run:begin runId=${this.runId} ciRunId=${this.config.ciRunId ?? "none"} shard=${shardInfo} skeleton=(${skeletonInfo})`
1978
2127
  );
1979
2128
  }
2129
+ console.log("[TEMP DEBUG] run:begin metadata:", JSON.stringify(metadata, null, 2));
1980
2130
  await this.sendEvents([beginEvent]);
1981
2131
  this.registerSignalHandlers();
1982
2132
  return true;