-
-
Notifications
You must be signed in to change notification settings - Fork 637
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 unit tests for AlgoliaSearch,GeneratorInstallation and OpenAPIComparison component #1916
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-1916--asyncapi-website.netlify.app/ |
components/OpenAPIComparison.js
Outdated
<div className="flex-1 border border-black p-2 mr-1"> | ||
<h3 className="text-lg font-sans font-medium mb-4 ml-2">OpenAPI 3.0</h3> | ||
|
||
<div> | ||
<div className={(hoverState.Info ? `bg-blue-100 ` : ` `) + `border border-blue-300 p-2 m-2`} onMouseOver={() => setHoverState(prevState => ({ ...prevState, Info: true }))} onMouseLeave={() => setHoverState({ ...hoverState, Info: false })}> | ||
<div className={ (hoverState.Info ? `bg-blue-100 ` : ` `) + `border border-blue-300 p-2 m-2` } onMouseOver={ () => setHoverState(prevState => ({ ...prevState, Info: true })) } onMouseLeave={ () => setHoverState({ ...hoverState, Info: false }) } data-testid="OpenAPI-sec1"> |
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={ (hoverState.Info ? `bg-blue-100 ` : ` `) + `border border-blue-300 p-2 m-2` } onMouseOver={ () => setHoverState(prevState => ({ ...prevState, Info: true })) } onMouseLeave={ () => setHoverState({ ...hoverState, Info: false }) } data-testid="OpenAPI-sec1"> | |
<div className={ (hoverState.Info ? `bg-blue-100 ` : ` `) + `border border-blue-300 p-2 m-2` } onMouseOver={ () => setHoverState(prevState => ({ ...prevState, Info: true })) } onMouseLeave={ () => setHoverState({ ...hoverState, Info: false }) } data-testid="OpenAPI-sec-info"> |
Don't make the test ids as 1,2,3..., use the correct names to identify them easily.
Applicable everywhere.
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.
cypress/test/AlgoliaSearch.cy.js
Outdated
import AlgoliaSearch from '../../components/AlgoliaSearch' | ||
describe('AlgoliaSearch component', () => { | ||
it('renders without errors', () => { | ||
mount(<AlgoliaSearch />); |
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 have to use SearchButton inside AlgoliaSearch
to test the component.
Also, derive a case where it searches for certain page inside docs, by typing it in the search box.
components/OpenAPIComparison.js
Outdated
<div className="flex-1 border border-black p-2 mr-1"> | ||
<h3 className="text-lg font-sans font-medium mb-4 ml-2">OpenAPI 3.0</h3> | ||
|
||
<div> | ||
<div className={(hoverState.Info ? `bg-blue-100 ` : ` `) + `border border-blue-300 p-2 m-2`} onMouseOver={() => setHoverState(prevState => ({ ...prevState, Info: true }))} onMouseLeave={() => setHoverState({ ...hoverState, Info: false })}> | ||
<div className={ (hoverState.Info ? `bg-blue-100 ` : ` `) + `border border-blue-300 p-2 m-2` } onMouseOver={ () => setHoverState(prevState => ({ ...prevState, Info: true })) } onMouseLeave={ () => setHoverState({ ...hoverState, Info: false }) } data-testid="OpenAPI-sec1"> |
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.
@reachaadrika Kindly resolve the conflicts in this. |
@akshatnema resolved |
|
||
cy.get('input[placeholder="Search resources"]').type('welcome') | ||
cy.should('have.value', 'welcome') | ||
}); |
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 the check of getting Welcome
inside the docsearch-list
ul list of DOM.
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
/rtm |
Description
AlgoliaSearch : This is the search component for website .
GeneratorInstallation : This generates the content for the editor component .
OpenAPIComparison : This component is part of the Docs Layout and I have tested for hover and matching colors of the component .
Related issue(s)
fixes #1915