Skip to content

Commit

Permalink
Update formatting and doc comments for test files
Browse files Browse the repository at this point in the history
  • Loading branch information
akshatnema committed Aug 1, 2023
1 parent c13b3d7 commit b32aece
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 63 deletions.
1 change: 0 additions & 1 deletion cypress/test/community/Card.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
6 changes: 3 additions & 3 deletions cypress/test/dashboard/GoodFirstIssuesTip.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions cypress/test/dashboard/Header.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
2 changes: 1 addition & 1 deletion cypress/test/pages/community/ambassadors/index.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
68 changes: 35 additions & 33 deletions cypress/test/pages/community/events/index.cy.js
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand All @@ -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')
});

});
22 changes: 11 additions & 11 deletions cypress/test/pages/community/index.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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');
});
});
8 changes: 4 additions & 4 deletions cypress/test/pages/community/newsroom.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
<MockApp>
<NewsroomSection/>
<NewsroomSection />
</MockApp>
);
});
);
});
});
5 changes: 3 additions & 2 deletions cypress/test/pages/community/tsc.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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) => {
Expand All @@ -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');

});

});

9 changes: 5 additions & 4 deletions cypress/utils/MockApp.js
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
7 changes: 5 additions & 2 deletions cypress/utils/router.js
Original file line number Diff line number Diff line change
@@ -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';

Expand Down

0 comments on commit b32aece

Please sign in to comment.