.cursor/skills/lyx-testing-expert/SKILL.md
# Lyx Testing Expert ## When to Use Use this skill when: - Writing or modifying Playwright E2E tests - Writing or modifying k6 performance tests - Debugging test failures - Adding test coverage for new features - Running the test suite locally or in CI - Understanding the test architecture ## Test Architecture Overview ### Playwright E2E Tests **Location**: `tests/e2e/` **Configuration**: `playwright.config.ts` at project root **Projects**: - `setup` — Global auth setup (registers/logs in
npx skillsauth add imenesesl/lyx .cursor/skills/lyx-testing-expertInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill when:
Location: tests/e2e/
Configuration: playwright.config.ts at project root
Projects:
setup — Global auth setup (registers/logs in test user)admin-chromium — Admin UI tests (authenticated, Desktop Chrome)shell-chromium — Shell/SSR tests (no auth needed, Desktop Chrome)admin-mobile — Responsive tests (iPhone 14 viewport)Fixtures (tests/e2e/fixtures/test-fixtures.ts):
adminPage — Pre-authenticated browser pageapiContext — Authenticated APIRequestContext for direct API callstestApp — Auto-creates a test app, deletes after testtestMfe — Auto-creates a test MFE, deletes after testPage Objects (tests/e2e/pages/):
LoginPage — Login form interactionsAppListPage — App list and create modalSettingsPage — Settings form interactionsLocation: tests/k6/
Scenarios:
api-load.js — API endpoint stress test (50 VUs, p95 < 500ms)ssr-load.js — SSR page render performance (20 VUs, p95 < 2s)concurrent-users.js — Multi-scenario user simulationRunner: tests/k6/run-k6.sh <scenario|all>
Determine which areas are affected:
tests/e2e/admin/tests/e2e/shell/apiContext) and k6import { test, expect } from "../fixtures/test-fixtures";
test.describe("My Feature", () => {
test("happy path works", async ({ adminPage }) => {
await adminPage.goto("/my-feature");
await expect(adminPage.getByRole("heading")).toContainText("My Feature");
});
test("error case shows message", async ({ adminPage }) => {
// Use page.route() to mock API errors
await adminPage.route("**/api/my-endpoint", (route) =>
route.fulfill({ status: 500, body: JSON.stringify({ error: "fail" }) })
);
await adminPage.goto("/my-feature");
await expect(adminPage.locator(".error-text")).toBeVisible();
});
test("creates resource via API", async ({ apiContext }) => {
const res = await apiContext.post("/my-endpoint", {
data: { name: "test" },
});
expect(res.ok()).toBe(true);
});
});
import type { Page, Locator } from "@playwright/test";
export class MyFeaturePage {
readonly page: Page;
readonly heading: Locator;
readonly submitButton: Locator;
constructor(page: Page) {
this.page = page;
this.heading = page.getByRole("heading", { name: "My Feature" });
this.submitButton = page.getByRole("button", { name: "Submit" });
}
async goto() {
await this.page.goto("/my-feature");
}
}
# Specific file
npx playwright test tests/e2e/admin/my-feature.spec.ts
# Specific project
pnpm test:e2e:admin
# All E2E
pnpm test:e2e
# Debug mode (headed browser)
npx playwright test --headed --debug tests/e2e/admin/my-feature.spec.ts
# View report
pnpm test:e2e:report
For every feature, ensure these scenarios are covered:
npx playwright test --headednpx playwright show-trace test-results/*/trace.ziptest-results/*/test-failed-*.pngnpx playwright test --debugplaywright-report from GitHub Actions# Install k6 (macOS)
brew install k6
# Run specific scenario
pnpm test:k6:api
# Custom env vars
BASE_URL=https://prod.example.com k6 run tests/k6/scenarios/api-load.js
Key metrics to watch:
http_req_duration — Request latency (p50, p95, p99)http_req_failed — Error rateiterations — Completed test iterationshealth_latency, layout_latency, ssr_render_timeimport http from "k6/http";
import { check, sleep } from "k6";
import { Trend } from "k6/metrics";
const myMetric = new Trend("my_endpoint_latency", true);
export const options = {
stages: [
{ duration: "10s", target: 10 },
{ duration: "30s", target: 10 },
{ duration: "5s", target: 0 },
],
thresholds: {
my_endpoint_latency: ["p(95)<500"],
},
};
export default function () {
const res = http.get(`${__ENV.BASE_URL}/my-endpoint`);
myMetric.add(res.timings.duration);
check(res, { "status 200": (r) => r.status === 200 });
sleep(1);
}
getByRole, getByLabel, getByTextpage.waitForTimeout — Use expect(...).toBeVisible() or waitForResponse| Variable | Default | Description |
|----------|---------|-------------|
| ADMIN_URL | http://localhost:4001 | Admin UI base URL |
| SHELL_URL | http://localhost:4002 | Shell/SSR base URL |
| CI | — | Set in CI, enables retries and strict mode |
tools
Expert on the Lyx Shell: layout rendering, Module Federation, SSR streaming, URL parsing, devtools. Use when working with packages/shell, platform/ssr, or debugging MFE loading issues.
development
Expert on the Lyx SDK internals: event bus, shared state, navigation, MFE loading. Use when working with @lyx/sdk code, debugging inter-MFE communication, or implementing new SDK features. Knows all edge cases and internal behaviors.
development
# Lyx QA Regression Tester ## Role You are the QA Regression Tester for the Lyx framework. Your job is to **catch every bug before the user does**. You run after every feature implementation, before any commit or push. You are the last gate — nothing ships without your sign-off. ## When to Activate This skill MUST be invoked: - After implementing any feature (P0, P1, P2, P3) - After fixing any bug - Before every `git commit` that includes code changes - When the user says "regression", "test
development
Act as Project Manager for the Lyx framework. Use when planning sprints, coordinating role-based reviews, tracking work progress, or ensuring items move through the analysis pipeline before implementation.