Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(tests): Improve E2E Documentation #16909

Merged
merged 3 commits into from
Nov 18, 2024
Merged

chore(tests): Improve E2E Documentation #16909

merged 3 commits into from
Nov 18, 2024

Conversation

svanaeinars
Copy link
Member

@svanaeinars svanaeinars commented Nov 15, 2024

Summary by CodeRabbit

  • Documentation
    • Enhanced clarity and organization of the E2E Testing Library documentation.
    • Updated title and introductory description to better reflect library features.
    • Improved section headers and readability, including a new "🚀 How to Use This Library" section.
    • Clarified command structure for running tests in different modes.
    • Expanded Mockoon usage guide and troubleshooting section for better user support.

@svanaeinars svanaeinars requested a review from a team as a code owner November 15, 2024 16:22
Copy link
Contributor

coderabbitai bot commented Nov 15, 2024

Walkthrough

The pull request includes significant updates to the documentation of the E2E Testing Library. Changes include a new title, refined section headers, and a restructured usage guide. The documentation now emphasizes shared configurations and multi-environment testing support. Additionally, the Mockoon usage guide has been clarified, and the troubleshooting section has been expanded to address common issues. Overall, the modifications aim to enhance clarity and organization for better usability.

Changes

Files Change Summary
libs/testing/e2e/README.md Updated title to "E2E Testing Library," revised introductory description, improved section headers, restructured usage guide, clarified command structure, and enhanced Mockoon usage guide and troubleshooting section.

Possibly related PRs

Suggested labels

automerge

Suggested reviewers

  • eirikurn
  • oddsson

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (4)
libs/testing/e2e/README.md (4)

7-11: Enhance visual consistency in Contents section

Consider using consistent emoji placement in the Contents section headers to match the document's style:

 ### Contents

-• **🔧 Helper Functions**: Utility functions to simplify and standardize E2E testing across apps.
-• **⚙️ Shared Playwright Configuration**: A common configuration used as the base for all app-specific Playwright configurations.
-• **🌍 Multi-Environment Testing**: Support for running tests in `local`, `dev`, `staging`, and `prod` environments.
+• **Helper Functions** 🔧: Utility functions to simplify and standardize E2E testing across apps.
+• **Shared Playwright Configuration** ⚙️: A common configuration used as the base for all app-specific Playwright configurations.
+• **Multi-Environment Testing** 🌍: Support for running tests in `local`, `dev`, `staging`, and `prod` environments.

49-85: Improve command descriptions readability

Consider varying the sentence structure to avoid repetitive beginnings and make the documentation more engaging:

-• **Run with UI Mode**: Launch the tests with a UI to select and debug tests interactively.
-• **Run Tests Without Caching**: Ensure a fresh run of tests without using cached results.
-• **Run a Specific Project**: Run only the tests defined under a specific project in your Playwright config:
-• **View the Test Report**: After running tests, use this command to view the generated report:
-• **Run Specific Tests**: Use `--grep` to run tests matching a specific pattern:
-• **Debug Mode**: Run tests in debug mode for better visibility:

+• **UI Mode** 🖥️: Launch tests with an interactive UI for selection and debugging.
+• **Fresh Run** 🔄: Execute tests without using cached results.
+• **Project Selection** 📂: Execute tests from specific projects in your Playwright config:
+• **Report Viewer** 📊: Display the generated test report.
+• **Pattern Matching** 🔍: Execute tests matching specific patterns using `--grep`.
+• **Debugging** 🐛: Enable debug mode for enhanced visibility during test execution.
🧰 Tools
🪛 LanguageTool

[style] ~61-~61: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...e --skip-nx-cache ``` - Run a Specific Project: Run only the test...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


95-96: Fix grammatical issues in the writing guide

Apply these corrections to improve readability:

-You should therefore aim to write test for:
+You should therefore aim to write a test for:

-Each test case (`test`) should test a specific scenario from end-to-end. If your test is getting long and complicated consider breaking it up within a `test` with `test.step`
+Each test case (`test`) should test a specific scenario from end-to-end. If your test is getting long and complicated, consider breaking it up within a `test` with `test.step`

Also applies to: 142-143

🧰 Tools
🪛 LanguageTool

[uncategorized] ~95-~95: Possible missing article found.
Context: ...ses. You should therefore aim to write test for: - Most common usage patterns - Us...

(AI_HYDRA_LEO_MISSING_A)


197-197: Standardize placeholder format

For consistency with other placeholders in the documentation, update the port placeholder:

-yarn mockoon-cli start --data ./apps/<app>/e2e/mocks/<app-mock>.json --port <port>
+yarn mockoon-cli start --data ./apps/<app>/e2e/mocks/<app-mock>.json --port <port-number>
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 9d63937 and b1248b5.

📒 Files selected for processing (1)
  • libs/testing/e2e/README.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
libs/testing/e2e/README.md (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
🪛 LanguageTool
libs/testing/e2e/README.md

[style] ~61-~61: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...e --skip-nx-cache ``` - Run a Specific Project: Run only the test...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[uncategorized] ~95-~95: Possible missing article found.
Context: ...ses. You should therefore aim to write test for: - Most common usage patterns - Us...

(AI_HYDRA_LEO_MISSING_A)


[uncategorized] ~142-~142: Possible missing comma found.
Context: ...o-end. If your test is getting long and complicated consider breaking it up within a test...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~142-~142: ‘in succession’ might be wordy. Consider a shorter alternative.
Context: ...twithtest.step`; each step will run in succession and the failure/success report is easie...

(EN_WORDINESS_PREMIUM_IN_SUCCESSION)


[typographical] ~166-~166: It appears that a comma is missing.
Context: ...ter the basic page has loaded. In such cases you can wait for the elements to exist ...

(DURING_THAT_TIME_COMMA)

🔇 Additional comments (1)
libs/testing/e2e/README.md (1)

200-215: LGTM! Well-organized troubleshooting section

The troubleshooting section is comprehensive and well-structured, with clear error descriptions and solutions.

libs/testing/e2e/README.md Outdated Show resolved Hide resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@svanaeinars svanaeinars added the automerge Merge this PR as soon as all checks pass label Nov 18, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (5)
libs/testing/e2e/README.md (5)

30-34: Add parameter documentation for configuration options

Consider adding JSDoc comments to document the expected parameters in the configuration example:

 const playwrightConfig = createPlaywrightConfig({
+  /** URL where the web server will be started for testing */
   webServerUrl: '<web-server-url>',
+  /** Command to start the web server */
   command: '<command>',
   // Add any app-specific configurations here
 })

41-45: Enhance command structure explanation

To improve readability and avoid repetition, consider restructuring the command explanation:

-Use the following command structure to run tests for any app:
-
-```bash
-yarn e2e <app-name>
-```
+The base command structure for running tests is:
+
+```bash
+yarn e2e <app-name> [options]
+```
+
+Where `[options]` can be any of the flags described below.

142-143: Fix grammatical issues in test description

The sentence structure needs improvement:

-Each test case (`test`) should test a specific scenario from end-to-end. If your test is getting long and complicated consider breaking it up within a `test` with `test.step`; each step will run in succession and the failure/success report is easier to read.
+Each test case (`test`) should test a specific scenario from end-to-end. If your test is getting long and complicated, consider breaking it up within a `test` with `test.step`. Each step will run sequentially, making the failure/success report easier to read.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~142-~142: Possible missing comma found.
Context: ...o-end. If your test is getting long and complicated consider breaking it up within a test...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~142-~142: ‘in succession’ might be wordy. Consider a shorter alternative.
Context: ...twithtest.step`; each step will run in succession and the failure/success report is easie...

(EN_WORDINESS_PREMIUM_IN_SUCCESSION)


192-197: Add environment variable configuration note

Consider adding information about environment variables that might be needed for the mock server:

### 🖥️ Running Mockoon Server with CLI

To start a mock server:

```bash
yarn mockoon-cli start --data ./apps/<app>/e2e/mocks/<app-mock>.json --port <port>

+Note: You may need to configure environment variables in your mock file for different testing environments (local, staging, etc.).


---

`202-206`: **Enhance error categorization**

Consider categorizing errors by their source/type for better navigation:

```diff
-### 🔄 Common Issues
+### 🔄 Common Issues by Category
+
+#### Network Issues
+- **💀 ESOCKETTIMEDOUT**: Likely an infrastructure issue. Reach out to DevOps if persistent.
+
+#### Server Issues
+- **500: Internal Server Error**: If not related to your code, contact the DevOps team.
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between b1248b5 and 1e18fed.

📒 Files selected for processing (1)
  • libs/testing/e2e/README.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
libs/testing/e2e/README.md (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
🪛 LanguageTool
libs/testing/e2e/README.md

[style] ~61-~61: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...e --skip-nx-cache ``` - Run a Specific Project: Run only the test...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[uncategorized] ~142-~142: Possible missing comma found.
Context: ...o-end. If your test is getting long and complicated consider breaking it up within a test...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~142-~142: ‘in succession’ might be wordy. Consider a shorter alternative.
Context: ...twithtest.step`; each step will run in succession and the failure/success report is easie...

(EN_WORDINESS_PREMIUM_IN_SUCCESSION)


[typographical] ~166-~166: It appears that a comma is missing.
Context: ...ter the basic page has loaded. In such cases you can wait for the elements to exist ...

(DURING_THAT_TIME_COMMA)

🔇 Additional comments (1)
libs/testing/e2e/README.md (1)

1-11: Well-structured introduction and overview!

The introduction and overview sections are clear, well-organized, and effectively use emojis for visual separation of sections.

Copy link
Member

@AndesKrrrrrrrrrrr AndesKrrrrrrrrrrr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly a port from apps/system-e2e/README.md, with mockoon merged?

LGTM

Copy link

codecov bot commented Nov 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.46%. Comparing base (b19bea9) to head (387960d).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #16909   +/-   ##
=======================================
  Coverage   36.46%   36.46%           
=======================================
  Files        6903     6903           
  Lines      144575   144575           
  Branches    41282    41282           
=======================================
  Hits        52715    52715           
  Misses      91860    91860           
Flag Coverage Δ
api 3.34% <ø> (ø)
application-system-api 41.02% <ø> (ø)
application-template-api-modules 27.70% <ø> (-0.02%) ⬇️

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


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cbecc81...387960d. Read the comment docs.

@kodiakhq kodiakhq bot merged commit aab5c31 into main Nov 18, 2024
52 checks passed
@kodiakhq kodiakhq bot deleted the chore/improve-e2e-docs branch November 18, 2024 13:26
jonnigs pushed a commit that referenced this pull request Nov 26, 2024
* chore(tests): Improve E2E Documentation

* Update libs/testing/e2e/README.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants