agent-qa 0.1.11 → 0.1.13

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.cjs CHANGED
@@ -597,6 +597,7 @@ function buildTargets(platform) {
597
597
  if (selection.capabilities.includes("web")) {
598
598
  targets["example-web"] = { platform: "web", url: "https://example.com" };
599
599
  targets["automation-exercise"] = { platform: "web", url: "https://automationexercise.com" };
600
+ targets["wai-bad"] = { platform: "web", url: "https://www.w3.org/WAI/demos/bad/before/home.html" };
600
601
  }
601
602
  if (selection.mobileRuntimes.includes("android")) {
602
603
  targets["example-android"] = { platform: "android" };
@@ -650,6 +651,7 @@ var AUTOMATION_EXERCISE_TESTS = [
650
651
  ];
651
652
  var HN_TOP_STORY_HOOK_ID = "h_aster-bloom-cloud-drift-ember-field-glade-hollow-ivory-jasper";
652
653
  var HN_TOP_STORY_TEST_ID = "t_quad-adar-micro-magic-cross-cue-open-agog-rang-cours";
654
+ var BAD_A11Y_TEST_ID = "t_ponent-toa-base-fred-click-sigma-lad-agen-report-sticky";
653
655
  function buildAutomationExerciseTest(test) {
654
656
  return `test-id: ${test.id}
655
657
  name: ${test.name}
@@ -730,6 +732,15 @@ steps:
730
732
  - Verify the page shows "{{env:HN_FIRST_STORY_TITLE}}"
731
733
  `;
732
734
  }
735
+ function buildBadA11yTest() {
736
+ return `test-id: ${BAD_A11Y_TEST_ID}
737
+ name: W3C BAD accessibility smoke
738
+ target: wai-bad
739
+ steps:
740
+ - Verify the page says "Welcome to CityLights"
741
+ - Verify the page says "Inaccessible Home Page"
742
+ `;
743
+ }
733
744
  function isSubscriptionProvider(provider) {
734
745
  return provider === "openai-subscription" || provider === "anthropic-subscription";
735
746
  }
@@ -841,6 +852,14 @@ function buildDefaultConfig(platform, providerOrLLMs, model, baseURL) {
841
852
  dashboard: { port: 3100, artifactsDir: ".agent-qa/artifacts" },
842
853
  mcp: { enabled: true, transport: "http", host: "127.0.0.1", port: 3471, path: "/mcp" },
843
854
  cache: { dir: INIT_CACHE_DIR, ttl: "7d" },
855
+ ...hasWeb(platform) ? {
856
+ accessibility: {
857
+ enabled: true,
858
+ standard: "wcag2aa",
859
+ runAfter: "every-step",
860
+ failOnViolation: false
861
+ }
862
+ } : {},
844
863
  recording: { enabled: true },
845
864
  memory: { enabled: true, provider: "local", dir: "agent-qa-memory" },
846
865
  logging: { level: "warn" }
@@ -891,10 +910,14 @@ function addYamlComments(yamlStr) {
891
910
  result += " # Optional: persist dashboard state to a custom SQLite path.\n";
892
911
  result += " # dbPath: .agent-qa/dashboard.sqlite\n";
893
912
  } else if (line === " ttl: 7d") {
894
- result += " # Optional accessibility service example:\n";
895
- result += " # accessibility:\n";
896
- result += " # enabled: false\n";
897
- result += " # standard: wcag2aa\n";
913
+ if (yamlStr.includes("\n accessibility:\n")) {
914
+ result += " # Accessibility checks power the W3C BAD demo test.\n";
915
+ } else {
916
+ result += " # Optional accessibility service example:\n";
917
+ result += " # accessibility:\n";
918
+ result += " # enabled: false\n";
919
+ result += " # standard: wcag2aa\n";
920
+ }
898
921
  } else if (line === "registry:") {
899
922
  result += " # Optional: local and cloud device/provider profiles.\n";
900
923
  result += " # devices:\n";
@@ -965,9 +988,7 @@ function browserSetupCommand(platform) {
965
988
  function mobileDriverSetupCommand(platform) {
966
989
  const runtimes = normalizePlatformSelection(platform).mobileRuntimes;
967
990
  if (runtimes.length === 0) return null;
968
- if (runtimes.includes("android") && runtimes.includes("ios")) return "agent-qa install-mobile-drivers --all";
969
- if (runtimes.includes("android")) return "agent-qa install-mobile-drivers --android";
970
- return "agent-qa install-mobile-drivers --ios";
991
+ return "agent-qa install-mobile-drivers --all";
971
992
  }
972
993
  function initNextSteps(platform) {
973
994
  const steps = [];
@@ -1007,15 +1028,7 @@ function createInitCommand() {
1007
1028
  required: true,
1008
1029
  validate: (value) => value.length > 0 || "Select at least one platform."
1009
1030
  });
1010
- const mobileRuntimes = capabilities.includes("mobile") ? await (0, import_checkbox.default)({
1011
- message: "Which mobile platforms will you test?",
1012
- choices: [
1013
- { value: "android", name: "Android", description: "Install or reuse the UiAutomator2 Appium driver" },
1014
- { value: "ios", name: "iOS", description: "Install or reuse the XCUITest Appium driver" }
1015
- ],
1016
- required: true,
1017
- validate: (value) => value.length > 0 || "Select at least one mobile platform."
1018
- }) : [];
1031
+ const mobileRuntimes = capabilities.includes("mobile") ? ["android", "ios"] : [];
1019
1032
  platform = { capabilities, mobileRuntimes };
1020
1033
  const llmSetup = await (0, import_checkbox.default)({
1021
1034
  message: `Subscription auth ${import_picocolors3.default.dim("(optional)")}`,
@@ -1131,6 +1144,9 @@ function createInitCommand() {
1131
1144
  const hnTestPath = (0, import_node_path3.join)(testsDir, "hacker-news-top-story.yaml");
1132
1145
  (0, import_node_fs.writeFileSync)(hnTestPath, buildHackerNewsTopStoryTest());
1133
1146
  console.log(import_picocolors3.default.green(`\u2713 Created ${hnTestPath}`));
1147
+ const badA11yTestPath = (0, import_node_path3.join)(testsDir, "bad-a11y.yaml");
1148
+ (0, import_node_fs.writeFileSync)(badA11yTestPath, buildBadA11yTest());
1149
+ console.log(import_picocolors3.default.green(`\u2713 Created ${badA11yTestPath}`));
1134
1150
  }
1135
1151
  appendGitignore(dir);
1136
1152
  console.log(import_picocolors3.default.green("\u2713 Updated .gitignore"));
@@ -1152,6 +1168,7 @@ function createInitCommand() {
1152
1168
  if (hasWeb(platform)) {
1153
1169
  console.log(` ${import_picocolors3.default.dim("\u2022")} tests/automation-exercise/*.yaml`);
1154
1170
  console.log(` ${import_picocolors3.default.dim("\u2022")} tests/hacker-news-top-story.yaml`);
1171
+ console.log(` ${import_picocolors3.default.dim("\u2022")} tests/bad-a11y.yaml`);
1155
1172
  console.log(` ${import_picocolors3.default.dim("\u2022")} suites/automation-exercise.suite.yaml`);
1156
1173
  console.log(` ${import_picocolors3.default.dim("\u2022")} scripts/fetch-hn-top-story.mjs`);
1157
1174
  }
@@ -1857,18 +1874,13 @@ function checkPlaywright(config) {
1857
1874
  function appiumResolverCwd(configPath) {
1858
1875
  return (0, import_node_path7.dirname)((0, import_node_path7.resolve)(configPath));
1859
1876
  }
1860
- function mobileDriverInstallCommand(config) {
1861
- const hasAndroid = hasAndroidPlatform(config);
1862
- const hasIOS = hasIOSPlatform(config);
1863
- if (hasAndroid && hasIOS) return "agent-qa install-mobile-drivers --all";
1864
- if (hasAndroid) return "agent-qa install-mobile-drivers --android";
1865
- if (hasIOS) return "agent-qa install-mobile-drivers --ios";
1877
+ function mobileDriverInstallCommand() {
1866
1878
  return "agent-qa install-mobile-drivers --all";
1867
1879
  }
1868
1880
  function checkAppium(config, configPath) {
1869
1881
  return {
1870
1882
  name: "Appium",
1871
- fixInstructions: `${(0, import_agent_qa_core6.formatAppiumInstallGuidance)()} Then run \`${mobileDriverInstallCommand(config)}\`.`,
1883
+ fixInstructions: `${(0, import_agent_qa_core6.formatAppiumInstallGuidance)()} Then run \`${mobileDriverInstallCommand()}\`.`,
1872
1884
  check: async () => {
1873
1885
  if (!isMobilePlatform(config)) {
1874
1886
  return { status: "skip", message: "not configured" };
@@ -1886,7 +1898,7 @@ function checkAppium(config, configPath) {
1886
1898
  function checkAppiumDrivers(config, configPath) {
1887
1899
  return {
1888
1900
  name: "Appium drivers",
1889
- fixInstructions: `Run \`${mobileDriverInstallCommand(config)}\``,
1901
+ fixInstructions: `Run \`${mobileDriverInstallCommand()}\``,
1890
1902
  check: async () => {
1891
1903
  if (!isMobilePlatform(config)) {
1892
1904
  return { status: "skip", message: "not configured" };
@@ -2229,6 +2241,10 @@ async function createPlatformAdapter(platform) {
2229
2241
  const { WebPlatformAdapter } = await import("@vostride/agent-qa-web");
2230
2242
  return new WebPlatformAdapter();
2231
2243
  }
2244
+ var runWebAccessibilityCheck = async (page, options) => {
2245
+ const { runAccessibilityCheck } = await import("@vostride/agent-qa-web");
2246
+ return runAccessibilityCheck(page, options);
2247
+ };
2232
2248
  function buildPlatformConfig(platform, resolvedDevice, timeouts, globalBrowser, logCapture, farmSession, mobileResolved) {
2233
2249
  if (platform === "web") {
2234
2250
  return {
@@ -3225,6 +3241,7 @@ async function executeSuites(suiteFiles, opts, config, globalOpts, configContent
3225
3241
  sandboxOptions: hooksContext?.sandboxOptions,
3226
3242
  logCapture: suiteLogCapture,
3227
3243
  accessibility: config.services?.accessibility,
3244
+ accessibilityCheck: runWebAccessibilityCheck,
3228
3245
  screenshotSize: plannerCfg.screenshotSize,
3229
3246
  effectiveResolution: plannerCfg.effectiveResolution,
3230
3247
  memoryProvider: suiteMemoryProvider,
@@ -4074,6 +4091,7 @@ Config for: ${test.name}`));
4074
4091
  inlineHookSandboxOptions: sandboxOptions,
4075
4092
  logCapture: testLogCapture,
4076
4093
  accessibility: config.services?.accessibility,
4094
+ accessibilityCheck: runWebAccessibilityCheck,
4077
4095
  screenshotSize: plannerCfg.screenshotSize,
4078
4096
  effectiveResolution: plannerCfg.effectiveResolution,
4079
4097
  contextWindow: plannerCfg.contextWindow,
@@ -4176,6 +4194,7 @@ Config for: ${test.name}`));
4176
4194
  inlineHookSandboxOptions: sandboxOptions,
4177
4195
  logCapture: testLogCapture,
4178
4196
  accessibility: config.services?.accessibility,
4197
+ accessibilityCheck: runWebAccessibilityCheck,
4179
4198
  screenshotSize: plannerCfg.screenshotSize,
4180
4199
  effectiveResolution: plannerCfg.effectiveResolution,
4181
4200
  contextWindow: plannerCfg.contextWindow