Skip to content

test: add e2e tests for roadmap and case studies page#5066

Open
anushkaaaaaaaa wants to merge 3 commits intoasyncapi:masterfrom
anushkaaaaaaaa:roadmap-case
Open

test: add e2e tests for roadmap and case studies page#5066
anushkaaaaaaaa wants to merge 3 commits intoasyncapi:masterfrom
anushkaaaaaaaa:roadmap-case

Conversation

@anushkaaaaaaaa
Copy link
Contributor

@anushkaaaaaaaa anushkaaaaaaaa commented Feb 2, 2026

Description
I have added E2E tests using Cypress for Roadmap Page and Case Studies Page to ensure functionality and correct rendering.

Related issue(s)

Summary by CodeRabbit

  • Tests
    • Added end-to-end test suites for Roadmap and Case Studies pages covering page load, navigation, tooltips, cards, resource links, and scroll behavior.
  • Test Infrastructure
    • Introduced shared page abstractions and a helper for bulk link verification to make tests more reliable and data-driven.
  • Fixtures
    • Added a resource links fixture to drive link verification tests.

@netlify
Copy link

netlify bot commented Feb 2, 2026

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 4259e28
🔍 Latest deploy log https://app.netlify.com/projects/asyncapi-website/deploys/6980970b8c20a600089693de
😎 Deploy Preview https://deploy-preview-5066--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 Feb 2, 2026

📝 Walkthrough

Walkthrough

Adds new Cypress E2E tests for RoadmapPage and CaseStudiesPage, a BasePage superclass, updated page objects (Roadmap, CaseStudies, Home), a fixture for case study resource links, and a helper to iterate/verify links. Tests use page objects, fixtures, and indexed verification.

Changes

Cohort / File(s) Summary
E2E Test Suites
cypress/RoadmapPage.cy.js, cypress/casestudies.cy.js
New Cypress test files: RoadmapPage tests (page load, community link, indexed tooltips) and CaseStudies tests (header, FAQ/cards/PR links, adopters scroll, resource links driven by fixture).
Page Objects
cypress/pages/BasePage.js, cypress/pages/RoadmapPage.js, cypress/pages/CaseStudiesPage.js, cypress/pages/homepage.js
Introduces BasePage with common navigation/assertions. RoadmapPage and CaseStudiesPage now extend BasePage and add visit/verify methods (header, community link, tooltips, cards, resources, scroll). homepage refactored to use verifyPageLoaded/verifyHeadingExists.
Fixtures & Helpers
cypress/fixtures/caseStudiesLinks.json, cypress/support/helpers.js
New fixture array of resource links and a verifyLinks helper to iterate link objects and call a provided verifier (configurable keys).

Sequence Diagram(s)

sequenceDiagram
  participant Test as Cypress Test
  participant Page as PageObject (Roadmap/CaseStudies)
  participant App as Browser/App UI
  participant Fixture as Fixture/Helpers

  Test->>Page: instantiate and call visit()
  Page->>App: navigate to /roadmap or /casestudies
  Test->>Page: call verifyHeader(), verifyCommunityLink(), verifyTooltip(index) / verifyCardsLink()
  Page->>App: query DOM (headings, links, tooltips, cards)
  Test->>Fixture: load caseStudiesLinks.json
  Test->>Fixture: call verifyLinks(links, verifyFn)
  Fixture->>Page: invoke verifyResourceLink(href) for each entry
  Page->>App: assert anchor hrefs and visibility
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐇 I hopped through pages, sniffed each link,

Tooltips popped and fixtures did blink.
BasePage lent a paw, tests hopped in line,
Cards and community — all working fine.
A joyful rabbit cheers: tests passing, all shine!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 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 and accurately summarizes the main changes: adding E2E tests for the Roadmap and Case Studies pages, which aligns with the actual modifications across all test files, fixtures, and page objects.

✏️ 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

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 (4259e28).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #5066   +/-   ##
=========================================
  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 Feb 2, 2026

⚡️ Lighthouse report for the changes in this PR:

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

Lighthouse ran on https://deploy-preview-5066--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: 3

🤖 Fix all issues with AI agents
In `@cypress/pages/CaseStudiesPage.js`:
- Around line 20-28: The href assertion in verifyCardLink is brittle because
have.attr(..., cardUrl) fails when the DOM returns a leading-slash path or a
full absolute URL; update verifyCardLink to retrieve the anchor href and assert
it includes the expected cardUrl (or normalize by stripping origin/leading
slash) instead of exact equality—locate the verifyCardLink method and replace
the final .should('have.attr', 'href', cardUrl) with a resilient check that uses
include (or a normalized comparison) so both "/casestudies/..." and
"https://.../casestudies/..." pass.

In `@cypress/pages/RoadmapPage.js`:
- Around line 27-29: The verifyTooltip(index) helper currently asserts
visibility on all tooltips; update it to assert only the tooltip corresponding
to the hovered icon by selecting the same index for the tooltip element (use the
same index argument with the '[data-testid="InlineHelp"]' selector, e.g., call
.eq(index) before .should('be.visible')). This ensures the hover assertion
targets the specific tooltip shown by the earlier
cy.get('[data-testid="InlineHelp-icon"]').eq(index).trigger('mouseover') call.

In `@cypress/RoadmapPage.cy.js`:
- Around line 15-17: The test title says it verifies navigation but only calls
roadmapPage.verifyCommunityLink() without performing a click or asserting the
URL; either rename the test to reflect a non-navigation check or update the test
to perform the navigation and assertion by invoking the click and URL assertion
(e.g., add a call to a click method such as roadmapPage.clickCommunityLink() or
implement the click inside verifyCommunityLink(), then assert
cy.url().should('include', '/community') or the expected path). Ensure the
chosen change updates the test name if you keep it as a non-navigation check or
implements both the click and URL assertion when keeping the current name.
🧹 Nitpick comments (1)
cypress/casestudies.cy.js (1)

39-41: Use the label field to strengthen link validation.
Right now labels are unused; asserting the link text reduces false positives if duplicate hrefs exist.

✅ Suggested enhancement
-  it('Verifies all Links under Resources work', () => {
-    verifyLinks(links, (href, label) => casestudiespage.verifyResourceLink(href), 'href', 'label');
-  });
+  it('Verifies all Links under Resources work', () => {
+    verifyLinks(
+      links,
+      (href, label) => {
+        casestudiespage.verifyResourceLink(href);
+        cy.contains('a', label).should('have.attr', 'href', href);
+      },
+      'href',
+      'label'
+    );
+  });

Comment on lines +20 to +28
verifyCardLink(cardName, cardUrl, index = 0) {
cy.get('[data-testid="CaseStudyCard-main"]')
.eq(index)
.within(() => {
cy.get(`img[alt*="${cardName.split(' ')[0]}"]`).should('exist');
})
.closest('a')
.should('have.attr', 'href', cardUrl);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# Find test files that call verifyCardLink
rg "verifyCardLink" --type js -B 2 -A 2

Repository: asyncapi/website

Length of output: 1169


🏁 Script executed:

# Look at the CaseStudyCard component to see how href is rendered
fd "CaseStudyCard" --type f

Repository: asyncapi/website

Length of output: 88


🏁 Script executed:

# Check the CaseStudiesPage.js file to understand the context better
cat -n cypress/pages/CaseStudiesPage.js | head -50

Repository: asyncapi/website

Length of output: 1499


🏁 Script executed:

cat -n components/CaseStudyCard.tsx

Repository: asyncapi/website

Length of output: 1652


🏁 Script executed:

# Check for Next.js config and any route handling
fd "next.config" -o "middleware" -o "routes" --type f | head -20

Repository: asyncapi/website

Length of output: 199


🏁 Script executed:

# Search for other href patterns in the codebase to see if leading slashes are used
rg "href=" --type tsx --type jsx -o | sort | uniq | head -30

Repository: asyncapi/website

Length of output: 87


🏁 Script executed:

# Check if there's any Link component wrapper or routing transformation
rg "next/link" -A 3 -B 1 --type tsx --type jsx | head -50

Repository: asyncapi/website

Length of output: 87


🏁 Script executed:

# Search for href patterns more broadly
rg "href=" -A 1 -B 1 | grep -E "href=.*casestudies|href=.*/" | head -20

Repository: asyncapi/website

Length of output: 2007


🏁 Script executed:

# Check for Next.js configuration
find . -name "next.config*" -o -name "tsconfig.json" | head -10

Repository: asyncapi/website

Length of output: 93


🏁 Script executed:

# Check what actual href values are being used in the codebase
rg "href=" -o | sort | uniq -c | sort -rn | head -20

Repository: asyncapi/website

Length of output: 1006


🏁 Script executed:

# Check for any routing middleware or href transformation
rg "casestudies" -B 2 -A 2 | head -40

Repository: asyncapi/website

Length of output: 2844


🏁 Script executed:

# Look at the test file itself to see if there are any patterns of href matching failures
fd "casestud.*\.cy\." -o "casestud.*spec\."

Repository: asyncapi/website

Length of output: 211


🏁 Script executed:

# Search for any href-related test utilities or assertions
rg "have\.attr.*href" | head -15

Repository: asyncapi/website

Length of output: 484


Make card href assertion resilient to leading slash / absolute URLs.
The exact have.attr(..., cardUrl) assertion can fail if the DOM renders /casestudies/... or a full origin. Prefer an include check for stability.

🔧 Suggested fix
-      .should('have.attr', 'href', cardUrl);
+      .should('have.attr', 'href')
+      .and('include', cardUrl);
🤖 Prompt for AI Agents
In `@cypress/pages/CaseStudiesPage.js` around lines 20 - 28, The href assertion in
verifyCardLink is brittle because have.attr(..., cardUrl) fails when the DOM
returns a leading-slash path or a full absolute URL; update verifyCardLink to
retrieve the anchor href and assert it includes the expected cardUrl (or
normalize by stripping origin/leading slash) instead of exact equality—locate
the verifyCardLink method and replace the final .should('have.attr', 'href',
cardUrl) with a resilient check that uses include (or a normalized comparison)
so both "/casestudies/..." and "https://.../casestudies/..." pass.

Comment on lines +27 to +29
verifyTooltip(index) {
cy.get('[data-testid="InlineHelp-icon"]').eq(index).trigger('mouseover');
cy.get('[data-testid="InlineHelp"]').should('be.visible');
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

find . -type f -name "RoadmapPage.js" | head -20

Repository: asyncapi/website

Length of output: 90


🏁 Script executed:

cat -n cypress/pages/RoadmapPage.js | head -50

Repository: asyncapi/website

Length of output: 997


🏁 Script executed:

rg "InlineHelp" cypress/pages/RoadmapPage.js -n

Repository: asyncapi/website

Length of output: 206


🏁 Script executed:

rg "data-testid" cypress/pages/RoadmapPage.js -B2 -A2 | head -100

Repository: asyncapi/website

Length of output: 396


🏁 Script executed:

rg "verifyTooltip" cypress/ -B2 -A2 | head -50

Repository: asyncapi/website

Length of output: 652


🏁 Script executed:

rg "InlineHelp" cypress/ -l

Repository: asyncapi/website

Length of output: 88


🏁 Script executed:

cat -n cypress/RoadmapPage.cy.js

Repository: asyncapi/website

Length of output: 1021


Scope tooltip visibility to the hovered index.
cy.get('[data-testid="InlineHelp"]').should('be.visible') asserts all tooltips without targeting the specific index, which can be flaky or mask a wrong tooltip. The method receives an index parameter and correctly targets the specific icon at that index, but the visibility assertion should match. Target the tooltip at the same index.

🔧 Suggested fix
  verifyTooltip(index) {
    cy.get('[data-testid="InlineHelp-icon"]').eq(index).trigger('mouseover');
-   cy.get('[data-testid="InlineHelp"]').should('be.visible');
+   cy.get('[data-testid="InlineHelp"]').eq(index).should('be.visible');
  }
📝 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
verifyTooltip(index) {
cy.get('[data-testid="InlineHelp-icon"]').eq(index).trigger('mouseover');
cy.get('[data-testid="InlineHelp"]').should('be.visible');
verifyTooltip(index) {
cy.get('[data-testid="InlineHelp-icon"]').eq(index).trigger('mouseover');
cy.get('[data-testid="InlineHelp"]').eq(index).should('be.visible');
}
🤖 Prompt for AI Agents
In `@cypress/pages/RoadmapPage.js` around lines 27 - 29, The verifyTooltip(index)
helper currently asserts visibility on all tooltips; update it to assert only
the tooltip corresponding to the hovered icon by selecting the same index for
the tooltip element (use the same index argument with the
'[data-testid="InlineHelp"]' selector, e.g., call .eq(index) before
.should('be.visible')). This ensures the hover assertion targets the specific
tooltip shown by the earlier
cy.get('[data-testid="InlineHelp-icon"]').eq(index).trigger('mouseover') call.

Comment on lines +15 to +17
it('User clicks on the community page link and verifies navigation', () => {
roadmapPage.verifyCommunityLink();
});
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Test name claims navigation, but no click/navigation is performed.
Either update the test name or add the click + URL assertion.

✏️ Suggested rename (minimal change)
-  it('User clicks on the community page link and verifies navigation', () => {
+  it('User verifies the community page link URL', () => {
     roadmapPage.verifyCommunityLink();
   });
📝 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
it('User clicks on the community page link and verifies navigation', () => {
roadmapPage.verifyCommunityLink();
});
it('User verifies the community page link URL', () => {
roadmapPage.verifyCommunityLink();
});
🤖 Prompt for AI Agents
In `@cypress/RoadmapPage.cy.js` around lines 15 - 17, The test title says it
verifies navigation but only calls roadmapPage.verifyCommunityLink() without
performing a click or asserting the URL; either rename the test to reflect a
non-navigation check or update the test to perform the navigation and assertion
by invoking the click and URL assertion (e.g., add a call to a click method such
as roadmapPage.clickCommunityLink() or implement the click inside
verifyCommunityLink(), then assert cy.url().should('include', '/community') or
the expected path). Ensure the chosen change updates the test name if you keep
it as a non-navigation check or implements both the click and URL assertion when
keeping the current name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To Be Triaged

Development

Successfully merging this pull request may close these issues.

2 participants