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: add integration tests for dashboard component & community pages #1953

Merged

Conversation

reachaadrika
Copy link
Contributor

Description

  • Dashboard , component mainly has following components :

    1. GoodfirstIssues.js
    2. GoodFirstIssuesTooltip
    3. Header.js
    4. Table , Filters , Row .
  • The flow of test for this , is that dashboard component has GoodFirstIssues component , which displays goodFirstIssues , but also Filters them according to repository and areas , and displays the filtered data in the component . It uses the Filters Component , which within itself uses Select Component . Thus the test for this involved as follows :

    1. Testing if all issues are displayed in the GoodFirstIssues component .
    2. Checking if Filter Menu is displayed in GoodFirstIssues , & Further check if it selects the repository , and area which are hardcoded for now ( from Select Component ) .
    3. Final check was to check if only selected repos and areas are displayed .
  • Finally I checked if the hotTopics , is displayed correctly in the Table component .

-The data that has been utilized here is dashboard.json

NOTE : This PR also includes some fixes associated with the unit tests written for dashboard component .

Related issue(s)
fixes #1952

@netlify
Copy link

netlify bot commented Jul 14, 2023

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit b32aece
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/64c939c88fb6d30008a93935
😎 Deploy Preview https://deploy-preview-1953--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 Jul 14, 2023

⚡️ Lighthouse report for the changes in this PR:

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

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

@akshatnema akshatnema changed the title feat: adding integration tests for dashboard component feat: add integration tests for dashboard component Jul 16, 2023
@akshatnema akshatnema added the gsoc This label should be used for issues or discussions related to ideas for Google Summer of Code label Jul 16, 2023
@reachaadrika reachaadrika changed the title feat: add integration tests for dashboard component feat: add integration tests for dashboard component & community pages Jul 18, 2023
Comment on lines 29 to 30
cy.contains('View on Github')
cy.contains('Join on Slack')
Copy link
Member

Choose a reason for hiding this comment

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

Why did we change these tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Comment on lines 64 to 73
it('should display NewsletterSubscribe',()=>{
cy.get('[data-testid="CommunityCard-subscribe"]').should('exist');
cy.get('[data-testid="NewsletterSubscribe-main"]').should('exist');
cy.get('[data-testid="NewsletterSubscribe-text-input"]').type("name");
cy.get('[data-testid="NewsletterSubscribe-email-input"]').type("[email protected]")
cy.get('form[name="form 1"]').should('exist');
cy.get('input[name="type"]').should('exist');
cy.get('input[name="name"]').should('exist');
cy.get('input[name="email"]').should('exist');
});
Copy link
Member

Choose a reason for hiding this comment

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

This test shouldn't be repeated for every file. Instead, make integration test for this component in NewsletterSubscribe test file. Also, mock the API response for this form.

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

cy.get('[ data-testid="Meeting-host"]').should('exist')
cy.get('[ data-testid="Meeting-link"]').should('exist')
});

Copy link
Member

Choose a reason for hiding this comment

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

Add integration tests for events filter in this test file.

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

Comment on lines 61 to 64
cy.contains('Tokens of our appreciation').should('exist');

cy.contains('We appreciate your commitment and passion for sharing your knowledge with your communities. Let us support you!')
.should('exist');
Copy link
Member

Choose a reason for hiding this comment

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

Instead of checking for the content, check for the respective tags, whether they are present. We are not concerned about testing the content inside the tag, we are testing whether the heading and relative content to it is present or not.

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

Comment on lines 74 to 77
cy.contains('Become an AsyncAPI Ambassador').should('exist');

cy.contains('The AsyncAPI Ambassador program is now open for applications! If you’re selected, you’ll join AsyncAPI\'s mission of helping community members all over the world, build the future of Event-Driven APIs.')
.should('exist');
Copy link
Member

Choose a reason for hiding this comment

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

Don't check for content, check for the tags using data-testid.

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

Comment on lines -25 to -26
cy.get('[data-testid="Github-button"]').should('exist');
cy.get('[data-testid="Slack-button"]').should('exist');
Copy link
Member

Choose a reason for hiding this comment

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

These lines shouldn't be removed. We should also check for buttons using data-testid also, apart from checking it via text.

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

@@ -0,0 +1,27 @@
import AppContext from "../../context/AppContext";
Copy link
Member

Choose a reason for hiding this comment

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

Specify why MockApp has been created using comments.

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

});

it('check for Events Filters' , () => {
cy.get('[data-testid="EventFilters-main"]').should('exist');
Copy link
Member

Choose a reason for hiding this comment

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

Kindly apply the Event filters and check whether correct events are shown or not.

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

@akshatnema
Copy link
Member

/rtm

@asyncapi-bot asyncapi-bot merged commit c5b57b3 into asyncapi:master Aug 1, 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.

Integration tests for Dashboard Filters
3 participants