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

feat: adding unit tests for dashboard folder #1735

Merged
merged 67 commits into from
Jul 11, 2023

Conversation

reachaadrika
Copy link
Contributor

Description

Dashboard Component of the website mainly houses for the main 2 sections "GoodFirstIssues" and the issues that are trending the most . Along with this it has mini sub components within itself that culminate together to make the Dashboard component . These components are as follows :

  1. Header : Header component has 3 major links , to contribution guide , AsyncAPI github , and the slack community link , along with that it houses the heading Dashboard with it . The major things that need to be tested were that all 3 links are opened in new tab , heading is displayed and all the buttons and links are in place and open to new tabs . I have wrapped up all these tests and assertions in a single test "renders header correctly " so that we could also see what the component looks like in the test runner too .
    image

  2. GoodFirstIssues Tip : On hovering over this icon it displays basic and small text . I wrote 2 tests for this component "toggles the tip when hovering over the icon" and "renders the tip content with the correct text" . Both these tests passed .
    image

  3. GoodFirstIssues.js : This component culminates other components like Tooltip , filter and others like row and table . This component displays a list of good first issues from github repos and also filters then according to the area and repo that has been selected , it displays them in a row like format . I included 3 major tests , "renders the component correctly " , "filter issues on basis of repository " , and similarly "filters on the basis of area " . I used dummy data for testing purpose .
    image

  4. Along with this it has a bunch of Helper components too , like Table , Row and Filters . I individually have tests for these components too which are as follows :

  5. Row
    image

  6. Table
    image
    7**. Filters**
    image

NOTE : THESE ARE SMALL COMPONENT TESTS , WHICH WOULD BE IN FUTURE BE TAKEN CARE OFF WHILE INTEGRATION TESTING

Related issue(s)
fixes #1729

@netlify
Copy link

netlify bot commented Jun 1, 2023

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 8cdcc85
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/64acf22ec9e28800089873e6
😎 Deploy Preview https://deploy-preview-1735--asyncapi-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions
Copy link

github-actions bot commented Jun 1, 2023

⚡️ Lighthouse report for the changes in this PR:

Category Score
🔴 Performance 29
🟢 Accessibility 98
🟢 Best practices 100
🟢 SEO 100
🔴 PWA 30

Lighthouse ran on https://deploy-preview-1735--asyncapi-website.netlify.app/

@reachaadrika reachaadrika changed the title feat : adding unit testss for dashboard feat: adding unit tests for dashboard folder Jun 1, 2023
@akshatnema akshatnema added the gsoc This label should be used for issues or discussions related to ideas for Google Summer of Code label Jun 1, 2023
// Select a specific repository
cy.get('select[name="selectedRepo"]').select('Repository 1');
// Assert that the table displays the filtered issues
cy.get(Table).should('contain', 'Repository 3');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If repository 1 is selected, then why are we checking for Repository 3 to exist in the render.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done the required changes in current commit .

Comment on lines 8 to 16
<Filters
className="test-class"
issues={[]}
setSelectedRepo={() => {}}
allIssues={[]}
setSelectedArea={() => {}}
selectedArea=""
selectedRepo=""
/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test for filters shouldn't be tested only for it's existence, it's important that we should test it's functionality too by passing correct attributes inside it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done the required changes in current commit .

@akshatnema akshatnema requested a review from imabp June 3, 2023 07:16
cypress/test/dashboard/table/filters.cy.js Outdated Show resolved Hide resolved
cypress/test/dashboard/table/filters.cy.js Outdated Show resolved Hide resolved
cypress/test/dashboard/table/filters.cy.js Outdated Show resolved Hide resolved
cypress/test/dashboard/table/table.cy.js Outdated Show resolved Hide resolved
components/dashboard/table/Filters.js Outdated Show resolved Hide resolved
components/dashboard/table/Table.js Outdated Show resolved Hide resolved
cypress/test/dashboard/GoodFirstIssuesTip.cy.js Outdated Show resolved Hide resolved
components/dashboard/table/Pagination.js Outdated Show resolved Hide resolved
components/dashboard/table/Pagination.js Outdated Show resolved Hide resolved
components/dashboard/table/Pagination.js Outdated Show resolved Hide resolved
components/dashboard/GoodFirstIssues.js Outdated Show resolved Hide resolved
Copy link
Member

@akshatnema akshatnema left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the file names of test files to Filters.cy.js, Row.cy.js and Table.cy.js.

Copy link
Member

@akshatnema akshatnema left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also update the file name to Header.cy.js

@reachaadrika
Copy link
Contributor Author

/rtm

@asyncapi-bot asyncapi-bot merged commit df1b59d into asyncapi:master Jul 11, 2023
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gsoc This label should be used for issues or discussions related to ideas for Google Summer of Code ready-to-merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add unit tests for 'dashboard' component
4 participants