Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

test: create cursor rules for automated tests

Open jessicaschelly opened this issue 8 months ago • 4 comments

Add Cursor AI Rules for QA Testing

What this does

Sets up Cursor AI rules to standardize our Playwright tests and manual test case writing.

Files added

  • playwright.mdc - Rules for writing automated e2e tests
  • test-cases.mdc - Rules for creating manual test cases

Key changes

For Playwright tests:

  • Usage of semantic locators
  • Follow Page Object pattern
  • Proper setup/teardown with beforeAll/afterAll hooks
  • Consistent TypeScript style

For manual test cases:

  • Standard markdown format everyone can follow
  • Clear test types (API, E2E, Unit)
  • Steps that are easy to automate later

Why this matters

It aims to make tests more consistent and easier to maintain.

How to use

Since these are manual rules, you need to reference them in Cursor:

  • For Playwright tests: @playwright.mdc
  • For manual test cases: @test-cases.mdc

Just add the @ reference in your Cursor chat when working on tests.

Next Steps

  • Improve rules to help with Unit and API tests
  • Create copilot rules

jessicaschelly avatar May 26 '25 13:05 jessicaschelly

Looks like this PR is ready to merge! 🎉 If you have any trouble, please check the PR guidelines

dionisio-bot[bot] avatar May 26 '25 13:05 dionisio-bot[bot]

⚠️ No Changeset found

Latest commit: ead03265e88841e2acf2102057978d01a08ea306

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar May 26 '25 13:05 changeset-bot[bot]

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 66.58%. Comparing base (276c270) to head (ead0326). :warning: Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #36075    +/-   ##
=========================================
  Coverage    66.58%   66.58%            
=========================================
  Files         3346     3348     +2     
  Lines       114666   114643    -23     
  Branches     21100    21277   +177     
=========================================
- Hits         76345    76338     -7     
- Misses       35623    35624     +1     
+ Partials      2698     2681    -17     
Flag Coverage Δ
e2e 57.79% <ø> (+0.01%) :arrow_up:
unit 71.22% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar May 26 '25 13:05 codecov[bot]

PR Preview Action v1.6.2 :---: |

:rocket: View preview at
https://RocketChat.github.io/Rocket.Chat/pr-preview/pr-36075/

|
Built to branch gh-pages at 2025-07-11 15:06 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

github-actions[bot] avatar May 26 '25 13:05 github-actions[bot]

Walkthrough

Adds a comprehensive JSON dataset of Rocket.Chat test suites/cases and two Cursor AI rule documents: one for Playwright end-to-end test development and one for manual test case creation. No executable code or public API signatures are modified.

Changes

Cohort / File(s) Summary
Test dataset (E2E/manual cases)
.cursor/files/test-cases.json
Introduces nested test suites and cases (IDs, titles, preconditions, steps with actions/expectations/data, metadata like priority/severity/type/status/tags/params). Covers LDAP, Admin/Login, Settings/Accounts/Registration, Messages, Chat scenarios.
Cursor rules (authoring standards)
.cursor/rules/playwright.mdc, .cursor/rules/test-cases.mdc
Adds AI rules: Playwright E2E test guidelines (structure, locators, fixtures, assertions, POM, paths) and manual test case creation standards (Markdown template, required fields, types, reference linkage to test-cases.json).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I twitch my whiskers, tap-tap keys,
New tests in burrows, JSON trees.
Rules to hop through Playwright fields,
And markdown maps for manual yields.
With suites and steps, I bound—no fret,
A tidy warren of QA net.
🥕✅

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "test: create cursor rules for automated tests" is concise and directly reflects the primary change in the PR—adding Cursor rules for Playwright automated tests—using a clear conventional-commit style. It aligns with the changeset content and is relevant for teammates scanning history, though it does not explicitly mention the added manual test-case rule and the test-cases.json fixture; that omission does not render the title misleading. Overall the title is clear, specific enough, and appropriate as a short summary of the main change.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment
  • [ ] Commit unit tests in branch test/create-cursor-rules-automated-tests

[!TIP]

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Sep 16 '25 18:09 coderabbitai[bot]