diff --git a/cypress/test/community/Card.cy.js b/cypress/test/community/Card.cy.js index 10c6482e6dd..0fe3fc83d8d 100644 --- a/cypress/test/community/Card.cy.js +++ b/cypress/test/community/Card.cy.js @@ -26,7 +26,6 @@ describe('SmallHomeCards', () => { cy.get('[data-testid="Card-heading"]').should('have.class','mt-3'); cy.get('[data-testid="Card-desc"]').should('have.class','mt-2'); cy.get('[href="/path"]').should('exist'); - }); it('renders large card correctly', () => { diff --git a/cypress/test/dashboard/GoodFirstIssuesTip.cy.js b/cypress/test/dashboard/GoodFirstIssuesTip.cy.js index bb83239cc70..5cca9d74e7a 100644 --- a/cypress/test/dashboard/GoodFirstIssuesTip.cy.js +++ b/cypress/test/dashboard/GoodFirstIssuesTip.cy.js @@ -8,12 +8,12 @@ describe('GoodFirstIssuesTip', () => { }); it('toggles the tip when hovering over the icon', () => { - cy.get('[data-testid="GoodFirstIssuesTip-hover-icon"]').click({force:true}); + cy.get('[data-testid="GoodFirstIssuesTip-hover-icon"]').click({ force: true }); }); it('renders the tip content with the correct text', () => { - cy.get('[data-testid="GoodFirstIssuesTip-hover-icon"]').click({force:true}); - //checking for the available class here + cy.get('[data-testid="GoodFirstIssuesTip-hover-icon"]').click({ force: true }); + //checking for the available class here cy.get('.bg-white').should('have.css', 'visibility', 'visible'); cy.contains('Is this your first contribution?').should('exist'); diff --git a/cypress/test/dashboard/Header.cy.js b/cypress/test/dashboard/Header.cy.js index 4bb0b3e868f..9bccdae248e 100644 --- a/cypress/test/dashboard/Header.cy.js +++ b/cypress/test/dashboard/Header.cy.js @@ -26,7 +26,7 @@ describe('Header', () => { cy.contains('Contribution Guide') .should('have.attr', 'href', 'https://github.com/asyncapi?type=source#-contribute-to-asyncapi') .should('have.attr', 'target', '_blank'); - cy.get('[data-testid="Button-link"]').should('exist'); - cy.get('[data-testid="Button-link"]').should('exist'); + cy.get('[data-testid="Button-link"]').should('exist'); + cy.get('[data-testid="Button-link"]').should('exist'); }); }); diff --git a/cypress/test/pages/community/ambassadors/index.cy.js b/cypress/test/pages/community/ambassadors/index.cy.js index 8c8ade4de52..f4818f13851 100644 --- a/cypress/test/pages/community/ambassadors/index.cy.js +++ b/cypress/test/pages/community/ambassadors/index.cy.js @@ -69,7 +69,7 @@ describe('Test for Ambassadors', () => { }); it('displays the Become an AsyncAPI Ambassador section with correct data', () => { - cy.get('[data-testid="Events-ambassadors"]').should('exist'); + cy.get('[data-testid="Events-ambassadors"]').should('exist'); }); it('should display NewsletterSubscribe', () => { diff --git a/cypress/test/pages/community/events/index.cy.js b/cypress/test/pages/community/events/index.cy.js index 19766f1335e..6713bb8d471 100644 --- a/cypress/test/pages/community/events/index.cy.js +++ b/cypress/test/pages/community/events/index.cy.js @@ -1,5 +1,5 @@ import Eventindex from "../../../../../pages/community/events"; -import MockApp from "../../../../utils/mockApp"; +import MockApp from "../../../../utils/MockApp"; import meetings from '../../../../../config/meetings.json'; import moment from 'moment'; describe('CommunityIndexPage', () => { @@ -18,51 +18,53 @@ describe('CommunityIndexPage', () => { it('displays recording card', () => { cy.get('[data-testid="RecordingsCard-img"]').should('exist'); - cy.get('[data-testid="Recordings-Link"]').should('have.attr','href','https://www.youtube.com/playlist?list=PLbi1gRlP7pijRiA32SU36hD_FW-2qyPhl') + cy.get('[data-testid="Recordings-Link"]').should('have.attr', 'href', 'https://www.youtube.com/playlist?list=PLbi1gRlP7pijRiA32SU36hD_FW-2qyPhl') cy.get('[data-testid="Recordings-text"]').should('exist'); }); - - it('check for Events Filters' , () => { - cy.get('[data-testid="EventFilters-main"]').should('exist'); - cy.get('[data-testid="EventFilter-click"]').contains('All').click({force:true}); - meetings.forEach((event) => { - cy.contains(event.title).should('be.visible'); - }); - cy.get('[data-testid="EventFilter-click"]').contains('Upcoming').click({force:true}); - const currentDate = moment().format('YYYY-MM-DD'); - meetings.forEach((event) => { - if (moment(event.date).isAfter(currentDate)) { - cy.contains(event.title).should('be.visible'); - } + + it('check for Events Filters', () => { + cy.get('[data-testid="EventFilters-main"]').should('exist'); + cy.get('[data-testid="EventFilter-click"]').contains('All').click({ force: true }); + + meetings.forEach((event) => { + cy.contains(event.title).should('be.visible'); + }); + cy.get('[data-testid="EventFilter-click"]').contains('Upcoming').click({ force: true }); + + const currentDate = moment().format('YYYY-MM-DD'); + meetings.forEach((event) => { + if (moment(event.date).isAfter(currentDate)) { + cy.contains(event.title).should('be.visible'); + } }); - cy.get('[data-testid="EventFilter-click"]').contains('Recorded').click({force:true}); - const currentDate1 = moment().format('YYYY-MM-DD'); - meetings.forEach((event) => { - if (moment(event.date).isBefore(currentDate1)) { - cy.contains(event.title).should('be.visible'); - } + + cy.get('[data-testid="EventFilter-click"]').contains('Recorded').click({ force: true }); + const currentDate1 = moment().format('YYYY-MM-DD'); + meetings.forEach((event) => { + if (moment(event.date).isBefore(currentDate1)) { + cy.contains(event.title).should('be.visible'); + } }); }) - it('check for Events Post Item' , () => { + it('check for Events Post Item', () => { cy.get('[data-testid="EventPostItem-main"]').should('exist'); - }) + }) it('Community Meeting Card', () => { cy.get('[data-testid="EventTypesCard"]').should('exist') - cy.get('[data-testid="Meeting-heading"]').should('exist') - cy.get('[ data-testid="Meeting-paragraph"]').should('exist') - cy.get('[ data-testid="Meeting-host"]').should('exist') - cy.get('[ data-testid="Meeting-link"]').should('exist') + cy.get('[data-testid="Meeting-heading"]').should('exist') + cy.get('[ data-testid="Meeting-paragraph"]').should('exist') + cy.get('[ data-testid="Meeting-host"]').should('exist') + cy.get('[ data-testid="Meeting-link"]').should('exist') }); - + it('Other Meeting Cards', () => { cy.get('[data-testid="EventTypesCard-others"]').should('exist') - cy.get('[data-testid="Meeting-heading"]').should('exist') - cy.get('[ data-testid="Meeting-paragraph"]').should('exist') - cy.get('[ data-testid="Meeting-host"]').should('exist') - cy.get('[ data-testid="Meeting-link"]').should('exist') + cy.get('[data-testid="Meeting-heading"]').should('exist') + cy.get('[ data-testid="Meeting-paragraph"]').should('exist') + cy.get('[ data-testid="Meeting-host"]').should('exist') + cy.get('[ data-testid="Meeting-link"]').should('exist') }); - }); \ No newline at end of file diff --git a/cypress/test/pages/community/index.cy.js b/cypress/test/pages/community/index.cy.js index 5deb277c52b..7eb0b28b3ff 100644 --- a/cypress/test/pages/community/index.cy.js +++ b/cypress/test/pages/community/index.cy.js @@ -43,15 +43,15 @@ describe('CommunityIndexPage', () => { }); it('should display other cards correctly', () => { - cy.get('[data-testid="CommunityCards-Goals"]').should('exist'); - cy.get('[href="https://github.com/asyncapi/community/discussions/513"]').should('exist'); - cy.get('[data-testid="CommunityCards-Contributors"]').should('exist'); - cy.get('[href="https://github.com/orgs/asyncapi/discussions/593"]').should('exist'); - cy.get('[data-testid="CommunityCards-TSC"]').should('exist'); - cy.get('[href="/community/tsc"]').should('exist'); + cy.get('[data-testid="CommunityCards-Goals"]').should('exist'); + cy.get('[href="https://github.com/asyncapi/community/discussions/513"]').should('exist'); + cy.get('[data-testid="CommunityCards-Contributors"]').should('exist'); + cy.get('[href="https://github.com/orgs/asyncapi/discussions/593"]').should('exist'); + cy.get('[data-testid="CommunityCards-TSC"]').should('exist'); + cy.get('[href="/community/tsc"]').should('exist'); }); - it('should display slack card ' ,() => { + it('should display slack card ', () => { cy.get('[data-testid="CommunityCards-Slack"]').should('exist'); cy.get('[data-testid="CommunityIndex-HomeCard"]').should('exist') cy.get('[data-testid="HomeCard-main"]').contains('All community info, tracked') @@ -60,9 +60,9 @@ describe('CommunityIndexPage', () => { cy.get('[data-testid="HomeCard-button"]').should('exist'); cy.get(".bg-channelCover").should('exist') }); - - it('should display NewsletterSubscribe',()=>{ - cy.get('[data-testid="CommunityCard-subscribe"]').should('exist'); - cy.get('[data-testid="NewsletterSubscribe-main"]').should('exist'); + + it('should display NewsletterSubscribe', () => { + cy.get('[data-testid="CommunityCard-subscribe"]').should('exist'); + cy.get('[data-testid="NewsletterSubscribe-main"]').should('exist'); }); }); \ No newline at end of file diff --git a/cypress/test/pages/community/newsroom.cy.js b/cypress/test/pages/community/newsroom.cy.js index 761ac198000..b3b11e3ea5f 100644 --- a/cypress/test/pages/community/newsroom.cy.js +++ b/cypress/test/pages/community/newsroom.cy.js @@ -3,11 +3,11 @@ import { mount } from "@cypress/react"; import NewsroomSection from '../../../../pages/community/newsroom' describe('Test for Newsroom Section Pages', () => { - it('renders correctly', () => { + it('renders correctly', () => { mount( - + - ); - }); + ); + }); }); \ No newline at end of file diff --git a/cypress/test/pages/community/tsc.cy.js b/cypress/test/pages/community/tsc.cy.js index 33da921bb96..8b1bcdfb2df 100644 --- a/cypress/test/pages/community/tsc.cy.js +++ b/cypress/test/pages/community/tsc.cy.js @@ -13,6 +13,7 @@ describe('TSC', () => { cy.get('[data-testid="TSC-Article-Link"]').should('have.attr', 'href', 'https://www.asyncapi.com/blog/governance-motivation') cy.get('[data-testid="NewsletterSubscribe-main"]').should('exist') }); + it("should display TSC members", () => { // Check if the "Current TSC members" section is visible cy.contains("Current TSC members").should("be.visible"); @@ -34,6 +35,7 @@ describe('TSC', () => { }); }); + it("should have valid social links", () => { // Check if each TSC member card's social links are valid cy.get('[data-testid="UserInfo-list"]').each((member) => { @@ -46,12 +48,11 @@ describe('TSC', () => { }); }); }); + it('displays Question Card ', () => { cy.get('[data-testid="Question-card"]').should('exist'); cy.get('[data-testid="Question-card-img"]').should('exist'); cy.get(`[href="https://github.com/asyncapi/community/blob/master/TSC_MEMBERSHIP.md"]`).should('exist'); - }); - }); diff --git a/cypress/utils/MockApp.js b/cypress/utils/MockApp.js index 1a894894248..31558164c39 100644 --- a/cypress/utils/MockApp.js +++ b/cypress/utils/MockApp.js @@ -1,7 +1,8 @@ - -//this file was created to mock the root "_app.js" , so that cypress could directly access refs , contexts and scripts present -//in the "Head" tags , thus by wrapping up pages into MockApp we enable to cypress to access routes , and can mount the required pages -//easily +/** + * This file is use to mock the root "_app.js" , so that cypress could directly access refs , contexts and scripts present + * in the "Head" tags , thus by wrapping up pages into MockApp we enable to cypress to access routes , and can mount the + * required pages easily. + */ import AppContext from "../../context/AppContext"; import { MDXProvider } from "../../components/MDX"; diff --git a/cypress/utils/router.js b/cypress/utils/router.js index 3504315904c..f77ae5e4003 100644 --- a/cypress/utils/router.js +++ b/cypress/utils/router.js @@ -1,5 +1,8 @@ -//this file was create to mock the useRouter hook from next.js which is not available otherwise in cypress and enables -//cypress to access router properties like asPath and links . +/** + * This file is use to mock the useRouter hook from next.js which is not available otherwise in cypress and enables + * cypress to access router properties like asPath and links. + */ + import React from 'react'; import { RouterContext } from 'next/dist/shared/lib/router-context';