-
-
Notifications
You must be signed in to change notification settings - Fork 765
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 InlineHelp ,MacWindow , Newsletter , Profile ,Remember and Warning components #1827
Conversation
✅ Deploy Preview for asyncapi-website ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-1827--asyncapi-website.netlify.app/ |
cypress/test/InlineHelp.cy.js
Outdated
cy.get('[data-testid="InlineHelp"]').should('not.exist'); | ||
|
||
// Click on the question mark icon to show text | ||
cy.get('svg').click(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data-testID @reachaadrika
cypress/test/InlineHelp.cy.js
Outdated
cy.get('[data-testid="InlineHelp"]').should('be.visible').should('contain', text); | ||
|
||
// Click on the question mark icon again to hide text | ||
cy.get('svg').click(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data-testID @reachaadrika
cypress/test/InlineHelp.cy.js
Outdated
cy.get('[data-testid="InlineHelp"]').should('not.exist'); | ||
|
||
// Hover the question mark icon to show text | ||
cy.get('svg').trigger('mouseover'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data-testID @reachaadrika
cypress/test/InlineHelp.cy.js
Outdated
cy.get('[data-testid="InlineHelp"]').should('be.visible').should('contain', text); | ||
|
||
// Move the cursor from the question mark icon to hide text | ||
cy.get('svg').trigger('mouseout'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data-testID @reachaadrika
cypress/test/MacWindow.cy.js
Outdated
cy.get('div') | ||
.should('have.class', className) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data-testID @reachaadrika
it('renders the component with default props', () => { | ||
mount(<NewsletterSubscribe />); | ||
|
||
cy.get('div.p-8.text-center').should('exist'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data-testID @reachaadrika
mount(<NewsletterSubscribe />); | ||
|
||
cy.get('div.p-8.text-center').should('exist'); | ||
cy.contains('Subscribe to our newsletter').should('exist'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
declare all the hardcode text in a constant variable, and use it here
const NewsletterConstants = [
"sentence1",
"sentence2"
]
And use Newsletter[0] like that, so the code becomes maintainable, when the text changes.
|
||
cy.get('div.p-8.text-center').should('exist'); | ||
cy.contains('Subscribe to our newsletter').should('exist'); | ||
cy.contains( 'We respect your inbox. No spam, promise ✌️').should('exist'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as discussed above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor Changes, please fix asap
@reachaadrika Kindly update the PR title related to changes inside PR |
…a/website into additional_testcases
…chaadrika/website into additional_tests" This reverts commit b90f9f9, reversing changes made to 7bcda57.
This reverts commit ab05b65.
… additional_tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make the relevant changes inside test files as well, regarding naming conventions.
components/MacWindow.js
Outdated
{title} | ||
</div> | ||
<div className="hidden sm:block"> {/* This block is used for aligning the title on the center */} | ||
<div className="hidden sm:block" data-testid="MacWindow-title"> {/* This block is used for aligning the title on the center */} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<div className="hidden sm:block" data-testid="MacWindow-title"> {/* This block is used for aligning the title on the center */} | |
<div className="hidden sm:block" data-testid="MacWindow-title-center"> {/* This block is used for aligning the title on the center */} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
components/NewsletterSubscribe.js
Outdated
@@ -13,13 +13,14 @@ export default function NewsletterSubscribe ({ | |||
const paragraphTextColor = dark ? 'text-gray-300' : '' | |||
|
|||
return ( | |||
<div className={className}> | |||
<div className={className} data-testid="NewsletterSubscribe-div"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<div className={className} data-testid="NewsletterSubscribe-div"> | |
<div className={className} data-testid="NewsletterSubscribe-main"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
components/Profile.js
Outdated
@@ -3,9 +3,9 @@ export default function Profile({profiles = [], className}) { | |||
return null; | |||
} | |||
return ( | |||
<div className="p-4 grid grid-cols-2 sm:grid-cols-4 gap-5 border border-slate-100 mt-4 rounded drop-shadow-md"> | |||
<div className="p-4 grid grid-cols-2 sm:grid-cols-4 gap-5 border border-slate-100 mt-4 rounded drop-shadow-md" data-testid="Profiles-div"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<div className="p-4 grid grid-cols-2 sm:grid-cols-4 gap-5 border border-slate-100 mt-4 rounded drop-shadow-md" data-testid="Profiles-div"> | |
<div className="p-4 grid grid-cols-2 sm:grid-cols-4 gap-5 border border-slate-100 mt-4 rounded drop-shadow-md" data-testid="Profiles-main"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
components/Remember.js
Outdated
@@ -2,10 +2,10 @@ import LightBulb from './icons/LightBulb' | |||
|
|||
export default function Remember({ title = 'Remember', className, children }) { | |||
return ( | |||
<div className={`${className} p-4 mt-4 mb-8 bg-secondary-100 rounded text-gray-900`}> | |||
<h5 className="pb-2 mb-4 border-b border-gray-900 text-lg"> | |||
<div className={`${className} p-4 mt-4 mb-8 bg-secondary-100 rounded text-gray-900`} data-testid="Remember-div"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<div className={`${className} p-4 mt-4 mb-8 bg-secondary-100 rounded text-gray-900`} data-testid="Remember-div"> | |
<div className={`${className} p-4 mt-4 mb-8 bg-secondary-100 rounded text-gray-900`} data-testid="Remember-main"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
config/AMBASSADORS_MEMBERS.json
Outdated
@@ -225,7 +225,7 @@ | |||
"github": "M3lkior", | |||
"twitter": "ldussart", | |||
"country": "🇫🇷", | |||
"bio": "Ludovic has been working for Ineat for the last 10 years. Starting as a java developer, he is now a Solutions Architect, working with his customers to build EDA-oriented digital products wherever possible. His first contributions to AsyncAPI date back to 2020 around the kafka and avro specifications. Since then, Ludovic has been spreading the word about AsyncAPI to companies in Northern France, to accelerate adoption of the initiative.", | |||
"bio": "Ludovic is an Ineat employee since 10 years. Starting as java developer, he is now Solutions Architect and work with his customers to build digital products, EDA oriented when possible. His first contributions on AsyncAPI was in 2020 around the kafka and avro specifications. Since this day, Ludovic talk about AsyncAPI in the North of France compagnies in order to speedup the initiative adoption.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the Ambassadors data has been changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not mean to change , this , it reflects the changes made by a merge commit . This is not the change I made .
cypress/test/MacWindow.cy.js
Outdated
const title = ''; | ||
const children = ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some title and child elements here to test the component correctly and preview the Component in Cypress.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
cypress/test/MacWindow.cy.js
Outdated
const className = 'my-mac-window'; | ||
const contentClassName = 'my-content'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add correct classNames accordingly to check the properties similarly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
cy.contains(NewsletterConstants[0]).should('exist'); | ||
cy.contains(NewsletterConstants[1]).should('exist'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should insert the data inside forms instead of checking the data inside array this way. You can refer to - https://www.browserstack.com/guide/how-to-fill-and-submit-forms-in-cypress, to type the content inside forms and then check after submitting it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay @akshatnema will keep in mind
cypress/test/Profile.cy.js
Outdated
{ | ||
name: 'John Doe', | ||
link: 'https://example.com/john', | ||
avatar: 'john-avatar.png', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add proper filepath for avatar here from public folder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Co-authored-by: Akshat Nema <76521428+akshatnema@users.noreply.github.com>
…bsite into additional_tests
Co-authored-by: Akshat Nema <76521428+akshatnema@users.noreply.github.com>
Co-authored-by: Akshat Nema <76521428+akshatnema@users.noreply.github.com>
Co-authored-by: Akshat Nema <76521428+akshatnema@users.noreply.github.com>
Co-authored-by: Akshat Nema <76521428+akshatnema@users.noreply.github.com>
Co-authored-by: Akshat Nema <76521428+akshatnema@users.noreply.github.com>
/rtm |
Description
1. InlineHelp.js : This is a toggle / hover component where when we hover on the Question Mark Icon , a helper text appears . The tests I have included here are as follows :
2. MacWindow.js : In this component , a MAC like UI has to appear , the tests I have included here are as follows :
3. NewsletterSubscribe : In this component , I have added the following tests :
4.Profile : For this profile component , I have added the following tests :
5. Remember : I have included following tests for this component :
6. Warning : I have included following tests for this component :
![image](https://private-user-images.githubusercontent.com/64789514/248000369-1403b275-e5df-488c-bc09-1554175d22ac.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5MDIwOTAsIm5iZiI6MTczODkwMTc5MCwicGF0aCI6Ii82NDc4OTUxNC8yNDgwMDAzNjktMTQwM2IyNzUtZTVkZi00ODhjLWJjMDktMTU1NDE3NWQyMmFjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA3VDA0MTYzMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY4NGI3YTZjZjI5ODVjYzUyZTQyMjc1Y2QxZTFmY2ZjODQ0NTlmYzllOGJmNTdjMjAyZjc2NDcyZGU2MzI3OGQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.cXpp_n85tVVT_zYJ9nddPApp1mfBO1HTAL7y6h3Zg80)
-renders the component with the provided title and description
Related issue(s)
fixes #1826