Skip to content

test: add e2e tests for pages under tools dropdown#5061

Open
anushkaaaaaaaa wants to merge 2 commits intoasyncapi:masterfrom
anushkaaaaaaaa:toolsPage-fixes
Open

test: add e2e tests for pages under tools dropdown#5061
anushkaaaaaaaa wants to merge 2 commits intoasyncapi:masterfrom
anushkaaaaaaaa:toolsPage-fixes

Conversation

@anushkaaaaaaaa
Copy link
Copy Markdown
Contributor

@anushkaaaaaaaa anushkaaaaaaaa commented Feb 2, 2026

Description

  • I have added e2e tests in cypress for generator, modelina, Github Actions and CLI pages under Tools Dropdown.

Related issue(s)

Summary by CodeRabbit

  • Tests
    • Expanded test coverage for AsyncAPI tools pages including CLI, Generator, Modelina, and Parsers.
    • Updated specification version references in test fixtures from v3.1.0 to v3.0.0.
    • Refined test descriptions for improved clarity and consistency.
    • Consolidated test infrastructure with shared reusable components for improved maintainability.

Signed-off-by: Anushka Sharan <anushkasharan05@gmail.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 2, 2026

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit e9f335c
🔍 Latest deploy log https://app.netlify.com/projects/asyncapi-website/deploys/69805dabf5cf920007013f46
😎 Deploy Preview https://deploy-preview-5061--asyncapi-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 2, 2026

📝 Walkthrough

Walkthrough

This pull request refactors the Cypress test infrastructure by introducing a new BasePage base class with reusable page object methods, updating multiple page objects to extend this base, adding new fixture files for tools and documentation data, and introducing five new end-to-end test suites for tool pages (CLI, Generator, GitHub Actions, Modelina, Parsers).

Changes

Cohort / File(s) Summary
Base Page Infrastructure
cypress/pages/BasePage.js, cypress/pages/BaseHeaderPage.js, cypress/pages/BasePageTools.js, cypress/pages/basepagedocs.js
New BasePage class added with reusable helpers (visit, getElement, hoverElement, verifyHeadingExists, verifyLink, etc.). Existing base page files updated: visit() method signatures changed to accept no parameters and always navigate to '/'. Minor formatting adjustments in element chaining.
Fixture Files
cypress/fixtures/docsSections.json, cypress/fixtures/toolsPages.json
Added new toolsPages.json with tool configuration data (generator, cli, parsers, githubActions, modelina). Updated docsSections.json: Specification version changed from v3.1.0 to v3.0.0.
Test Description Updates
cypress/docspage.cy.js, cypress/header.cy.js
Updated test descriptions in docspage.cy.js to use "verifying" language. Updated header.cy.js test titles. Updated card href in docspage.cy.js from v3.1.0-explorer to v3.0.0-explorer.
Page Objects Refactoring
cypress/pages/BlogPage.js, cypress/pages/CaseStudiesPage.js, cypress/pages/CommunityPage.js, cypress/pages/RoadmapPage.js, cypress/pages/ToolsPage.js, cypress/pages/homepage.js, cypress/pages/Footer.js
Multiple page objects updated to extend BasePage. verifyPageLoaded() methods replaced with calls to this.verifyHeadingExists(). ToolsPage simplified: three specialized link verification methods removed, replaced with generalized verifyToolLink(). Footer.js updated to filter for first visible element. homepage.js refactored to return Cypress chains for method chaining.
New Tool Page Objects
cypress/pages/toolsGenerator.js, cypress/pages/toolsModelina.js
Added new page object classes extending BasePage. ToolsGenerator includes verifyGeneratorWorkflowDiagram(). ToolsModelina includes verifyTryItNowLink() and verifyInstallSnippet(). Both use fixture data from toolsPages.json.
New Tool Test Suites
cypress/tools_cli.cy.js, cypress/tools_generator.cy.js, cypress/tools_github_actions.cy.js, cypress/tools_modelina.cy.js, cypress/tools_parsers.cy.js
Five new end-to-end test files added for tool pages. Each suite tests header visibility, link verification (GitHub/Docs/Website as applicable), and tool-specific verifications (install snippet, workflow diagram, try-it link). All use fixture data from toolsPages.json.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~35 minutes

Poem

🐰 Hop along with tests refactored true,
BasePage's helpers make pages brand new!
Fixtures and tools in harmony sing,
Five test suites hop—what joy they bring!
Reusable, clean, inheritance's way,
Testing gets better with each passing day! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title directly aligns with the main objective: adding end-to-end tests for tools dropdown pages (Generator, Modelina, GitHub Actions, CLI). The title is clear, concise, and accurately describes the primary change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (229d0b9) to head (e9f335c).
⚠️ Report is 84 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #5061   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           22        22           
  Lines          796       796           
  Branches       146       146           
=========================================
  Hits           796       796           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@asyncapi-bot
Copy link
Copy Markdown
Contributor

asyncapi-bot commented Feb 2, 2026

⚡️ Lighthouse report for the changes in this PR:

Category Score
🔴 Performance 37
🟢 Accessibility 98
🟢 Best practices 92
🟢 SEO 100
🔴 PWA 33

Lighthouse ran on https://deploy-preview-5061--asyncapi-website.netlify.app/

Copy link
Copy Markdown
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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
cypress/docspage.cy.js (1)

32-47: ⚠️ Potential issue | 🔴 Critical

Critical: Nested it() blocks are invalid in Mocha/Cypress.

The it('verifying Card Links present on the Docs Page') test at line 32 is nested inside the it('verifying navigation to SideBar') test starting at line 15. Mocha does not support nested it() blocks—this inner test will be silently skipped and never executed.

The inner test should be moved outside to be a sibling test case.

🐛 Proposed fix to extract the nested test
     docsPage.goToMigrationsSection();
     docsPage.goToCommunitySection();
+  });
 
-    it('verifying Card Links present on the Docs Page', () => {
-      const cards = [
-        { href: '/docs/concepts' },
-        { href: '/docs/tutorials' },
-        { href: '/docs/guides' },
-        { href: '/docs/tools' },
-        { href: '/docs/reference' },
-        { href: '/docs/migration' },
-        { href: '/docs/community' },
-        { href: '/docs/reference/specification/v3.0.0-explorer' },
-      ];
+  it('verifying Card Links present on the Docs Page', () => {
+    const cards = [
+      { href: '/docs/concepts' },
+      { href: '/docs/tutorials' },
+      { href: '/docs/guides' },
+      { href: '/docs/tools' },
+      { href: '/docs/reference' },
+      { href: '/docs/migration' },
+      { href: '/docs/community' },
+      { href: '/docs/reference/specification/v3.0.0-explorer' },
+    ];
 
-      cards.forEach((card) => {
-        docsPage.verifyCardLinks(card.href);
-      });
+    cards.forEach((card) => {
+      docsPage.verifyCardLinks(card.href);
     });
-  });
+  });
 });
cypress/pages/BaseFooterPage.js (1)

1-14: ⚠️ Potential issue | 🟠 Major

Naming conflict: This file exports BasePage but a new BasePage class exists in BasePage.js.

This file (BaseFooterPage.js) exports a class named BasePage, but there's now a separate cypress/pages/BasePage.js that also exports BasePage. This creates ambiguity:

  • Imports like import BasePage from './BasePage' will resolve to the new file
  • This file's class name doesn't match its filename (BaseFooterPage.js vs class BasePage)

Consider renaming this class to BaseFooterPage to match the filename and avoid confusion with the new BasePage.

Proposed fix
-class BasePage {
+class BaseFooterPage {
   visit() {
     cy.visit('/');
   }
   // ...
 }
 
-export default BasePage;
+export default BaseFooterPage;
🤖 Fix all issues with AI agents
In `@cypress/fixtures/toolsPages.json`:
- Line 6: Update the GitHub URLs in the fixtures so they use the canonical
hostname without the www prefix: replace occurrences like the "github" value
"https://www.github.com/asyncapi/generator" with
"https://github.com/asyncapi/generator" and apply the same replacement to the
other "github" entries in this JSON fixture (the other values that currently use
"https://www.github.com/..."). Ensure all "github" keys in the JSON use URLs
starting with "https://github.com/".
🧹 Nitpick comments (2)
cypress/tools_generator.cy.js (1)

1-5: Inconsistent class naming convention.

The class toolsGenerator uses camelCase, which is inconsistent with JavaScript class naming conventions and with ToolsModelina used in tools_modelina.cy.js. Classes should use PascalCase.

♻️ Proposed fix for naming consistency
-import toolsGenerator from './pages/toolsGenerator';
+import ToolsGenerator from './pages/toolsGenerator';
 import toolsData from './fixtures/toolsPages.json';

 describe('Tools - Generator Page', () => {
-  const page = new toolsGenerator();
+  const page = new ToolsGenerator();

Note: This also requires renaming the export in cypress/pages/toolsGenerator.js to ToolsGenerator.

cypress/pages/homepage.js (1)

66-68: Minor inconsistency: consider using inherited helper for consistency.

Other methods in this class use this.verifyElementIsVisible() (lines 54, 63), but this method uses cy.get().should() directly. For consistency with the refactor pattern:

♻️ Optional: Use inherited helper
   verifyReadTheDocsButton(link = readDocsLink) {
-    return cy.get(`[data-testid="Button-link"][href="${link}"]`).should('be.visible');
+    return this.verifyElementIsVisible(`[data-testid="Button-link"][href="${link}"]`);
   }

"path": "/tools/generator",
"heading": "Docs, Code, Anything!",
"image": "generator diagram",
"github": "https://www.github.com/asyncapi/generator",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Consider using canonical GitHub URLs without www.

The GitHub URLs use www.github.com (e.g., https://www.github.com/asyncapi/generator), but the canonical GitHub URL format is https://github.com/... without the www prefix. If the actual links on the pages use the canonical format, these assertions may fail.

Proposed fix
-        "github": "https://www.github.com/asyncapi/generator",
+        "github": "https://github.com/asyncapi/generator",

Apply similar changes to lines 13, 20, 25, and 35.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"github": "https://www.github.com/asyncapi/generator",
"github": "https://github.com/asyncapi/generator",
🤖 Prompt for AI Agents
In `@cypress/fixtures/toolsPages.json` at line 6, Update the GitHub URLs in the
fixtures so they use the canonical hostname without the www prefix: replace
occurrences like the "github" value "https://www.github.com/asyncapi/generator"
with "https://github.com/asyncapi/generator" and apply the same replacement to
the other "github" entries in this JSON fixture (the other values that currently
use "https://www.github.com/..."). Ensure all "github" keys in the JSON use URLs
starting with "https://github.com/".

@anshgoyalevil anshgoyalevil added the gsoc This label should be used for issues or discussions related to ideas for Google Summer of Code label Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gsoc This label should be used for issues or discussions related to ideas for Google Summer of Code

Projects

Status: To Be Triaged

Development

Successfully merging this pull request may close these issues.

3 participants