From 8409932e9a6a44f5fcc3b8523a0d5eae020de05a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 18 May 2026 21:10:44 +0000 Subject: [PATCH 1/2] Initial plan From 7f27afda6415db5a7014a58570cff4d90d90b850 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 18 May 2026 21:12:44 +0000 Subject: [PATCH 2/2] docs: add test conventions reference Agent-Logs-Url: https://github.com/microsoft/sample-webapp/sessions/fb6ed66b-ffea-4a01-8196-c320809675a6 Co-authored-by: kashish2508 <90824921+kashish2508@users.noreply.github.com> --- docs/test-conventions.md | 170 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 docs/test-conventions.md diff --git a/docs/test-conventions.md b/docs/test-conventions.md new file mode 100644 index 0000000..2439ebe --- /dev/null +++ b/docs/test-conventions.md @@ -0,0 +1,170 @@ +# Test Conventions Reference + +Concrete selector and ARIA conventions used across this repository. +Intended for Copilot agent sessions (heal, code review, new tests) so they +do not need to re-read every source file. + +--- + +## 1. Login message — ARIA roles and `aria-live` + +**Source:** `src/pages/Login.js` + +The message `
` rendered below the form uses a **dynamic role**: + +| State | `role` | CSS class | +|---------|----------|------------------| +| Success | `status` | `message success` | +| Error | `alert` | `message error` | + +Both states also carry `aria-live="polite"` (static attribute — it does not +change with the role). + +```jsx +
+ {message} +
+``` + +--- + +## 2. How Playwright specs assert on login messages + +**Source:** `tests/login.spec.ts` + +Specs use `getByRole` — never a CSS selector or `#message` ID — because the +role itself encodes the pass/fail state. + +```ts +// Success +const message = page.getByRole('status'); +await expect(message).toBeVisible(); +await expect(message).toHaveClass(/success/); +await expect(message).toContainText('Welcome'); + +// Error +const message = page.getByRole('alert'); +await expect(message).toBeVisible(); +await expect(message).toHaveClass(/error/); +``` + +Form field selectors use `getByRole('textbox', { name: … })` and +`getByRole('button', { name: … })`, matching the `