-
-
Notifications
You must be signed in to change notification settings - Fork 765
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'sponsors_tests' of https://github.com/reachaadrika/website
- Loading branch information
Showing
6 changed files
with
150 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { mount } from '@cypress/react'; | ||
import RoadmapColumn from '../../../components/roadmap/RoadmapColumn'; | ||
import RoadmapList from '../../../components/roadmap/RoadmapList'; | ||
|
||
describe('RoadmapColumn Component', () => { | ||
it('renders the RoadmapColumn component with title and description', () => { | ||
const title = 'Test RoadmapColumn'; | ||
const description = 'This is a test RoadmapColumn'; | ||
const colorClass = 'blue'; | ||
const items = []; | ||
const childrenCollapsed = false; | ||
mount( | ||
<RoadmapColumn | ||
title={title} | ||
description={description} | ||
colorClass={colorClass} | ||
items={items} | ||
childrenCollapsed={childrenCollapsed} | ||
/> | ||
); | ||
cy.get('[data-testid="RoadmapColumn-heading"]').contains('h3',title).should('exist'); | ||
cy.get('[data-testid="RoadmapColumn-heading"]').contains('p',description).should('exist'); | ||
}); | ||
|
||
it('renders the RoadmapList component within RoadmapColumn', () => { | ||
const items = [ | ||
{ id: 1, name: 'Item 1' }, | ||
{ id: 2, name: 'Item 2' }, | ||
]; | ||
mount( | ||
<RoadmapColumn | ||
title="Dummy Test" | ||
description="This is a test for RoadmapColumn" | ||
colorClass="red" | ||
items={items} | ||
childrenCollapsed={false} | ||
/> | ||
); | ||
//renders RoadmapList component | ||
cy.get(RoadmapList).should('exist'); | ||
|
||
}); | ||
|
||
it('renders the correct number of items in RoadmapList' , () => { | ||
const items = [ | ||
{ id: 1, name: 'Item 1' }, | ||
{ id: 2, name: 'Item 2' }, | ||
]; | ||
mount( | ||
<RoadmapColumn | ||
title="Test RoadmapColumn" | ||
description="This is a test RoadmapColumn" | ||
colorClass="red" | ||
items={items} | ||
childrenCollapsed={false} | ||
/> | ||
); | ||
cy.get('[data-testid="RoadmapItem-list"]').should('have.length', items.length); | ||
}) | ||
|
||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { mount } from '@cypress/react'; | ||
import RoadmapItem from '../../../components/roadmap/RoadmapItem'; | ||
|
||
describe('RoadmapItem', () => { | ||
const item = { | ||
title: 'Sample Item', | ||
solutions: [{ title: 'Solution 1' }, { title: 'Solution 2' }], | ||
implementations: [ | ||
{ title: 'Implementation 1' }, | ||
{ title: 'Implementation 2' }, | ||
], | ||
description: 'Lorem ipsum dolor sit amet.', | ||
}; | ||
|
||
it('renders the collapsed RoadmapItem correctly', () => { | ||
mount(<RoadmapItem item={item} colorClass="bg-blue-400" />); | ||
|
||
// Assert that the collapsed RoadmapItem is rendered correctly | ||
cy.get('[data-testid="RoadmapItem-list"]').should( | ||
'have.class', | ||
'border-l-2 border-dashed border-gray-300' | ||
); | ||
cy.contains('Sample Item').should('be.visible'); | ||
}); | ||
|
||
it('expands the RoadmapItem when clicked', () => { | ||
mount(<RoadmapItem item={item} colorClass="bg-blue-400" />); | ||
|
||
|
||
cy.get('[data-testid="RoadmapItem-button"]').click(); | ||
|
||
// Assert that the expanded RoadmapItem is rendered correctly | ||
cy.get('[data-testid="RoadmapItem-list"]').should( | ||
'have.class', | ||
'border-l-2 border-dashed border-gray-300' | ||
); | ||
cy.contains('Sample Item').should('be.visible'); | ||
cy.contains('Solution 1').should('be.visible'); | ||
cy.contains('Solution 2').should('be.visible'); | ||
cy.contains('Implementation 1').should('be.visible'); | ||
cy.contains('Implementation 2').should('be.visible'); | ||
}); | ||
it('opens the description modal when clicked', () => { | ||
mount(<RoadmapItem item={item} colorClass="bg-blue-400" />); | ||
cy.contains('a', item.title).click(); | ||
|
||
// Assert that the description modal is opened | ||
cy.contains(item.title).should('be.visible'); | ||
cy.contains(item.description).should('be.visible'); | ||
cy.contains(item.title).should('be.visible'); | ||
cy.contains(item.description).should('be.visible'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from 'react'; | ||
import { mount } from 'cypress/react'; | ||
import RoadmapList from '../../../components/roadmap/RoadmapList'; | ||
describe('RoadmapList component', () => { | ||
const items = [ | ||
{ title: 'Item 1', description: 'Description 1' }, | ||
{ title: 'Item 2', description: 'Description 2' }, | ||
{ title: 'Item 3', description: 'Description 3' }, | ||
]; | ||
it('renders the component with items', () => { | ||
mount(<RoadmapList items={items} />); | ||
//check if the length of list matches | ||
cy.get('[data-testid="RoadmapItem-list"]').should('have.length', items.length); | ||
cy.get('[data-testid="RoadmapList-list"]').should('exist'); | ||
cy.get('[data-testid="RoadmapList-list"]').children().should('have.length', items.length); | ||
}); | ||
|
||
it('renders the component with collapsed items', () => { | ||
mount(<RoadmapList items={items} collapsed={true} />); | ||
// check if collapsed items are 0 | ||
cy.get('[data-testid="RoadmapItem-list"]').should('have.length',0); | ||
|
||
//component is rendered | ||
cy.get('[data-testid="RoadmapList-list"]').should('exist'); | ||
|
||
//items are not rendered when collapsed | ||
cy.get('[data-testid="RoadmapList-list"]').children().should('not.exist'); | ||
}); | ||
}); |