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

[BUG] Cypress Landing Page Test ("Contains correct heading") Fails for New PRs Due to 2025 Year Change #505

Open
2 tasks done
DevanjoyDas opened this issue Jan 2, 2025 · 1 comment · May be fixed by #506 or #507
Open
2 tasks done
Labels
bug Something isn't working

Comments

@DevanjoyDas
Copy link

Describe the bug.

The Cypress end-to-end (E2E) test ("Contains correct heading") for the landing page is consistently failing for new pull requests (PRs) due to the change in year from 2024 to 2025. The test expects the landing page to display the heading:
AsyncAPI Conf On Tour 2025

However, the actual page content still reflects 2024, causing the test to fail.

Root Cause of the Error:

In the file https://github.com/asyncapi/conference-website/blob/master/cypress/e2e/Landing.cy.js

const Year = new Date().getFullYear();
cy.getTestData("landing-heading").contains(`AsyncAPI Conf On Tour ${Year}`);

Expected behavior

The landing page heading should reflect the current year (2025) or the test should handle year transitions dynamically to avoid false failures.

Possible Solutions

  1. Short term solution only for this Year 2025
    We can change the Heading Directly to 2025 in the file https://github.com/asyncapi/conference-website/blob/master/components/Header/header.js

Current Code

<Heading className='text-6xl sm:text-4xl leading-normal sm:leading-38px tracking-[-3px] sm:tracking-[-0.02em] font-extrabold text-gradient' level='h1' typeStyle='heading'>
			AsyncAPI Conf On Tour 2024
</Heading>

Proposed New Code

<Heading className='text-6xl sm:text-4xl leading-normal sm:leading-38px tracking-[-3px] sm:tracking-[-0.02em] font-extrabold text-gradient' level='h1' typeStyle='heading'>
			AsyncAPI Conf On Tour 2025
</Heading>
  1. Another Short term solution for this year 2025
    We can temporarily modify the code until the official dates for the 2025 Conferences are announced
    In file https://github.com/asyncapi/conference-website/blob/master/cypress/e2e/Landing.cy.js

Current Code

const Year = new Date().getFullYear();
    cy.getTestData("landing-heading").contains(`AsyncAPI Conf On Tour ${Year}`);

Proposed New Code

const Year = new Date().getFullYear();
cy.getTestData("landing-heading").contains(new RegExp(`AsyncAPI Conf On Tour (${Year}|${Year-1})`));
  1. Long term solution for every upcoming Year
    If the heading is supposed to change dynamically each year, we can update the logic in the application to reflect the current year

Screenshots

image

How to Reproduce

  1. Create a new pull request
  2. Observe the test results for Landing Page Tests.
  3. You can observe this error for the Test "Contains correct heading"

image

🥦 Browser

Google Chrome

👀 Have you checked for similar open issues?

  • I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

Yes I am willing to submit a PR!

@DevanjoyDas DevanjoyDas added the bug Something isn't working label Jan 2, 2025
@Lemeri123
Copy link

@DevanjoyDas please assign this to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants