Skip to content

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

Merged
princerajpoot20 merged 42 commits intoasyncapi:masterfrom
anushkaaaaaaaa:toolsPage
Feb 7, 2026
Merged

test: add e2e tests for pages under tools dropdown#4533
princerajpoot20 merged 42 commits intoasyncapi:masterfrom
anushkaaaaaaaa:toolsPage

Conversation

@anushkaaaaaaaa
Copy link
Contributor

@anushkaaaaaaaa anushkaaaaaaaa commented Nov 4, 2025

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

    • Added end-to-end tests for multiple Tools pages (Generator, Modelina, CLI, GitHub Actions, Parsers) and updated several test titles for clarity
    • Tests now driven by a new fixture containing tool page data
  • Refactor

    • Introduced a shared base page pattern and updated page objects to use common verification helpers and enable chaining
  • Chores

    • Standardized navigation helpers and streamlined some link/footer assertion checks

@netlify
Copy link

netlify bot commented Nov 4, 2025

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 22b6a55
🔍 Latest deploy log https://app.netlify.com/projects/asyncapi-website/deploys/69876e88bfa6a60008fed7b1
😎 Deploy Preview https://deploy-preview-4533--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
Contributor

coderabbitai bot commented Nov 4, 2025

📝 Walkthrough

Walkthrough

Introduces a centralized Cypress BasePage with common helpers, updates many page objects to extend it, standardizes visit/link helpers, adds fixtures for tools, adds several new tools page objects and new E2E tests, and consolidates link verification into a generalized method.

Changes

Cohort / File(s) Summary
Base infrastructure & helpers
cypress/pages/BasePage.js, cypress/pages/BaseHeaderPage.js, cypress/pages/BasePageTools.js, cypress/pages/basepagedocs.js, cypress/pages/BaseFooterPage.js
Adds BasePage with common helpers (visit, getElement, hoverElement, verifyElementIsVisible, verifyHeadingExists, verifyLink, verifyImageVisible, etc.). Several base/header/footer variants had their visit() signatures changed to parameterless root visits and small assertion-chain style adjustments.
Refactored page objects
cypress/pages/homepage.js, cypress/pages/ToolsPage.js, cypress/pages/BlogPage.js, cypress/pages/CaseStudiesPage.js, cypress/pages/CommunityPage.js, cypress/pages/RoadmapPage.js, cypress/pages/Footer.js
Many page objects now extend BasePage and delegate direct DOM assertions to base helpers (e.g., replace cy.contains('h1', ..) with verifyHeadingExists). ToolsPage consolidates link helpers into verifyToolLink; Footer filters visible links before scoping. Several redundant helper methods removed.
New tools page objects
cypress/pages/toolsGenerator.js, cypress/pages/toolsModelina.js
Adds page objects for Generator and Modelina extending BasePage with tool-specific verifications (generator image visibility, try-it link, install snippet checks).
New E2E tests — tools
cypress/tools_generator.cy.js, cypress/tools_modelina.cy.js, cypress/tools_cli.cy.js, cypress/tools_parsers.cy.js, cypress/tools_github_actions.cy.js
Adds test suites that use fixtures and page objects to verify headings, links, install snippets, and buttons for individual tools pages; each suite navigates using fixture paths and asserts link targets and visible snippets.
Fixtures
cypress/fixtures/toolsPages.json
Adds fixture containing paths, headings, links, install snippets, and try-it metadata for multiple tools (generator, cli, parsers, githubActions, modelina).
Test updates & wording
cypress/docspage.cy.js, cypress/header.cy.js, cypress/toolspage.cy.js
Minor test title wording changes. toolspage.cy.js switched from three specific link helpers to the consolidated verifyToolLink(href, heading, type) usage.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Poem

🐇 I hoppity-hop through fixtures and test,

I tie link checks with a tidy jest.
New pages, new helpers, all set to run,
The rabbit smiles — the refactor's done. ✨

🚥 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 'test: add e2e tests for pages under tools dropdown' directly and clearly summarizes the main change in the changeset: adding end-to-end Cypress tests for multiple tool pages (Generator, Modelina, CLI, GitHub Actions).
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.

@anushkaaaaaaaa anushkaaaaaaaa changed the title Tools page test: add e2e tests for pages under tools dropdown Nov 4, 2025
@codecov
Copy link

codecov bot commented Nov 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (ea29f6a) to head (22b6a55).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #4533   +/-   ##
=========================================
  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
Contributor

asyncapi-bot commented Nov 4, 2025

⚡️ 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-4533--asyncapi-website.netlify.app/

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

🧹 Nitpick comments (2)
cypress/pages/toolsGenerator.js (1)

6-8: Extract duplicated helper to reduce code duplication.

The verifyHeadingExists method is duplicated identically in toolsModelina.js (lines 6-8) and toolsMisc.js (lines 14-16). Consider extracting this to a base page class or a shared helper module.

Example approach - create a base page class:

// cypress/pages/basePage.js
class BasePage {
  verifyHeadingExists(text) {
    cy.contains('h1, h2, h3, h4, h5, h6', text).should('be.visible');
  }
}

export default BasePage;

Then extend it:

+import BasePage from './basePage';
+
-class ToolsGeneratorPage {
+class ToolsGeneratorPage extends BasePage {
   visit() {
     cy.visit('/tools/generator');
   }

-  verifyHeadingExists(text) {
-    cy.contains('h1, h2, h3, h4, h5, h6', text).should('be.visible');
-  }
-
   verifyHeader() {
     this.verifyHeadingExists('Docs, Code, Anything!');
   }
cypress/pages/toolsModelina.js (1)

26-28: Consider using 'be.visible' for stronger assertion.

The assertion uses .should('exist') which only checks DOM presence. For e2e tests, .should('be.visible') provides stronger verification that users can actually see the install snippet.

Apply this change (and similarly in toolsMisc.js lines 38, 53):

 verifyInstallSnippet() {
-  cy.contains('code', 'npm install @asyncapi/modelina').should('exist');
+  cy.contains('code', 'npm install @asyncapi/modelina').should('be.visible');
 }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b4bdd8b and a41b39e.

📒 Files selected for processing (6)
  • cypress/pages/toolsGenerator.js (1 hunks)
  • cypress/pages/toolsMisc.js (1 hunks)
  • cypress/pages/toolsModelina.js (1 hunks)
  • cypress/tools_generator.cy.js (1 hunks)
  • cypress/tools_misc.cy.js (1 hunks)
  • cypress/tools_modelina.cy.js (1 hunks)
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Redirect rules - asyncapi-website
  • GitHub Check: Header rules - asyncapi-website
  • GitHub Check: Pages changed - asyncapi-website
🔇 Additional comments (6)
cypress/tools_generator.cy.js (2)

1-8: LGTM! Clean test setup.

The test file follows Cypress best practices with proper page object instantiation and beforeEach hook for navigation.


10-24: LGTM! Well-structured test cases.

The test cases are focused and follow the single-responsibility principle, making them easy to maintain and debug.

cypress/tools_modelina.cy.js (1)

1-25: LGTM! Consistent test structure.

This test file follows the same pattern as the other tools tests, maintaining consistency across the test suite.

cypress/tools_misc.cy.js (1)

1-56: LGTM! Well-organized test suite.

The use of nested describe blocks effectively organizes tests for multiple related pages, making the test suite easy to navigate and maintain.

cypress/pages/toolsMisc.js (1)

1-72: LGTM! Well-organized multi-page page object.

The clear separation of methods with comments for each page (CLI, Parsers, GitHub Actions) makes this page object easy to navigate and maintain.

cypress/pages/toolsGenerator.js (1)

18-22: The review comment is based on incorrect assumptions and should be disregarded.

The tests are actually correct in expecting https://www.github.com/ URLs because the source code in pages/tools/generator.tsx (line 25) and related tool pages explicitly use this format. The tests are properly validating what the page actually renders.

While www.github.com redirects to github.com (the canonical form), both URLs are functional. If using canonical GitHub URLs is a goal, the fix should be in the source code files (pages/tools/*.tsx), not in the test expectations (cypress/pages/*.js). The tests are doing their job correctly—they verify the rendered output matches the href attributes in the actual source components.

Likely an incorrect or invalid review comment.

Copy link
Member

@princerajpoot20 princerajpoot20 left a comment

Choose a reason for hiding this comment

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

@anushkaaaaaaaa
Please have a look at the review comments.

I stopped reviewing the PR in between, for the reason I mentioned in the review above: there are major changes that need to be done across all the open PRs you have so far (#4551, #4548, #4533, #4244, #4215).

Hence, I thought there was no point in continuing the review as there are major changes required. Ping me once you are done with all the changes in all those open PRs. I will then give another review.

Also, I am not sure if you have the same pattern in the previous PRs that you have already merged. But please review all your work, regardless of whether it is merged. We can still fix it easily. It will be difficult at a later stage. We should not have so much repetition in functions. This violates the DRY principle and will make the code very difficult to maintain in the long run. Adding a simple test will require a lot of repetitive work, and we don’t want to reach that state.

Thanks.

@@ -0,0 +1,31 @@
class ToolsGeneratorPage {
Copy link
Member

Choose a reason for hiding this comment

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

Nit: consider naming class consistently with file name. Reivew these naming in all the files

cy.visit('/tools/generator');
}

verifyHeadingExists(text) {
Copy link
Member

Choose a reason for hiding this comment

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

VerifyHeadingExists is duplicated across multiple pages in this PR and also in the all the other PRs you have raised.

Consider extracting it into a shared base helper to keep things DRY and easier to maintain.

Copy link
Member

Choose a reason for hiding this comment

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

@princerajpoot20 can you please elaborate this more
I didn't get it

Copy link
Member

Choose a reason for hiding this comment

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

@sambhavgupta0705 This verifyHeadingExists function is duplicated in every file. It repeats the same logic again and again across multiple files and multiple PRs of @anushkaaaaaaaa. We need to remove this duplication and keep the code DRY.

Comment on lines 14 to 16
verifyMainImage() {
cy.get('img[alt="generator diagram"]').should('be.visible');
}
Copy link
Member

Choose a reason for hiding this comment

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

consider asserting more strongly like src is non-empty. also please review the naming of function. What do you mean by mainImage?

}

verifyHeadingExists(text) {
cy.contains('h1, h2, h3, h4, h5, h6', text).should('be.visible');
Copy link
Member

Choose a reason for hiding this comment

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

as mentioned earlier. please follow DRY principle

Comment on lines 3 to 11
cy.visit('/tools/cli');
}

visitParsers() {
cy.visit('/tools/parsers');
}

visitGithubActions() {
cy.visit('/tools/github-actions');
Copy link
Member

Choose a reason for hiding this comment

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

Please review these dedicated visit() methods that are everywhere. They are repeating the same stuff everywhere. Consider using a single helper like visit(path). This reduces repetition and makes your code DRY.

Please review all the methods in all the tests you have added via multiple PRs you have opened right now. If they can be extracted out into shared functions, it will make them reusable and keep the code DRY.

Comment on lines 19 to 35
verifyCliHeader() {
this.verifyHeadingExists(
'Interact with AsyncAPI from the comfort of your CLI',
);
}

verifyCliGithubLink() {
cy.contains('a', 'View on Github')
.should('be.visible')
.and('have.attr', 'href', 'https://www.github.com/asyncapi/cli');
}

verifyCliDocsLink() {
cy.contains('a', 'View Docs')
.should('be.visible')
.and('have.attr', 'href', '/docs/tools/cli');
}
Copy link
Member

Choose a reason for hiding this comment

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

@anushkaaaaaaaa
As mentioned earlier,
all these can be removed. This is unnecessary repetition of code.
Make this a general function that takes parameters and move it to a shared folder so it can be used by everyone and you don’t have to write the same code again and again. Please refer to the DRY principle. This will make the code maintainable.

I have observed this across all your PRs that are open right now, so please review all your PRs for this.

Comment on lines 46 to 69
verifyParsersGithubLink() {
cy.contains('a', 'View on Github')
.should('be.visible')
.and('have.attr', 'href', 'https://www.github.com/asyncapi/parser-js');
}

verifyParsersInstallSnippet() {
cy.contains('code', 'npm install @asyncapi/parser').should('exist');
}

// GitHub Actions page checks
verifyGhActionsHeader() {
this.verifyHeadingExists('Automate using GitHub Actions');
}

verifyGhActionsGithubLink() {
cy.contains('a', 'View on Github')
.should('be.visible')
.and(
'have.attr',
'href',
'https://www.github.com/asyncapi/github-action-for-generator',
);
}
Copy link
Member

Choose a reason for hiding this comment

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

As mentioned above, you should avoid these and make a general function that takes parameters

}
}

export default ToolsMiscPage;
Copy link
Member

Choose a reason for hiding this comment

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

Please review this naming

Comment on lines 2 to 26
visit() {
cy.visit('/tools/modelina');
}

verifyHeadingExists(text) {
cy.contains('h1, h2, h3, h4, h5, h6', text).should('be.visible');
}

verifyHeader() {
this.verifyHeadingExists('Modelina');
}

verifyGithubLink() {
cy.contains('a', 'View on Github')
.should('be.visible')
.and('have.attr', 'href', 'https://www.github.com/asyncapi/modelina');
}

verifyTryItNowLink() {
cy.contains('a', 'Try it now')
.should('be.visible')
.and('have.attr', 'href', 'https://modelina.org/playground');
}

verifyInstallSnippet() {
Copy link
Member

Choose a reason for hiding this comment

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

I hope you are now able to understand the real benefit. If you had made general methods, you wouldn’t have to put repetitive effort into doing the same stuff. And most importantly, it makes the code maintainable.

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

🤖 Fix all issues with AI agents
In `@cypress/tools_modelina.cy.js`:
- Around line 15-21: Update the two test case description strings to use
consistent capitalization and fix the typo: change the first it(...) title from
'verifying install snippet' to 'Verifying install snippet' and change the second
it(...) title from 'Verifiying the GitHub button link' to 'Verifying the GitHub
button link'; these are the human-readable names passed to the it(...) blocks
that wrap calls to page.verifyElementContainsText and page.verifyButtonLink,
respectively.
🧹 Nitpick comments (3)
cypress/pages/Footer.js (1)

10-12: Assert a single visible footer instead of silently picking the first.
Selecting .first() can mask regressions where multiple visible footers appear. Consider asserting exactly one visible footer (or use a more specific selector/data-testid).

♻️ Suggested tweak
-    cy.get(this.footerSelector).filter(':visible').first().within(() => {
+    cy.get(this.footerSelector)
+      .filter(':visible')
+      .should('have.length', 1)
+      .first()
+      .within(() => {
       this.verifyLink(href, text, attr);
     });
cypress/tools_generator.cy.js (1)

1-5: Inconsistent class naming convention.

The import and instantiation use camelCase (toolsGenerator), while other similar test files in this PR use PascalCase (ToolsMisc, ToolsModelina). For consistency across the test suite and adherence to JavaScript class naming conventions, use PascalCase.

♻️ Suggested fix
-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();
cypress/pages/BaseHeaderPage.js (1)

3-5: Note: visit() no longer returns this for fluent chaining.

The previous implementation likely had return this; to allow method chaining. If any tests rely on chaining after visit(), this change would break them. For header-related tests that always start from the homepage, the hardcoded '/' path is likely intentional.

♻️ Consider preserving fluent chaining if needed
   visit() {
-    cy.visit('/')
+    cy.visit('/');
+    return this;
   }

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 23 out of 23 changed files in this pull request and generated 16 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-project-automation github-project-automation bot moved this from To Be Triaged to Done in Website - Kanban Feb 2, 2026
@princerajpoot20
Copy link
Member

Please add some reasoning before closing PRs directly. You closed all five PRs that were under review and created similar new PRs instead. This makes things unnecessarily complicated, and the review will now take more time again.

@anushkaaaaaaaa Could you please explain the reason for doing this?

I’m not sure what benefit you expect from this approach. Whatever changes you want to make could have been done in the same branch.

Keeping updates in the existing PR makes follow-up reviews much easier.

Please understand that reviewing PRs takes a significant amount of time. This simply makes the review process more time-consuming.

FYR: Closed unmerged PRs: #4551, #4215, #4344, #4548, #4533
FYR: Similar newly opened PRs: #5061, #5062, #5063, #5067, #5066

@anushkaaaaaaaa anushkaaaaaaaa reopened this Feb 2, 2026
@princerajpoot20
Copy link
Member

@anushkaaaaaaaa Please have a look at the AI code review. There are multiple minor nits.

Overall, it looks good. Great work @anushkaaaaaaaa

@anushkaaaaaaaa
Copy link
Contributor Author

@anushkaaaaaaaa Please have a look at the AI code review. There are multiple minor nits.

Overall, it looks good. Great work @anushkaaaaaaaa

hello, i've made the changes you asked for, please review

Copy link
Member

@princerajpoot20 princerajpoot20 left a comment

Choose a reason for hiding this comment

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

LGTM!! Great work @anushkaaaaaaaa

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 7, 2026

@princerajpoot20 princerajpoot20 moved this from Done to In review in Website - Kanban Feb 7, 2026
@princerajpoot20 princerajpoot20 added the gsoc This label should be used for issues or discussions related to ideas for Google Summer of Code label Feb 7, 2026
@princerajpoot20 princerajpoot20 merged commit b49a9f2 into asyncapi:master Feb 7, 2026
22 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in Website - Kanban Feb 7, 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: Done

Development

Successfully merging this pull request may close these issues.

4 participants