@testspectra/react 1.1.14 → 1.2.0

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/cli.js CHANGED
@@ -71,6 +71,7 @@ export default defineConfig({
71
71
  plugins: [react()],
72
72
  define: {
73
73
  __TESTSPECTRA_AUTO_IMPORT_MANIFEST__: ${JSON.stringify(JSON.stringify(manifest))},
74
+ __TESTSPECTRA_PLUGINS__: ${JSON.stringify(JSON.stringify(opts.plugins ?? []))},
74
75
  __TESTSPECTRA_STEP_DELAY_MS__: ${JSON.stringify(opts.stepDelayMs)},
75
76
  __TESTSPECTRA_SEMANTIC_REPORTER__: ${JSON.stringify(opts.semanticReporter)},
76
77
  },
@@ -162,7 +163,8 @@ async function runComponentTests(options = {}) {
162
163
  semanticReporter,
163
164
  fileParallelism: options.concurrency !== 1,
164
165
  browserExecutable: options.browserExecutablePath,
165
- outputFile: options.outputFile
166
+ outputFile: options.outputFile,
167
+ plugins: options.plugins
166
168
  });
167
169
  const args = ["run", "--config", configPath];
168
170
  if (options.spec) {
package/dist/index.d.ts CHANGED
@@ -15,6 +15,7 @@ export interface RunComponentTestsOptions {
15
15
  outputFile?: string;
16
16
  concurrency?: number;
17
17
  browserExecutablePath?: string;
18
+ plugins?: string[];
18
19
  onLine?: (line: string) => void;
19
20
  }
20
21
 
@@ -28,6 +29,7 @@ export interface BundleServerOptions {
28
29
  packageDir?: string;
29
30
  manifest?: any;
30
31
  stepDelayMs?: number;
32
+ plugins?: string[];
31
33
  }
32
34
 
33
35
  export declare function startBundleServer(opts?: BundleServerOptions): Promise<BundleServer>;
package/dist/index.js CHANGED
@@ -588,6 +588,15 @@ var DomDriverBridge = class {
588
588
  });
589
589
  if (!ok) throw new Error("Element not found: " + JSON.stringify(selector));
590
590
  }
591
+ async blur(selector, index = null) {
592
+ const ok = await globalThis.__TS_RUNTIME__.pollCondition(async () => {
593
+ const el = resolveEl(selector, index);
594
+ if (!el) return false;
595
+ el.blur?.();
596
+ return true;
597
+ });
598
+ if (!ok) throw new Error("Element not found: " + JSON.stringify(selector));
599
+ }
591
600
  async dragDrop(sourceSelector, targetSelector, sourceIndex = null) {
592
601
  const src = resolveEl(sourceSelector, sourceIndex);
593
602
  const dest = resolveEl(targetSelector, null);
@@ -896,6 +905,7 @@ export default defineConfig({
896
905
  plugins: [react()],
897
906
  define: {
898
907
  __TESTSPECTRA_AUTO_IMPORT_MANIFEST__: ${JSON.stringify(JSON.stringify(manifest))},
908
+ __TESTSPECTRA_PLUGINS__: ${JSON.stringify(JSON.stringify(opts.plugins ?? []))},
899
909
  __TESTSPECTRA_STEP_DELAY_MS__: ${JSON.stringify(opts.stepDelayMs)},
900
910
  __TESTSPECTRA_SEMANTIC_REPORTER__: ${JSON.stringify(opts.semanticReporter)},
901
911
  },
@@ -987,7 +997,8 @@ async function runComponentTests(options = {}) {
987
997
  semanticReporter,
988
998
  fileParallelism: options.concurrency !== 1,
989
999
  browserExecutable: options.browserExecutablePath,
990
- outputFile: options.outputFile
1000
+ outputFile: options.outputFile,
1001
+ plugins: options.plugins
991
1002
  });
992
1003
  const args = ["run", "--config", configPath];
993
1004
  if (options.spec) {
@@ -1319,8 +1330,9 @@ ${exportLines.join("\n")}
1319
1330
  export default _react;
1320
1331
  `;
1321
1332
  }
1322
- function buildHarnessHtml(manifest, stepDelayMs) {
1333
+ function buildHarnessHtml(manifest, stepDelayMs, plugins = []) {
1323
1334
  const manifestJson = JSON.stringify(manifest);
1335
+ const pluginsJson = JSON.stringify(plugins);
1324
1336
  return `<!DOCTYPE html>
1325
1337
  <html>
1326
1338
  <head>
@@ -1342,6 +1354,7 @@ function buildHarnessHtml(manifest, stepDelayMs) {
1342
1354
  <body>
1343
1355
  <script type="module">
1344
1356
  window.__TESTSPECTRA_AUTO_IMPORT_MANIFEST__ = ${manifestJson};
1357
+ window.__TESTSPECTRA_PLUGINS__ = ${pluginsJson};
1345
1358
  window.__TESTSPECTRA_STEP_DELAY_MS__ = ${JSON.stringify(stepDelayMs)};
1346
1359
  window.__TESTSPECTRA_SEMANTIC_REPORTER__ = true;
1347
1360
  try {
@@ -1505,7 +1518,7 @@ async function startBundleServer(opts = {}) {
1505
1518
  getCachedBundle("runner", runnerEntrypoint).catch(() => {
1506
1519
  });
1507
1520
  }
1508
- const harnessHtml = buildHarnessHtml(manifest, stepDelayMs);
1521
+ const harnessHtml = buildHarnessHtml(manifest, stepDelayMs, opts.plugins ?? []);
1509
1522
  const handler = makeHandler(testRoot, packageDir, harnessHtml, setupEntrypoint, runnerEntrypoint);
1510
1523
  const server = http.createServer(handler);
1511
1524
  await new Promise((resolve, reject) => {