Skip to content

Commit

Permalink
feat: add integration tests for dashboard component & community pages (
Browse files Browse the repository at this point in the history
…#1953)

Co-authored-by: akshatnema <[email protected]>%0ACo-authored-by: akshatnema <[email protected]>
  • Loading branch information
reachaadrika and akshatnema authored Aug 1, 2023
1 parent 80ba410 commit c5b57b3
Show file tree
Hide file tree
Showing 19 changed files with 661 additions and 70 deletions.
8 changes: 4 additions & 4 deletions components/community/Card.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function SmallHomeCards({icon, tagline, taglineBg, type="large",
<a target={link.includes('http') && '_blank'}>
<div
className={`p-3 cursor-pointer border shadow-xl rounded w-full border-[#ad20e2] ${bg}`}
>
data-testid="Card-small-bg">
<div className="p-2 rounded-xl bg-gray-100 text-center w-min text-xs flex justify-between">
<span>{icon}</span> <span className="ml-[5px]">{tagline}</span>
</div>
Expand Down Expand Up @@ -41,10 +41,10 @@ export default function SmallHomeCards({icon, tagline, taglineBg, type="large",
className={`h-140 w-full shadow-xl rounded p-6 border ${
!bg && 'border-[#ad20e2]'
} ${bg}`}
>
data-testid="Card-lg-bg">
<div
className={`p-2 rounded-xl text-center w-min text-xs flex justify-between ${taglineBg}`}
>
data-testid="Card-lg-tagline">
<span>{icon}</span> <span className="ml-[5px]">{tagline}</span>
</div>

Expand All @@ -62,7 +62,7 @@ export default function SmallHomeCards({icon, tagline, taglineBg, type="large",
</div>
<div className="mt-10">
<Link href={link}>
<a>
<a data-testid="Card-link-lg">
<div className={`flex ${btnBg} cursor-pointer`}>
<IconArrowUp className={`w-[20px] ${btnBg}`} />{' '}
<span className="ml-2 text-sm">{btnText}</span>
Expand Down
4 changes: 2 additions & 2 deletions components/navigation/EventFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ function EventFilter({ data, setData }) {
}
}, [active]);
return (
<div className="p-2 bg-secondary-200 rounded-md flex justify-between w-full sm:w-[400px] text-secondary-600">
<div className="p-2 bg-secondary-200 rounded-md flex justify-between w-full sm:w-[400px] text-secondary-600" data-testid="EventFilters-main">
{filterList.map((list) => (
<div
<div data-testid = "EventFilter-click"
key={list}
className={`p-3 w-[100px] cursor-pointer text-center ${
active === list
Expand Down
2 changes: 1 addition & 1 deletion components/navigation/EventPostItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function EventPostItem({ post, className, id }) {
active = false
}
return (
<li key={id} className={`${className}`}>
<li key={id} className={`${className}`} data-testid="EventPostItem-main">
<article className='h-full rounded-lg shadow-md hover:shadow-lg'>
<a href={post.url} target='_blank' rel='noreferrer'>
<img
Expand Down
239 changes: 239 additions & 0 deletions cypress/fixtures/eventsData.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
[
{
"title": "Spec 3.0 Meeting",
"calLink": "https://www.google.com/calendar/event?eid=djhsdjZvbmRsampvb2tsYzhkZWFyc3FtYTAgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/649",
"date": "2023-04-13T15:00:00.000Z"
},
{
"title": "Community Meeting",
"calLink": "https://www.google.com/calendar/event?eid=MzgwdmZiMTc4cnBmbTUzdWVlbmM4aWYyM2MgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/659",
"banner": "https://user-images.githubusercontent.com/40604284/229763606-c0b6ed3b-e120-427c-b87d-357856d92777.png",
"date": "2023-04-18T16:00:00.000Z"
},
{
"title": "Adding support for non-JSON schemas",
"calLink": "https://www.google.com/calendar/event?eid=dTlrM2s3Nmpqcjk2bWszYW83NmJzNnN0cm8gY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/668",
"banner": "",
"date": "2023-04-18T14:00:00.000Z"
},
{
"title": "Spec 3.0 Meeting",
"calLink": "https://www.google.com/calendar/event?eid=Z2l0am1xbTBhcm8xa2sxc2dyOGdoaXRmZTQgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/670",
"banner": "",
"date": "2023-04-26T15:00:00.000Z"
},
{
"title": "Tackling interoperability challenges in open-source",
"calLink": "https://www.google.com/calendar/event?eid=M2Njb2dib2VvMXF1dmR1bGJ0ZG1tb2txMWsgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/681",
"banner": "https://user-images.githubusercontent.com/66913810/233324999-bce12c6f-6e8e-4aca-acf5-053cfa22378a.png",
"date": "2023-04-26T09:00:00.000Z"
},
{
"title": "Community Meeting",
"calLink": "https://www.google.com/calendar/event?eid=YjcwZ2ZmOXNmMmU1YmRybXB0azk1Y2prb3MgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/688",
"banner": "https://user-images.githubusercontent.com/40604284/233369404-38892fbe-7082-4492-8aed-0a97ee8df011.png",
"date": "2023-05-02T08:00:00.000Z"
},
{
"title": "AsyncAPI x Google Season of Doc's 2023",
"calLink": "https://www.google.com/calendar/event?eid=Yzdyb2F1c3RjOXVvcTh2NXFiZGpyNjgzN3MgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/692",
"banner": "https://user-images.githubusercontent.com/66913810/234268392-10a4c02d-60e6-46ec-abcc-74c5aa6088dd.png",
"date": "2023-05-09T16:00:00.000Z"
},
{
"title": "Community Health in Open-source",
"calLink": "https://www.google.com/calendar/event?eid=ZTNtYXFuN2d2bzZsMzBuOHYyc2kxY2ltb2sgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/698",
"banner": "https://user-images.githubusercontent.com/66913810/234862423-48c98c43-ab13-476c-a232-955e8dfdd3cc.png",
"date": "2023-05-17T16:00:00.000Z"
},
{
"title": "Spec 3.0 Meeting",
"calLink": "https://www.google.com/calendar/event?eid=ZGZhNjR2bXJ2Zzg1aW4zZ3ZpYWpuZTY3ZTggY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/699",
"banner": "",
"date": "2023-05-10T16:00:00.000Z"
},
{
"title": "Community Meeting",
"calLink": "https://www.google.com/calendar/event?eid=Nm9qbjFoNGJ1dmppaGM5bTFmdnZzZDFxNzAgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/705",
"banner": "https://user-images.githubusercontent.com/40604284/238269236-93dda2ae-732c-4aab-b71e-18d077b987e7.png",
"date": "2023-05-16T16:00:00.000Z"
},
{
"title": "Spec 3.0 Meeting",
"calLink": "https://www.google.com/calendar/event?eid=a3JnNnJibDAzNW9ja3ZnMXZ0OGJtcjBqMWMgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/714",
"banner": "",
"date": "2023-05-24T16:00:00.000Z"
},
{
"title": "Community Meeting",
"calLink": "https://www.google.com/calendar/event?eid=NG5pMWJpajA2ODhjczhiY2doNjRudnVybzQgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/715",
"banner": "https://user-images.githubusercontent.com/40604284/240259939-641b0476-1a80-41fa-9d3c-0701ad1dfff0.png",
"date": "2023-05-30T08:00:00.000Z"
},
{
"title": "Headless Commerce: Streamlining Architecture",
"calLink": "https://www.google.com/calendar/event?eid=ODE1aHU2YzByNXJ0MjNlNGNjYmZwbm03b28gY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/716",
"banner": "https://user-images.githubusercontent.com/40604284/240259984-a4ce1ebd-653a-4a61-818f-6707b33b0777.png",
"date": "2023-06-08T12:00:00.000Z"
},
{
"title": "Studio plans",
"calLink": "https://www.google.com/calendar/event?eid=M3NudjU3MG1obmh1MGJxaXBvY2F0dDU4ZTQgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/728",
"banner": "",
"date": "2023-06-05T10:00:00.000Z"
},
{
"title": "Spec 3.0 Meeting",
"calLink": "https://www.google.com/calendar/event?eid=NnIxNnRnMmVoaXMxcGRvYnI1dTM4YXZocmMgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/734",
"banner": "",
"date": "2023-06-07T16:00:00.000Z"
},
{
"title": "Spec 3.0 Meeting",
"calLink": "https://www.google.com/calendar/event?eid=bXJoZ24wcG5jbzM3dTR2cGxuYnQxbHA0Y3MgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/737",
"banner": "",
"date": "2023-06-21T16:00:00.000Z"
},
{
"title": "Community Meeting",
"calLink": "https://www.google.com/calendar/event?eid=bmZkbWxjNnZlb2tvYzRidWVsZTgyczR1MTQgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/738",
"banner": "https://user-images.githubusercontent.com/40604284/244367862-a1120d1c-4e71-4a8f-b291-857344f15a5f.png",
"date": "2023-06-13T16:00:00.000Z"
},
{
"title": "Let's talk about contributing Mentorship Program FAQ",
"calLink": "https://www.google.com/calendar/event?eid=N25kZjVhYjNyZ2oyZG5lam05bTJyMWR1NmsgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/739",
"banner": "https://user-images.githubusercontent.com/40604284/244369872-dc5b89e4-526f-4605-a09a-835e0bf93797.png",
"date": "2023-06-14T13:00:00.000Z"
},
{
"title": "Studio plans",
"calLink": "https://www.google.com/calendar/event?eid=Ym4ybG5nNnJrN2NjcnRjdXZ1MGIxMTlydm8gY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/744",
"banner": "",
"date": "2023-06-05T10:00:00.000Z"
},
{
"title": "Studio planning",
"calLink": "https://www.google.com/calendar/event?eid=aGNmNDl0c2pzZGxoam5iNXBnY3RyczE5OTggY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/745",
"banner": "",
"date": "2023-06-15T10:00:00.000Z"
},
{
"title": "Spec 3.0 Docs Meeting",
"calLink": "https://www.google.com/calendar/event?eid=dGs5N205MHNrcHAzODN0bDI2b3RpdjY5djggY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/747",
"banner": "",
"date": "2023-06-15T02:30:00.000Z"
},
{
"title": "Spec 3.0 Docs Meeting",
"calLink": "https://www.google.com/calendar/event?eid=ajJoMTY5N2hpOWFlMTcyamFmbWttbTJlNG8gY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/749",
"banner": "",
"date": "2023-06-22T14:30:00.000Z"
},
{
"title": "Spec 3.0 Meeting",
"calLink": "https://www.google.com/calendar/event?eid=MHBhZDRzZ2M0OXFqbDJhaXRxcnUwNm9hcmMgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/760",
"banner": "",
"date": "2023-07-05T16:00:00.000Z"
},
{
"title": "Spec 3.0 Meeting",
"calLink": "https://www.google.com/calendar/event?eid=aGdqYmk0NDdiMGE4cGo4NzFuaWxycjNiYmsgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/761",
"banner": "",
"date": "2023-07-19T16:00:00.000Z"
},
{
"title": "Community Meeting",
"calLink": "https://www.google.com/calendar/event?eid=bjZxY3JoZmZjNmk0azU4bDdzOHFrOGcxY28gY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/762",
"banner": "https://user-images.githubusercontent.com/40604284/246774505-ba6d0600-d250-43fe-b6f3-5587de26ea01.png",
"date": "2023-06-27T08:00:00.000Z"
},
{
"title": "Fran AMA AsyncAPI",
"calLink": "https://www.google.com/calendar/event?eid=N2cxZjlobW0xOW9ocG5rMnVhaDZhbDQ2aGcgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/764",
"banner": "",
"date": "2023-06-23T10:00:00.000Z"
},
{
"title": "Spec 3.0 Docs Meeting",
"calLink": "https://www.google.com/calendar/event?eid=YmhiaTQxNDBicDA0NjgyZmk3M3ZocTJxbGcgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/774",
"banner": "",
"date": "2023-07-06T14:30:00.000Z"
},
{
"title": "Open Standards and Private Products: A DevRel's Dream or Nightmare",
"calLink": "https://www.google.com/calendar/event?eid=dHMzZ3Q0b2h2NDRuaTVrMTQ3cmsxYzk2bzAgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/775",
"banner": "https://user-images.githubusercontent.com/66913810/249772860-0b6c73a5-a740-4fac-a22d-2d95f823ae07.png",
"date": "2023-07-13T09:00:00.000Z"
},
{
"title": "Community Meeting",
"calLink": "https://www.google.com/calendar/event?eid=cmFudjRxMjVhazk1Y2FjbXA3Zm1pMWZyZjAgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/784",
"banner": "https://user-images.githubusercontent.com/40604284/250981834-3418496b-d123-4e74-a7ff-082b4714c841.png",
"date": "2023-07-11T16:00:00.000Z"
},
{
"title": "Spec 3.0 Docs Meeting",
"calLink": "https://www.google.com/calendar/event?eid=NzU0aGMxOWY5MmYyYzA3OTduazF0MWZqY2MgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/790",
"banner": "",
"date": "2023-07-20T14:30:00.000Z"
},
{
"title": "Spec 3.0 Docs Meeting",
"calLink": "https://www.google.com/calendar/event?eid=aWhzNWwxZWkxdWVlMWhvbGs4aWY2YzU1am8gY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/791",
"banner": "",
"date": "2023-08-03T14:30:00.000Z"
},
{
"title": "Spec 3.0 Docs Meeting",
"calLink": "https://www.google.com/calendar/event?eid=cG9iOHNqZGlrbmg4cnUxanMzMTgyN3AxdnMgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/792",
"banner": "",
"date": "2023-08-17T14:30:00.000Z"
},
{
"title": "Community Meeting",
"calLink": "https://www.google.com/calendar/event?eid=MmpwYXMxYjBscjlnYWhtMHR2MnQ2MTMwM2cgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/798",
"banner": "https://user-images.githubusercontent.com/40604284/252807786-f93110e3-c344-4080-9c4f-9d32cb324680.png",
"date": "2023-07-25T08:00:00.000Z"
},
{
"title": "Design meeting",
"calLink": "https://www.google.com/calendar/event?eid=czVxbG5jZXV2MThxczJjczdhMmtxZzE1djAgY19xOXRzZWlnbG9tZHNqNm5qdWh2YnB0czExY0Bn",
"url": "https://github.com/asyncapi/community/issues/800",
"banner": "",
"date": "2023-07-18T08:00:00.000Z"
}
]
2 changes: 2 additions & 0 deletions cypress/test/community/Card.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ describe('SmallHomeCards', () => {
cy.get('[data-testid="Card-desc"]').contains('Description').should('exist');
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 All @@ -46,6 +47,7 @@ describe('SmallHomeCards', () => {
// Testing for large prop classes and styles
cy.get('[data-testid="Card-heading-lg"]').contains('Heading').should('exist');
cy.get('[data-testid="Card-desc-lg"]').contains('Description').should('exist');
cy.get('[href="/path"]').should('exist');
cy.get('[data-testid="Card-heading-lg"]').should('have.class','mt-10');
cy.get('[data-testid="Card-desc-lg"]').should('have.class','mt-6');

Expand Down
8 changes: 3 additions & 5 deletions cypress/test/dashboard/GoodFirstIssuesTip.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ describe('GoodFirstIssuesTip', () => {
});

it('toggles the tip when hovering over the icon', () => {
cy.get('[data-testid="GoodFirstIssuesTip-hover-icon"]').trigger('mouseenter');
cy.get('[data-testid="GoodFirstIssuesTip-hover-icon"]').trigger('mouseleave');

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"]').trigger('mouseenter');
//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
5 changes: 3 additions & 2 deletions cypress/test/dashboard/Header.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ describe('Header', () => {
'contain',
'Visualize our progress. Get involved.'
);
cy.get('[data-testid="Github-button"]').should('exist');
cy.get('[data-testid="Slack-button"]').should('exist');

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');
});
});
Loading

0 comments on commit c5b57b3

Please sign in to comment.