@orion-qa/orion 3.4.1 → 3.5.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.
Files changed (68) hide show
  1. package/.claude/agents/change-agent.md +1 -1
  2. package/.claude/agents/requirement-analyst.md +1 -1
  3. package/.claude/agents/test-reporter.md +1 -1
  4. package/.claude/skills/appium/templates/project-java/src/test/java/automation/pageObjects/BaseScreen.java +36 -2
  5. package/.claude/skills/appium/templates/project-java/src/test/java/automation/tests/unit/UtilsTest.java +10 -0
  6. package/.claude/skills/appium/templates/project-java/src/test/java/automation/utils/AutomationError.java +21 -0
  7. package/.claude/skills/automation-implementation/SKILL.md +1 -1
  8. package/.claude/skills/automation-implementation/references/patterns.md +14 -0
  9. package/.claude/skills/change-management/SKILL.md +1 -1
  10. package/.claude/skills/code-review/SKILL.md +1 -1
  11. package/.claude/skills/code-review/references/pattern-rules.md +4 -0
  12. package/.claude/skills/documentation/SKILL.md +2 -1
  13. package/.claude/skills/execution/SKILL.md +1 -0
  14. package/.claude/skills/orion/SKILL.md +6 -3
  15. package/.claude/skills/orion/references/conversation.md +1 -1
  16. package/.claude/skills/orion/references/project-context-files.md +3 -1
  17. package/.claude/skills/orion/references/setup-card.md +2 -1
  18. package/.claude/skills/orion/scripts/browser_setup.mjs +4 -4
  19. package/.claude/skills/orion/scripts/case_check.mjs +69 -0
  20. package/.claude/skills/orion/scripts/cases_coverage.py +179 -0
  21. package/.claude/skills/orion/scripts/cases_export.py +3 -0
  22. package/.claude/skills/orion/scripts/cases_model.py +256 -0
  23. package/.claude/skills/orion/scripts/context_guard.mjs +172 -0
  24. package/.claude/skills/orion/scripts/graph.mjs +112 -22
  25. package/.claude/skills/orion/scripts/lib/scan.mjs +8 -2
  26. package/.claude/skills/orion/scripts/report_make.mjs +15 -11
  27. package/.claude/skills/orion/scripts/run_state.mjs +4 -0
  28. package/.claude/skills/orion/scripts/screen_map.mjs +392 -0
  29. package/.claude/skills/orion/scripts/suite_check.mjs +1 -1
  30. package/.claude/skills/playwright/templates/dotnet/PageObjects/BasePage.cs +46 -0
  31. package/.claude/skills/playwright/templates/dotnet/Tests/Unit/UtilsTests.cs +10 -0
  32. package/.claude/skills/playwright/templates/dotnet/Utils/AutomationError.cs +19 -1
  33. package/.claude/skills/playwright/templates/javascript/pageObjects/basePage.js +52 -0
  34. package/.claude/skills/playwright/templates/javascript/reporters/summaryReporter.js +18 -9
  35. package/.claude/skills/playwright/templates/javascript/tests/unit/basePage.test.js +51 -0
  36. package/.claude/skills/playwright/templates/javascript/utils/errors.js +9 -2
  37. package/.claude/skills/playwright/templates/project/pageObjects/basePage.ts +54 -1
  38. package/.claude/skills/playwright/templates/project/reporters/summaryReporter.ts +18 -9
  39. package/.claude/skills/playwright/templates/project/tests/unit/basePage.test.ts +52 -0
  40. package/.claude/skills/playwright/templates/project/utils/errors.ts +12 -2
  41. package/.claude/skills/playwright/templates/python/page_objects/base_page.py +43 -0
  42. package/.claude/skills/playwright/templates/python/tests/unit/test_fail_fast_helpers.py +57 -0
  43. package/.claude/skills/playwright/templates/python/utils/errors.py +7 -3
  44. package/.claude/skills/requests/templates/python-pytest/src/services/api_client.py +11 -1
  45. package/.claude/skills/requests/templates/python-pytest/tests/unit/test_api_client.py +16 -0
  46. package/.claude/skills/requirement-analysis/references/test-case-import.md +9 -1
  47. package/.claude/skills/requirement-analysis/scripts/tm.py +422 -2
  48. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/config/Flags.java +19 -0
  49. package/.claude/skills/rest-assured/templates/java-testng/src/test/java/automation/services/ApiSpec.java +10 -3
  50. package/.claude/skills/selenium/templates/csharp-nunit/PageObjects/BasePage.cs +89 -11
  51. package/.claude/skills/selenium/templates/csharp-nunit/Tests/Unit/UtilsTests.cs +10 -0
  52. package/.claude/skills/selenium/templates/csharp-nunit/Utils/AutomationError.cs +19 -1
  53. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/pageObjects/BasePage.java +65 -8
  54. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/tests/unit/UtilsTest.java +10 -0
  55. package/.claude/skills/selenium/templates/java-testng/src/test/java/automation/utils/AutomationError.java +21 -0
  56. package/.claude/skills/selenium/templates/python-pytest/page_objects/base_page.py +70 -11
  57. package/.claude/skills/selenium/templates/python-pytest/tests/unit/test_fail_fast_helpers.py +43 -0
  58. package/.claude/skills/selenium/templates/python-pytest/utils/errors.py +7 -3
  59. package/.claude/skills/test-design/SKILL.md +1 -1
  60. package/.claude/skills/test-reporting/SKILL.md +1 -0
  61. package/.claude/skills/ui-observation/SKILL.md +4 -1
  62. package/.claude-plugin/plugin.json +1 -1
  63. package/.cursor/rules/orion-quiet.mdc +13 -0
  64. package/AGENTS.md +1 -1
  65. package/README.md +2 -2
  66. package/bin/orion.mjs +5 -1
  67. package/hosts/gemini-extension/gemini-extension.json +1 -1
  68. package/package.json +2 -1
@@ -37,4 +37,14 @@ public class UtilsTests
37
37
  [Test]
38
38
  public void AddDaysAndIsoDateFromAFixedDay() =>
39
39
  Assert.That(Dates.IsoDate(Dates.AddDays(1, new DateOnly(2026, 1, 31))), Is.EqualTo("2026-02-01"));
40
+
41
+ /// <summary>AutomationError names what, where and how long, plus the page; the three-part form is unchanged.</summary>
42
+ [Test]
43
+ public void AutomationErrorCarriesContext()
44
+ {
45
+ Assert.That(new AutomationError("Wait for", "the Login button", "not visible within 10s",
46
+ new Dictionary<string, string?> { ["page"] = "https://app.test/login" }).Message,
47
+ Is.EqualTo("Wait for the Login button: not visible within 10s (page: https://app.test/login)"));
48
+ Assert.That(new AutomationError("Open", "/login", "HTTP 500").Message, Is.EqualTo("Open /login: HTTP 500"));
49
+ }
40
50
  }
@@ -7,7 +7,25 @@ namespace Automation.Utils;
7
7
  /// <param name="action">What the suite was doing, e.g. "Open" or "Wait for".</param>
8
8
  /// <param name="where">The URL or element it was acting on.</param>
9
9
  /// <param name="detail">What came back: an HTTP status, or the state that was never reached.</param>
10
- public class AutomationError(string action, string where, string detail) : Exception($"{action} {where}: {detail}");
10
+ public class AutomationError(string action, string where, string detail) : Exception($"{action} {where}: {detail}")
11
+ {
12
+ /// <summary>Builds the message from its three parts plus facts that help the reader, e.g. the page or the item.</summary>
13
+ /// <param name="action">What the suite was doing.</param>
14
+ /// <param name="where">The URL or element it was acting on.</param>
15
+ /// <param name="detail">What came back.</param>
16
+ /// <param name="context">Facts in order, e.g. <c>new() { ["page"] = url }</c>; empty values are left out.</param>
17
+ public AutomationError(string action, string where, string detail, IReadOnlyDictionary<string, string?> context)
18
+ : this(action, where, detail + Facts(context)) { }
19
+
20
+ /// <summary>" (key: value, …)" for the non-empty facts, or "".</summary>
21
+ /// <param name="context">The facts.</param>
22
+ /// <returns>The suffix for the message.</returns>
23
+ private static string Facts(IReadOnlyDictionary<string, string?> context)
24
+ {
25
+ var joined = string.Join(", ", context.Where(f => !string.IsNullOrEmpty(f.Value)).Select(f => $"{f.Key}: {f.Value}"));
26
+ return joined.Length == 0 ? "" : $" ({joined})";
27
+ }
28
+ }
11
29
 
12
30
  /// <summary>A setting the run needs is missing from the environment and the project's `.env`.</summary>
13
31
  /// <param name="name">The environment variable that has no value.</param>
@@ -31,6 +31,8 @@ public abstract class BasePage {
31
31
  protected BasePage(WebDriver driver) {
32
32
  this.driver = driver;
33
33
  this.wait = new WebDriverWait(driver, Flags.timeout());
34
+ // A page that re-renders replaces elements: a stale one is retried within the same bounded wait.
35
+ this.wait.ignoring(org.openqa.selenium.StaleElementReferenceException.class);
34
36
  }
35
37
 
36
38
  /** @return the page's path relative to `BASE_URL` (from `TestData`); a page with no path of its own returns "" */
@@ -80,7 +82,36 @@ public abstract class BasePage {
80
82
  * @return the element
81
83
  */
82
84
  protected WebElement visible(By locator) {
83
- return wait.until(ExpectedConditions.visibilityOfElementLocated(locator));
85
+ return ensureVisible(locator, locator.toString());
86
+ }
87
+
88
+ /**
89
+ * Requires an element to be visible, and fails fast with a named reason when it isn't: what was missing, on which
90
+ * page, after how long. One bounded wait (no polling loop, no Thread.sleep).
91
+ *
92
+ * @param locator the element's locator
93
+ * @param what the element in the user's words, e.g. "the Webhooks section"
94
+ * @return the element
95
+ * @throws AutomationError "Wait for <what>: not visible within <n>s (page: <url>)"
96
+ */
97
+ protected WebElement ensureVisible(By locator, String what) {
98
+ try {
99
+ return wait.until(ExpectedConditions.visibilityOfElementLocated(locator));
100
+ } catch (TimeoutException e) {
101
+ throw new AutomationError("Wait for", what, "not visible within " + Flags.timeout().toSeconds() + "s",
102
+ java.util.Map.of("page", driver.getCurrentUrl()));
103
+ }
104
+ }
105
+
106
+ /**
107
+ * Asks whether an element is shown, without failing: for choosing a path in a page action, never for what a test
108
+ * checks. @toolkit: kept for page actions to reuse.
109
+ *
110
+ * @param locator the element's locator
111
+ * @return whether it is shown now (no implicit wait)
112
+ */
113
+ protected boolean isShown(By locator) {
114
+ return driver.findElements(locator).stream().anyMatch(WebElement::isDisplayed);
84
115
  }
85
116
 
86
117
  /**
@@ -90,9 +121,19 @@ public abstract class BasePage {
90
121
  * @param text what to type
91
122
  */
92
123
  protected void type(By locator, String text) {
93
- WebElement element = visible(locator);
94
- element.clear();
95
- element.sendKeys(text);
124
+ // Find, clear and type in one step of the wait, so a re-rendered field is found again instead of going stale.
125
+ try {
126
+ wait.until(d -> {
127
+ WebElement element = d.findElements(locator).stream().filter(WebElement::isDisplayed).findFirst().orElse(null);
128
+ if (element == null) return false;
129
+ element.clear();
130
+ element.sendKeys(text);
131
+ return true;
132
+ });
133
+ } catch (TimeoutException e) {
134
+ throw new AutomationError("Type into", locator.toString(), "not visible within " + Flags.timeout().toSeconds() + "s",
135
+ java.util.Map.of("page", driver.getCurrentUrl()));
136
+ }
96
137
  }
97
138
 
98
139
  /**
@@ -101,7 +142,18 @@ public abstract class BasePage {
101
142
  * @param locator the element's locator
102
143
  */
103
144
  protected void click(By locator) {
104
- wait.until(ExpectedConditions.elementToBeClickable(locator)).click();
145
+ try {
146
+ wait.until(d -> {
147
+ WebElement element = d.findElements(locator).stream()
148
+ .filter(e -> e.isDisplayed() && e.isEnabled()).findFirst().orElse(null);
149
+ if (element == null) return false;
150
+ element.click();
151
+ return true;
152
+ });
153
+ } catch (TimeoutException e) {
154
+ throw new AutomationError("Click", locator.toString(), "not clickable within " + Flags.timeout().toSeconds() + "s",
155
+ java.util.Map.of("page", driver.getCurrentUrl()));
156
+ }
105
157
  }
106
158
 
107
159
  /**
@@ -111,9 +163,14 @@ public abstract class BasePage {
111
163
  * @return its text
112
164
  */
113
165
  protected String textWhenPresent(By locator) {
114
- WebElement element = visible(locator);
115
- wait.until(d -> !element.getText().isBlank());
116
- return element.getText();
166
+ // Look the element up on every check: a page that re-renders the message would leave a kept reference stale.
167
+ try {
168
+ return wait.until(d -> d.findElements(locator).stream().filter(WebElement::isDisplayed)
169
+ .map(WebElement::getText).filter(t -> !t.isBlank()).findFirst().orElse(null));
170
+ } catch (TimeoutException e) {
171
+ throw new AutomationError("Wait for", locator.toString(), "no text within " + Flags.timeout().toSeconds() + "s",
172
+ java.util.Map.of("page", driver.getCurrentUrl()));
173
+ }
117
174
  }
118
175
 
119
176
  /**
@@ -3,6 +3,7 @@ package automation.tests.unit;
3
3
  import static org.testng.Assert.assertEquals;
4
4
  import static org.testng.Assert.assertTrue;
5
5
 
6
+ import automation.utils.AutomationError;
6
7
  import automation.utils.Dates;
7
8
  import automation.utils.RandomData;
8
9
  import java.time.LocalDate;
@@ -31,4 +32,13 @@ public class UtilsTest {
31
32
  public void addDaysAndIsoDateFromAFixedDay() {
32
33
  assertEquals(Dates.isoDate(Dates.addDays(1, LocalDate.of(2026, 1, 31))), "2026-02-01");
33
34
  }
35
+
36
+ /** AutomationError names what, where and how long, plus the page; the three-part form is unchanged. */
37
+ @Test(groups = "unit")
38
+ public void automationErrorCarriesContext() {
39
+ assertEquals(new AutomationError("Wait for", "the Login button", "not visible within 10s",
40
+ java.util.Map.of("page", "https://app.test/login")).getMessage(),
41
+ "Wait for the Login button: not visible within 10s (page: https://app.test/login)");
42
+ assertEquals(new AutomationError("Open", "/login", "HTTP 500").getMessage(), "Open /login: HTTP 500");
43
+ }
34
44
  }
@@ -15,4 +15,25 @@ public class AutomationError extends RuntimeException {
15
15
  public AutomationError(String action, String where, String detail) {
16
16
  super(action + " " + where + ": " + detail);
17
17
  }
18
+
19
+ /**
20
+ * Builds the message from its three parts plus facts that help the reader, e.g. the screen or the item.
21
+ *
22
+ * @param action what the suite was doing
23
+ * @param where the URL or element it was acting on
24
+ * @param detail what came back
25
+ * @param context facts in order, e.g. {@code Map.of("screen", "LoginScreen")}; empty values are left out
26
+ */
27
+ public AutomationError(String action, String where, String detail, java.util.Map<String, String> context) {
28
+ super(action + " " + where + ": " + detail + facts(context));
29
+ }
30
+
31
+ /** @return " (key: value, …)" for the non-empty facts, or "" */
32
+ private static String facts(java.util.Map<String, String> context) {
33
+ String joined = context.entrySet().stream()
34
+ .filter(e -> e.getValue() != null && !e.getValue().isEmpty())
35
+ .map(e -> e.getKey() + ": " + e.getValue())
36
+ .collect(java.util.stream.Collectors.joining(", "));
37
+ return joined.isEmpty() ? "" : " (" + joined + ")";
38
+ }
18
39
  }
@@ -1,6 +1,6 @@
1
1
  """What every page shares: one way to open its path, one way to wait until it is usable, explicit waits only."""
2
2
  import re
3
- from selenium.common.exceptions import TimeoutException, WebDriverException
3
+ from selenium.common.exceptions import StaleElementReferenceException, TimeoutException, WebDriverException
4
4
  from selenium.webdriver.remote.webelement import WebElement
5
5
  from selenium.webdriver.support import expected_conditions as EC
6
6
  from selenium.webdriver.support.ui import WebDriverWait
@@ -23,7 +23,8 @@ class BasePage:
23
23
  driver: The WebDriver from the DriverManager.
24
24
  """
25
25
  self.driver = driver
26
- self.wait = WebDriverWait(driver, flags.timeout_seconds())
26
+ # A page that re-renders replaces elements: a stale one is retried within the same bounded wait.
27
+ self.wait = WebDriverWait(driver, flags.timeout_seconds(), ignored_exceptions=[StaleElementReferenceException])
27
28
 
28
29
  def open(self) -> "BasePage":
29
30
  """Open the page's path relative to BASE_URL and wait until the page is ready.
@@ -52,12 +53,41 @@ class BasePage:
52
53
  return self
53
54
 
54
55
  def visible(self, locator: tuple) -> WebElement:
55
- """Return an element once it is visible.
56
+ """Return an element once it is visible; see `ensure_visible`.
56
57
 
57
58
  Args:
58
59
  locator: A (By, value) pair.
59
60
  """
60
- return self.wait.until(EC.visibility_of_element_located(locator))
61
+ return self.ensure_visible(locator, f"{locator[0]}={locator[1]}")
62
+
63
+ def ensure_visible(self, locator: tuple, what: str) -> WebElement:
64
+ """Require an element to be visible, and fail fast with a named reason when it isn't: what was missing, on
65
+ which page, after how long. One bounded wait (no polling loop, no sleep).
66
+
67
+ Args:
68
+ locator: A (By, value) pair.
69
+ what: The element in the user's words, e.g. "the Webhooks section".
70
+
71
+ Returns:
72
+ The element.
73
+
74
+ Raises:
75
+ AutomationError: "Wait for <what>: not visible within <n>s (page: <url>)".
76
+ """
77
+ try:
78
+ return self.wait.until(EC.visibility_of_element_located(locator))
79
+ except TimeoutException as error:
80
+ raise AutomationError("Wait for", what, f"not visible within {flags.timeout_seconds()}s",
81
+ {"page": self.driver.current_url}) from error
82
+
83
+ def is_shown(self, locator: tuple) -> bool:
84
+ """Ask whether an element is shown now, without failing: for choosing a path in a page action, never for what a
85
+ test checks. @toolkit: kept for page actions to reuse.
86
+
87
+ Args:
88
+ locator: A (By, value) pair.
89
+ """
90
+ return any(element.is_displayed() for element in self.driver.find_elements(*locator))
61
91
 
62
92
  def type(self, locator: tuple, text: str) -> None:
63
93
  """Clear a visible field and type into it.
@@ -66,9 +96,20 @@ class BasePage:
66
96
  locator: The field's (By, value) pair.
67
97
  text: What to type.
68
98
  """
69
- element = self.visible(locator)
70
- element.clear()
71
- element.send_keys(text)
99
+ def typed(driver) -> bool:
100
+ """Find, clear and type in one step of the wait, so a re-rendered field is found again, not stale."""
101
+ element = next((e for e in driver.find_elements(*locator) if e.is_displayed()), None)
102
+ if element is None:
103
+ return False
104
+ element.clear()
105
+ element.send_keys(text)
106
+ return True
107
+
108
+ try:
109
+ self.wait.until(typed)
110
+ except TimeoutException as error:
111
+ raise AutomationError("Type into", f"{locator[0]}={locator[1]}", f"not visible within {flags.timeout_seconds()}s",
112
+ {"page": self.driver.current_url}) from error
72
113
 
73
114
  def click(self, locator: tuple) -> None:
74
115
  """Click an element once it is clickable.
@@ -76,7 +117,19 @@ class BasePage:
76
117
  Args:
77
118
  locator: The element's (By, value) pair.
78
119
  """
79
- self.wait.until(EC.element_to_be_clickable(locator)).click()
120
+ def clicked(driver) -> bool:
121
+ """Find and click in one step of the wait, so a re-rendered element is found again, not stale."""
122
+ element = next((e for e in driver.find_elements(*locator) if e.is_displayed() and e.is_enabled()), None)
123
+ if element is None:
124
+ return False
125
+ element.click()
126
+ return True
127
+
128
+ try:
129
+ self.wait.until(clicked)
130
+ except TimeoutException as error:
131
+ raise AutomationError("Click", f"{locator[0]}={locator[1]}", f"not clickable within {flags.timeout_seconds()}s",
132
+ {"page": self.driver.current_url}) from error
80
133
 
81
134
  def text_when_present(self, locator: tuple) -> str:
82
135
  """Return an element's text once it is visible and not empty (readiness, not a check of the value).
@@ -84,6 +137,12 @@ class BasePage:
84
137
  Args:
85
138
  locator: The element's (By, value) pair.
86
139
  """
87
- element = self.visible(locator)
88
- self.wait.until(lambda _driver: element.text.strip() != "")
89
- return element.text
140
+ def text(driver):
141
+ """Look the element up on every check: a re-rendered message would leave a kept reference stale."""
142
+ return next((e.text for e in driver.find_elements(*locator) if e.is_displayed() and e.text.strip()), False)
143
+
144
+ try:
145
+ return self.wait.until(text)
146
+ except TimeoutException as error:
147
+ raise AutomationError("Wait for", f"{locator[0]}={locator[1]}", f"no text within {flags.timeout_seconds()}s",
148
+ {"page": self.driver.current_url}) from error
@@ -0,0 +1,43 @@
1
+ """Unit tests of the fail-fast helpers, with a stand-in driver: no browser and no app."""
2
+ from page_objects.base_page import BasePage
3
+ from utils.errors import AutomationError
4
+
5
+
6
+ class _FakeElement:
7
+ """A stand-in element that is shown or hidden."""
8
+
9
+ def __init__(self, shown: bool) -> None:
10
+ """Keep whether the element is displayed."""
11
+ self.shown = shown
12
+
13
+ def is_displayed(self) -> bool:
14
+ """Answer like Selenium's is_displayed."""
15
+ return self.shown
16
+
17
+
18
+ class _FakeDriver:
19
+ """A stand-in driver whose page has the given elements."""
20
+
21
+ current_url = "https://app.test/admin/webhooks"
22
+
23
+ def __init__(self, elements: list) -> None:
24
+ """Keep the elements find_elements returns."""
25
+ self.elements = elements
26
+
27
+ def find_elements(self, by: str, value: str) -> list:
28
+ """Return the elements, whatever the locator."""
29
+ return self.elements
30
+
31
+
32
+ def test_is_shown_answers_without_failing():
33
+ """is_shown is true only for a displayed element, and never raises."""
34
+ assert BasePage(_FakeDriver([_FakeElement(True)])).is_shown(("id", "menu")) is True
35
+ assert BasePage(_FakeDriver([_FakeElement(False)])).is_shown(("id", "menu")) is False
36
+ assert BasePage(_FakeDriver([])).is_shown(("id", "menu")) is False
37
+
38
+
39
+ def test_error_names_what_where_and_page():
40
+ """AutomationError carries the page; the three-part form is unchanged."""
41
+ error = AutomationError("Wait for", "the Login button", "not visible within 10s", {"page": "https://app.test/login"})
42
+ assert str(error) == "Wait for the Login button: not visible within 10s (page: https://app.test/login)"
43
+ assert str(AutomationError("Open", "/login", "HTTP 500")) == "Open /login: HTTP 500"
@@ -1,19 +1,23 @@
1
1
  """The one error type the suite raises, so every failure reads the same way: what was being done, where (URL or
2
2
  element), and what came back (status or state)."""
3
+ from typing import Optional
3
4
 
4
5
 
5
6
  class AutomationError(Exception):
6
7
  """A step of the suite failed: the action, where, and what came back."""
7
8
 
8
- def __init__(self, action: str, where: str, detail: str) -> None:
9
- """Build the message from its three parts.
9
+ def __init__(self, action: str, where: str, detail: str, context: Optional[dict] = None) -> None:
10
+ """Build the message from its three parts, plus facts that help the reader.
10
11
 
11
12
  Args:
12
13
  action: What the suite was doing, e.g. "Open" or "Wait for".
13
14
  where: The URL or element it was acting on.
14
15
  detail: What came back: an HTTP status, or the state that was never reached.
16
+ context: Facts such as {"page": url, "item": "Blue Shirt"}; empty values are left out.
15
17
  """
16
- super().__init__(f"{action} {where}: {detail}")
18
+ self.context = context or {}
19
+ facts = ", ".join(f"{k}: {v}" for k, v in self.context.items() if v not in (None, ""))
20
+ super().__init__(f"{action} {where}: {detail}" + (f" ({facts})" if facts else ""))
17
21
 
18
22
 
19
23
  class MissingSettingError(AutomationError):
@@ -16,7 +16,7 @@ description: "Designs implementation-independent test scenarios from acceptance
16
16
  2. Pick the technique that fits each AC and name it: equivalence partitioning (input classes), boundary values (limits, just inside/outside), decision table (combinations of rules), state transition (status flows, e.g. locked/unlocked), error guessing (empty, invalid, permissions, concurrency where relevant). Add the negative, boundary and edge scenarios the technique produces.
17
17
  2a. **Mobile and desktop** ACs: also consider the conditions the platform adds where they affect the AC: permission prompts, the app going to the background and back, rotation or window resize, network loss, the keyboard covering input, focus after dialogs.
18
18
  2b. **API** ACs: per endpoint the AC touches, consider the status codes it implies (success, 400/422 validation, 401/403 auth, 404, 409 conflict), required, missing and invalid fields (equivalence partitions and boundaries on the payload), and what a later GET must show after a write. Set data up and clean it up through the API. Add a schema or contract check only where the project has one or the AC is about the response shape.
19
- 2b2. **Case format.** Every case follows [references/test-case-standard.md](references/test-case-standard.md): an action-condition-outcome title, preconditions, numbered one-action steps, test data by name, an exact expected result for every check (a negative case checks the message and that nothing happened), postconditions.
19
+ 2b2. **Case format, checked by script.** Every case follows [references/test-case-standard.md](references/test-case-standard.md), and `node .claude/skills/orion/scripts/case_check.mjs project-context/test-designs/<story>/design.md` exits 0 before the table is shown (fix every finding; the design table has Test data and Postconditions columns, steps are numbered plain words with the screen's labels, data by what it is with the value or variable in Test data): an action-condition-outcome title, preconditions, numbered one-action steps, test data by name, an exact expected result for every check (a negative case checks the message and that nothing happened), postconditions.
20
20
  2c. **Coverage checklist.** Pick the feature types the story touches from [references/coverage-catalogs.md](references/coverage-catalogs.md) (login, forms, search, tables, CRUD, upload, cart and checkout, API). Rows the coverage minimum (3e) needs and the live site shows are included without asking; the other rows that apply are listed under "Proposed (not included)" for the user to add later. The test-case table (ID · What it checks · Type · Priority · Expected) is shown with "Shall I write these?" and code waits for the reply (the second checkpoint, [conversation.md](../orion/references/conversation.md)). A login story normally ends with 12 or more scenarios.
21
21
  2d. **Imported test cases** keep their source IDs: map each to an AC (or to a ticked checklist row), keep its steps and expected result when they are clear, and list a missing expected result under Questions instead of dropping the case.
22
22
  2e. **Checked against the app.** Test cases are designed after the app was explored (Gate 2), so each scenario's steps are matched to the UI map: `observed` (the map's rows cover every step), `top-up` (a step or page the map lacks, e.g. a ticked checklist row the walk didn't reach; the implementer observes just that before writing), or a **difference** (an imported case or the story names a page, field, button or message the app doesn't show, or shows differently): list it under Questions, never adopt the observed text as the expected result (3a). No map (`not observed`): say so once; the scenarios are `not checked against the app`.
@@ -15,6 +15,7 @@ description: "Publishes validated test reports, exports designed test cases and
15
15
  1. **Check the authorization.** Any write without an H9 D-nnn in the brief, or an item not listed in its scope → `needs_user`. Reading and `aggregate` need no approval.
16
16
  2. **Check the source is validated.** Publish a run report only after Gate 7 passed and the user accepted it (Gate 8), and test cases only from an accepted design. An aggregate report may be published when every number cites a run file; runs without a Gate 7 result are listed `not validated` and never counted as passed.
17
17
  3. **Map before writing.** Build the item list with the field mapping for the target tool ([references/tool-mapping.md](references/tool-mapping.md)). Read the target first (one read call) to avoid duplicates: an existing case with the same TS-n link or title is **updated only if the D-nnn says so**, otherwise reported. Defects too: search open issues for the same test name or error first (JQL `summary ~` / text); a likely duplicate is shown to the user with its key instead of filing a new one.
18
+ 3b. **Test cases to TestRail, Zephyr Scale, Xray Cloud or Azure Test Plans (`tm.py push-cases --tool testrail|zephyr|xray|azure`):** turn the accepted design into the shared record (`python3 .claude/skills/orion/scripts/cases_model.py to-json project-context/test-designs/<story>/design.md --story <story> --out project-context/test-designs/<story>/cases.json`), run `tm.py push-cases --tool <tool> --cases … --env <project>/.env` **without** an approval first and show its plan (create / update / unchanged) as the preview; after the user's yes, the same command with `--approved D-nnn --approver @handle`. It never duplicates and never touches another story's case (the map in `project-context/tm-map.json` remembers each case per tool, instance and project, and story), backs up a case before updating it, refuses a case changed in the tool since the last push, and never deletes. A tool not listed there gets its import file instead ([delivery-formats](../orion/references/delivery-formats.md)).
18
19
  4. **Write in the approved order**, one tool call per item, stopping at the first error (classes as in the connector's error table). Never retry a write on your own.
19
20
  5. **Record the mapping.** Append `TS-n ↔ external key ↔ test file:line` to `project-context/test-case-map.md` (returned in the RESULT for the orchestrator to write).
20
21
  5a. **Defects** (`file-defects`): create one issue per approved draft in the target project, linked to the story, with steps, expected vs actual, evidence links and the run id; never set priority, assignee or sprint unless the D-nnn says so.
@@ -12,12 +12,13 @@ No locator, navigation step or screen state is guessed. Each one comes from the
12
12
  ## Modes
13
13
  | Mode | Who, when | Walks | Produces |
14
14
  |---|---|---|---|
15
- | `explore` | environment-discovery at Gate 2 (the build request's D-nnn, or H6, covers the URL) | the pages and flows the acceptance criteria name, including the error states they mention (wrong password → its message) | the story's UI map: snapshots, screenshots, every element with its verified locators |
15
+ | `explore` | environment-discovery at Gate 2 (the build request's D-nnn, or H6, covers the URL) | the pages and flows the acceptance criteria name, including the error states they mention (wrong password → its message), and the coverage-catalog cases for those feature types (sign-in: unknown email, Enter submits, reload keeps you signed in, sign-out), so no second look is needed after the user's go | the story's UI map: snapshots, screenshots, every element with its verified locators |
16
16
  | `top-up` | implementer at Gate 5 | only the steps or elements a designed scenario needs and the map lacks | rows appended to the same map |
17
17
  | `heal` | failure-analyst after a UI test fails | only the failing step, from a fresh session (plus, for Playwright JS/TS projects, the run's `test-results/<test>/error-context.md`, which is the page snapshot at the moment of failure) | the changed rows, marked with the date, for the heal proposal |
18
18
 
19
19
  ## Inputs
20
20
  - Mode, and the story's UI map path if one exists (`project-context/ui-maps/<story>.md`)
21
+ - `explore`: the `screens:` table from the brief, when the orchestrator checked earlier screens live (`screen_map.mjs check`): per screen key, **reuse** or **explore again** with the reason
21
22
  - `explore`: the Automation Intent (Gate 1). `top-up`: the accepted test design and the map. `heal`: the failure analysis and the failing step
22
23
  - Test environment URL (web) or app build and device (mobile, desktop) from the user's request or the environment profile; never a production URL (H5)
23
24
  - Test account **secret names** (e.g. `E2E_USER`, `E2E_PASSWORD`); the values live only in the test project's gitignored `.env`
@@ -50,6 +51,7 @@ Never write a host's MCP configuration or settings to make a browser appear (D-0
50
51
  Never: `browser_take_screenshot` with a `filename` (an explicit name is written to the project root instead of the output folder); `browser_run_code_unsafe` (runs code in the server process), `browser_evaluate`, file upload or drop, cookies or storage, network routes; Appium file, permission, device-control and app-install tools. Setup per host: `connectors/playwright/`, `connectors/appium/`; Copilot Studio: `docs/copilot-studio-playwright-mcp.md`.
51
52
 
52
53
  ## Procedure
54
+ 0. **Reuse what was checked.** A screen the brief's `screens:` table marks **reuse** is not walked again for what its file holds: copy its rows from `project-context/ui-maps/screens/<key>.md` into the story map with `reused, checked live <date>` in the Snapshot column. Walk only screens marked **explore again** or not listed, and, on a reused screen, only the steps and states this story's criteria need that its file lacks (a message after a submit, a dialog). No `screens:` table → explore as below.
53
55
  1. **Start clean.** One isolated browser or app session per task. Web: `browser_navigate` to the test URL. Mobile: `select_device`, then `appium_session_management` `create` with the project's capabilities. `top-up` and `heal`: read the map first and go straight to the steps it lacks or the failing step.
54
56
  2. **Sign in the way the app does.** Recognise the method from evidence and sign in per [references/login-methods.md](references/login-methods.md): form, dialog, two steps, iframe or popup by secret **names** (MCP: the server substitutes the values; runner route: the project's sign-in action reads them from config); an HTTP auth prompt through the project config's `httpCredentials` (runner route); a saved session from `.auth/session.json`; SSO only on the provider's test tenant. MFA, CAPTCHA or a magic link → the sign-in-once window; a client certificate or Windows sign-in → `needs_user` with the options in its section 4. At most 2 failed sign-ins per run. No account given and the site needs one → one question for it (it goes into the project's `.env`).
55
57
  3. **Walk** (scope by mode, see Modes) the way a user would. After every action take a fresh `browser_snapshot` (or `appium_get_page_source`): refs change when the page changes. Use run-unique data; never delete or change records you didn't create.
@@ -80,6 +82,7 @@ S-2 (after open, /login.html):
80
82
  SC-1 (login page): .ui-map/browser/page-<timestamp>.png
81
83
  ## Login (method · evidence · entry · secret names · server setup · blocked)
82
84
  ## Data setup seen (method + path)
85
+ ## App errors seen (HTTP 4xx/5xx from `browser_network_requests`, console errors: what, on which page or step, how often)
83
86
  ## Differences from the requirement (text or elements)
84
87
  ## Not observed (and why)
85
88
  ```
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "orion",
3
3
  "displayName": "Orion",
4
- "version": "3.4.1",
4
+ "version": "3.5.0",
5
5
  "description": "Orion: AI test agents that work as one team. An orchestrator and 11 specialist agents, 42 skills and 8 quality gates that extend a project's existing test framework, with your approval at every write.",
6
6
  "author": {
7
7
  "name": "ahmad44980"
@@ -0,0 +1,13 @@
1
+ ---
2
+ description: Orion quiet run: which messages the user sees
3
+ alwaysApply: true
4
+ ---
5
+ <!-- generated by scripts/build_hosts.py from .claude/ and AGENTS.md; edit the source, then rerun the script -->
6
+
7
+ # Orion: quiet run (applies to every message while an Orion run is open)
8
+
9
+ The user reads only these messages, nothing else:
10
+ 1. the setup card; 2. a setup message only when something is missing that the request doesn't cover;
11
+ 3. the test-case table with "Shall I write these?"; 4. at most three one-line milestones in the whole build, each a result that just happened (e.g. "5 tests written and reviewed. Running them."); 5. the result.
12
+
13
+ Never write what you are about to do or are doing ("Next I'll…", "I'm reading…", "Now checking…", "I'm on the site"), never name rules, skills, gates, agents, scripts or files you read, never explain a tool call. Silence between tool calls is correct: the tool calls already show the work. A question to the user is asked only at the two checkpoints, or for a blocker.
package/AGENTS.md CHANGED
@@ -5,7 +5,7 @@ Rules for any AI agent working in a repository where Orion (this test-automation
5
5
  ## How to start
6
6
  - **Plain words start it.** A message that asks, in any words, to write, automate, design, review, run or fix tests, or that starts with "Orion" or "use Orion", starts Orion: follow `.claude/skills/orion/SKILL.md` and read every later message by meaning ([plain-language.md](.claude/skills/orion/references/plain-language.md)); the user never has to type a command. `/orion <requirement>` is a shortcut where the host has commands (Claude Code, Cursor, GitHub Copilot, Gemini CLI, Grok Build, Windsurf). "is everything set up?" (or `/orion doctor`) shows what your host enforces and what rests on these rules.
7
7
  - The main chat is the orchestrator ([.claude/agents/super-orchestrator.md](.claude/agents/super-orchestrator.md)); it delegates to the eleven specialists in `.claude/agents/` (Codex: `.codex/agents/`, Gemini CLI: `.gemini/agents/`, generated from the same files). Don't start super-orchestrator as a subagent. Each host's start, delegation and enforcement: [hosts.md](.claude/skills/orion/references/hosts.md).
8
- - **Hosts without subagents, and Cursor** (its Task tool rejects the platform's agent types): single-agent mode, you are the orchestrator. For each gate, load the skill that the gate's specialist would use (listed in its agent file under `skills:`), follow it, and write the same RESULT block before moving on. Respect each specialist's *Never* list while you're doing that specialist's step. Say once that the host runs single-agent, and never name a specialist in the run file for work you did.
8
+ - **Hosts without subagents, and Cursor** (its Task tool rejects the platform's agent types): single-agent mode, you are the orchestrator. For each gate, load the skill that the gate's specialist would use (listed in its agent file under `skills:`), follow it, and write the same RESULT block before moving on. Respect each specialist's *Never* list while you're doing that specialist's step. Record in the run file that the host runs single-agent (don't tell the user), and never name a specialist in the run file for work you did. Doing every step yourself is no reason to narrate it: between tool calls, write nothing (the *In the chat* rules).
9
9
 
10
10
  ## In the chat
11
11
  - **A greeting or an empty request** ("hi", "what can you do") gets the capability card from [greeting.md](.claude/skills/orion/references/greeting.md) and nothing else, with or without `/orion`.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- <p align="center"><img src="https://cdn.jsdelivr.net/npm/@orion-qa/orion@3.4.1/assets/orion-banner.svg" alt="Orion: AI test agents, one team. 12 agents that explore, design, build and prove." width="720"></p>
1
+ <p align="center"><img src="https://cdn.jsdelivr.net/npm/@orion-qa/orion@3.5.0/assets/orion-banner.svg" alt="Orion: AI test agents, one team. 12 agents that explore, design, build and prove." width="720"></p>
2
2
 
3
3
  # Orion
4
4
 
@@ -33,7 +33,7 @@ No commands to learn. Typos, half sentences and any language work; anything that
33
33
  `/orion …` still works as a shortcut where your tool has commands.
34
34
 
35
35
  ## How a run goes
36
- [![One Orion run, A to Z: you say what to test and answer the setup card; the agents read the story, explore your app and your code, design the test cases for you to approve, write and review the tests, run them, check every claim and confirm the finish by script; you accept the result](https://cdn.jsdelivr.net/npm/@orion-qa/orion@3.4.1/assets/run-flow.svg)](https://cdn.jsdelivr.net/npm/@orion-qa/orion@3.4.1/assets/run-flow.svg)
36
+ [![One Orion run, A to Z: you say what to test and answer the setup card; the agents read the story, explore your app and your code, design the test cases for you to approve, write and review the tests, run them, check every claim and confirm the finish by script; you accept the result](https://cdn.jsdelivr.net/npm/@orion-qa/orion@3.5.0/assets/run-flow.svg)](https://cdn.jsdelivr.net/npm/@orion-qa/orion@3.5.0/assets/run-flow.svg)
37
37
 
38
38
  1. **You ask**, and answer 8 quick setup questions (each has a default; reply **go**).
39
39
  2. **Understand and explore:** the story becomes numbered acceptance criteria; the live app is explored in a real browser and every locator is proven.
package/bin/orion.mjs CHANGED
@@ -31,7 +31,7 @@ const IMPORT_LINE_ALL = /^@(?:\.\/|\.\.\/)?AGENTS\.md\s*$/gm;
31
31
  const SHARED = ['.claude/agents', '.claude/skills', '.claude/settings.json', 'registry'];
32
32
  const HOSTS = {
33
33
  'claude-code': [['.mcp.template.json'], 'Orion, is everything set up?'],
34
- cursor: [['.cursor/commands', '.cursor/mcp.template.json', '.cursor/hooks.json'], 'Orion, is everything set up? (in the main Agent chat)'],
34
+ cursor: [['.cursor/commands', '.cursor/rules', '.cursor/mcp.template.json', '.cursor/hooks.json'], 'Orion, is everything set up? (in the main Agent chat)'],
35
35
  'github-copilot': [['.github/prompts', '.github/hooks/orion-lean.json', '.vscode/mcp.template.json'], 'Orion, is everything set up?'],
36
36
  'gemini-cli': [['.gemini/agents', '.gemini/commands', '.gemini/settings.json'], 'Orion, is everything set up?'],
37
37
  codex: [['.codex/agents', '.codex/hooks.json'], 'Orion, is everything set up?'],
@@ -205,6 +205,9 @@ function planInstall(target, hosts) {
205
205
  const current = readBytes(agents);
206
206
  if (current.equals(platformAgents)) actions.push(['same', 'AGENTS.md', current, 'already up to date']);
207
207
  else if (current.toString('utf8').includes(agentsRulesSection())) actions.push(['same', 'AGENTS.md', null, 'platform section up to date']);
208
+ // The platform's own AGENTS.md from the last install, unchanged: replace it (a marked section would keep the old
209
+ // rules above the new ones, and an agent would read both).
210
+ else if (record.files['AGENTS.md'] === sha(current)) actions.push(['write', 'AGENTS.md', platformAgents, 'update (unchanged since last install)']);
208
211
  else actions.push(['section', 'AGENTS.md', null, 'your AGENTS.md is kept; platform rules in a marked section']);
209
212
  }
210
213
  if (hosts.includes('claude-code')) actions.push(planClaudeMd(target));
@@ -364,6 +367,7 @@ function install(target, hosts, dryRun, app = null, testId = null) {
364
367
  }
365
368
  if (skipped.length) console.log('Skipped files keep your version; compare them with the platform copy before relying on the install.');
366
369
  console.log('Nothing was committed. Review with: git status');
370
+ console.log('After an upgrade, reload your AI tool and start a new chat: an open chat keeps the old rules.');
367
371
  return skipped.length || warnings.length ? 1 : 0;
368
372
  }
369
373
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "orion-rules",
3
- "version": "3.4.1",
3
+ "version": "3.5.0",
4
4
  "description": "Ask/deny rules of Orion, the AI test agents, for Gemini CLI (policies only; the agents and commands are installed into the repo by scripts/install.py)."
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-qa/orion",
3
- "version": "3.4.1",
3
+ "version": "3.5.0",
4
4
  "description": "Orion: AI test agents that work as one team. They explore your live site, design test cases you approve, write Playwright, Selenium, Appium or API tests in your framework, run them and prove them. For Claude Code, Cursor, Copilot, Codex and Gemini CLI.",
5
5
  "keywords": [
6
6
  "orion",
@@ -53,6 +53,7 @@
53
53
  "registry",
54
54
  ".mcp.template.json",
55
55
  ".cursor/commands",
56
+ ".cursor/rules",
56
57
  ".cursor/mcp.template.json",
57
58
  ".cursor/hooks.json",
58
59
  ".github/prompts",