create-allwright 0.1.23 → 0.1.24

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 (3) hide show
  1. package/README.md +15 -3
  2. package/dist/index.js +42 -3
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -15,7 +15,7 @@ npm create allwright@latest
15
15
  The initializer prompts for:
16
16
 
17
17
  - `TypeScript` or `JavaScript`
18
- - one or more surfaces such as `Web`, `Mobile Android`, `Mobile iOS`, and `Desktop macOS`
18
+ - one or more surfaces such as `Web`, `Mobile Android`, `Mobile iOS`, `Desktop macOS`, and `Desktop Windows`
19
19
  - an optional target directory
20
20
 
21
21
  It scaffolds a Node project with `package.json`, Vitest config, shared allwright config, starter tests, and a short README for the generated app.
@@ -33,9 +33,16 @@ non-interactively:
33
33
  npm init allwright@latest macos-tests -- --yes --macos
34
34
  ```
35
35
 
36
- Use `--all` to scaffold Web, Mobile Android, Mobile iOS, and Desktop macOS
36
+ Select Desktop Windows interactively, or scaffold a `windowsApp` project
37
+ non-interactively:
38
+
39
+ ```bash
40
+ npm init allwright@latest windows-tests -- --yes --windows
41
+ ```
42
+
43
+ Use `--all` to scaffold Web, Mobile Android, Mobile iOS, Desktop macOS, and Desktop Windows
37
44
  together. The repeatable `--surface` flag supports the ids `web`,
38
- `mobile-android`, `mobile-ios`, and `desktop-mac` for explicit combinations.
45
+ `mobile-android`, `mobile-ios`, `desktop-mac`, and `desktop-windows` for explicit combinations.
39
46
 
40
47
  This writes an `iosApp` starter test and configures the public universal
41
48
  Simulator IPA at `https://allwright.dev/Flights-simulator.ipa`. On the first
@@ -49,4 +56,9 @@ locally signed copy of the bundled XCUITest runner, and launches Calculator.
49
56
  It requires macOS 14 or newer, Xcode, and UI Automation permission for the
50
57
  process running Xcode.
51
58
 
59
+ The Desktop Windows starter configures Notepad and writes a lazy `windowsApp`
60
+ screenshot test. Its first run installs `desktop-windows` and starts the bundled,
61
+ self-contained FlaUI UIA3 agent. It requires an interactive Windows 10 or newer
62
+ desktop session; no separate Appium, WinAppDriver, or .NET installation is needed.
63
+
52
64
  Dependencies are installed automatically with the package manager that ran the initializer. Existing lockfiles take precedence; use `--package-manager npm|yarn|pnpm|bun` to override detection, or `--no-install` to scaffold without installing.
package/dist/index.js CHANGED
@@ -14,6 +14,7 @@ const SURFACE_OPTIONS = [
14
14
  { label: "Mobile Android", value: "mobile-android" },
15
15
  { label: "Mobile iOS", value: "mobile-ios" },
16
16
  { label: "Desktop macOS", value: "desktop-mac" },
17
+ { label: "Desktop Windows", value: "desktop-windows" },
17
18
  ];
18
19
  async function main() {
19
20
  const options = parseArgs(process.argv.slice(2));
@@ -106,11 +107,16 @@ function parseArgs(args) {
106
107
  case "--mac":
107
108
  options.surfaces.push("desktop-mac");
108
109
  break;
110
+ case "--desktop-windows":
111
+ case "--windows":
112
+ case "--win":
113
+ options.surfaces.push("desktop-windows");
114
+ break;
109
115
  case "--both":
110
116
  options.surfaces.push("web", "mobile-android");
111
117
  break;
112
118
  case "--all":
113
- options.surfaces.push("web", "mobile-android", "mobile-ios", "desktop-mac");
119
+ options.surfaces.push("web", "mobile-android", "mobile-ios", "desktop-mac", "desktop-windows");
114
120
  break;
115
121
  case "--surface": {
116
122
  const value = args[index + 1];
@@ -170,7 +176,9 @@ async function selectSurfaces(interactive) {
170
176
  ? "Android app automation"
171
177
  : surface.value === "mobile-ios"
172
178
  ? "iOS app automation"
173
- : "native macOS app automation",
179
+ : surface.value === "desktop-mac"
180
+ ? "native macOS app automation"
181
+ : "native Windows app automation",
174
182
  })),
175
183
  required: true,
176
184
  });
@@ -246,6 +254,9 @@ function buildProjectFiles(input) {
246
254
  if (hasSurface(surfaces, "desktop-mac")) {
247
255
  files[`tests/macos.spec.${extension}`] = macosSpecContents(language);
248
256
  }
257
+ if (hasSurface(surfaces, "desktop-windows")) {
258
+ files[`tests/windows.spec.${extension}`] = windowsSpecContents(language);
259
+ }
249
260
  return files;
250
261
  }
251
262
  function packageJsonContents(packageName, language) {
@@ -335,13 +346,20 @@ function allwrightConfigContents(surfaces) {
335
346
  lines.push(" id: com.sedinqa.Flights");
336
347
  lines.push(' binary: "https://allwright.dev/Flights-simulator.ipa"');
337
348
  }
338
- if (hasSurface(surfaces, "desktop-mac")) {
349
+ if (hasSurface(surfaces, "desktop-mac") || hasSurface(surfaces, "desktop-windows")) {
339
350
  lines.push("");
340
351
  lines.push("desktop:");
352
+ }
353
+ if (hasSurface(surfaces, "desktop-mac")) {
341
354
  lines.push(" mac:");
342
355
  lines.push(" app:");
343
356
  lines.push(" id: com.apple.calculator");
344
357
  }
358
+ if (hasSurface(surfaces, "desktop-windows")) {
359
+ lines.push(" windows:");
360
+ lines.push(" app:");
361
+ lines.push(" id: notepad.exe");
362
+ }
345
363
  lines.push("");
346
364
  lines.push("expect:");
347
365
  lines.push(" timeoutMs: 7000");
@@ -403,6 +421,18 @@ test("opens Calculator through the macOS desktop agent", { timeout: 90_000 }, as
403
421
  });
404
422
  `;
405
423
  }
424
+ function windowsSpecContents(language) {
425
+ const importLine = language === "ts"
426
+ ? 'import { expect, test } from "@allwright.dev/vitest";'
427
+ : 'import { expect, test } from "@allwright.dev/vitest";';
428
+ return `${importLine}
429
+
430
+ test("opens Notepad through the Windows desktop agent", { timeout: 90_000 }, async ({ windowsApp }) => {
431
+ const screenshot = await windowsApp.screenshot();
432
+ expect(screenshot.byteLength).toBeGreaterThan(0);
433
+ });
434
+ `;
435
+ }
406
436
  function generatedReadmeContents(surfaces) {
407
437
  const nextSteps = [
408
438
  "## Next steps",
@@ -419,6 +449,9 @@ function generatedReadmeContents(surfaces) {
419
449
  if (hasSurface(surfaces, "desktop-mac")) {
420
450
  nextSteps.push(`${step++}. Run the suite on macOS 14 or newer with Xcode installed and UI Automation enabled for the process running Xcode.`, `${step++}. The first macOS run installs the desktop plugin, starts its bundled XCUITest runner, and launches Calculator by bundle identifier.`);
421
451
  }
452
+ if (hasSurface(surfaces, "desktop-windows")) {
453
+ nextSteps.push(`${step++}. Run the suite from an interactive Windows 10 or newer desktop session.`, `${step++}. The first Windows run installs the desktop plugin, starts its bundled FlaUI UIA3 agent, and launches Notepad.`);
454
+ }
422
455
  nextSteps.push(`${step}. Run \`npm test\`.`);
423
456
  return `# allwright project
424
457
 
@@ -457,6 +490,12 @@ function parseSurfaceId(input) {
457
490
  normalized === "mac") {
458
491
  return "desktop-mac";
459
492
  }
493
+ if (normalized === "desktop-windows" ||
494
+ normalized === "desktop-win" ||
495
+ normalized === "windows" ||
496
+ normalized === "win") {
497
+ return "desktop-windows";
498
+ }
460
499
  throw new Error(`Unknown surface: ${input}`);
461
500
  }
462
501
  function parsePackageManager(input) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-allwright",
3
- "version": "0.1.23",
3
+ "version": "0.1.24",
4
4
  "description": "Create a new allwright test project with npm init allwright.",
5
5
  "license": "MIT",
6
6
  "type": "module",