diff --git a/components/OpenAPIComparison.js b/components/OpenAPIComparison.js index a556c7b6a17..14cb59391a5 100644 --- a/components/OpenAPIComparison.js +++ b/components/OpenAPIComparison.js @@ -15,41 +15,41 @@ export default function OpenAPIComparison({ className = '' }) { }); return ( -
+

OpenAPI 3.0

-
setHoverState(prevState => ({ ...prevState, Info: true }))} onMouseLeave={() => setHoverState({ ...hoverState, Info: false })}> +
setHoverState(prevState => ({ ...prevState, Info: true })) } onMouseLeave={ () => setHoverState({ ...hoverState, Info: false }) } data-testid="OpenAPI-sec-info"> Info
-
setHoverState(prevState => ({ ...prevState, Servers: true }))} onMouseLeave={() => setHoverState({ ...hoverState, Servers: false })}> +
setHoverState(prevState => ({ ...prevState, Servers: true })) } onMouseLeave={ () => setHoverState({ ...hoverState, Servers: false }) } data-testid="OpenAPI-sec-servers"> Servers
Security
-
setHoverState(prevState => ({ ...prevState, Paths: true }))} onMouseLeave={() => setHoverState({ ...hoverState, Paths: false })}> +
setHoverState(prevState => ({ ...prevState, Paths: true })) } onMouseLeave={ () => setHoverState({ ...hoverState, Paths: false }) } data-testid="OpenAPI-paths"> Paths
-
{ return setHoverState(prevState => ({ ...prevState, PathItem: true })) }} onMouseLeave={() => { return setHoverState({ ...hoverState, PathItem: false }) }}> +
{ return setHoverState(prevState => ({ ...prevState, PathItem: true })) } } onMouseLeave={ () => { return setHoverState({ ...hoverState, PathItem: false }) } } data-testid="OpenAPI-path-item"> Path Item
-
setHoverState(prevState => ({ ...prevState, Summary: true }))} onMouseLeave={() => { return setHoverState({ ...hoverState, Summary: false }) }}> +
setHoverState(prevState => ({ ...prevState, Summary: true })) } onMouseLeave={ () => { return setHoverState({ ...hoverState, Summary: false }) } } data-testid="OpenAPI-summary"> Summary and description
-
setHoverState(prevState => ({ ...prevState, Operation: true }))} onMouseLeave={() => setHoverState({ ...hoverState, Operation: false })}> +
setHoverState(prevState => ({ ...prevState, Operation: true })) } onMouseLeave={ () => setHoverState({ ...hoverState, Operation: false }) } data-testid="OpenAPI-operation"> Operation (GET, PUT, POST, etc.)
-
setHoverState(prevState => ({ ...prevState, Message: true }))} onMouseLeave={() => setHoverState({ ...hoverState, Message: false })}> +
setHoverState(prevState => ({ ...prevState, Message: true })) } onMouseLeave={ () => setHoverState({ ...hoverState, Message: false }) } data-testid="OpenAPI-request"> Request
-
setHoverState(prevState => ({ ...prevState, Message: true }))} onMouseLeave={() => setHoverState({ ...hoverState, Message: false })}> +
setHoverState(prevState => ({ ...prevState, Message: true })) } onMouseLeave={ () => setHoverState({ ...hoverState, Message: false }) } data-testid="OpenAPI-responses"> Responses
@@ -60,14 +60,14 @@ export default function OpenAPIComparison({ className = '' }) {
-
setHoverState(prevState => ({ ...prevState, Tags: true }))} onMouseLeave={() => setHoverState({ Tags: false })}> +
setHoverState(prevState => ({ ...prevState, Tags: true })) } onMouseLeave={ () => setHoverState({ Tags: false }) } data-testid="OpenAPI-tags">

Tags

-
setHoverState(prevState => ({ ...prevState, External: true }))} onMouseLeave={() => setHoverState({ External: false })}> +
setHoverState(prevState => ({ ...prevState, External: true })) } onMouseLeave={ () => setHoverState({ External: false }) } data-testid="OpenAPI-external">

External Docs

-
setHoverState(prevState => ({ ...prevState, Components: true }))} onMouseLeave={() => setHoverState({ Components: false })}> +
setHoverState(prevState => ({ ...prevState, Components: true })) } onMouseLeave={ () => setHoverState({ Components: false }) } data-testid="OpenAPI-components"> Components
@@ -101,32 +101,32 @@ export default function OpenAPIComparison({ className = '' }) {

AsyncAPI 2.0

-
setHoverState(prevState => ({ ...prevState, Info: true }))} onMouseLeave={() => setHoverState({ Info: false })}> +
setHoverState(prevState => ({ ...prevState, Info: true })) } onMouseLeave={ () => setHoverState({ Info: false }) }> Info
-
setHoverState(prevState => ({ ...prevState, Servers: true }))} onMouseLeave={() => setHoverState({ Servers: false })}> +
setHoverState(prevState => ({ ...prevState, Servers: true })) } onMouseLeave={ () => setHoverState({ Servers: false }) }> Servers (hosts + security)
-
setHoverState(prevState => ({ ...prevState, Paths: true }))} onMouseLeave={() => setHoverState({ Paths: false })}> +
setHoverState(prevState => ({ ...prevState, Paths: true })) } onMouseLeave={ () => setHoverState({ Paths: false }) }> Channel
-
setHoverState(prevState => ({ ...prevState, PathItem: true }))} onMouseLeave={() => setHoverState({ PathItem: false })}> +
setHoverState(prevState => ({ ...prevState, PathItem: true })) } onMouseLeave={ () => setHoverState({ PathItem: false }) }> Channel Item
-
setHoverState(prevState => ({ ...prevState, Operation: true }))} onMouseLeave={() => setHoverState({ Operation: false })}> +
setHoverState(prevState => ({ ...prevState, Operation: true })) } onMouseLeave={ () => setHoverState({ Operation: false }) }> Operation (Publish and Subscribe)
-
setHoverState(prevState => ({ ...prevState, Summary: true }))} onMouseLeave={() => setHoverState({ Summary: false })} > +
setHoverState(prevState => ({ ...prevState, Summary: true })) } onMouseLeave={ () => setHoverState({ Summary: false }) } > Summary, description, tags, etc.
-
setHoverState(prevState => ({ ...prevState, Message: true }))} onMouseLeave={() => setHoverState({ Message: false })}> +
setHoverState(prevState => ({ ...prevState, Message: true })) } onMouseLeave={ () => setHoverState({ Message: false }) }> Message
@@ -150,14 +150,14 @@ export default function OpenAPIComparison({ className = '' }) {
-
setHoverState(prevState => ({ ...prevState, Tags: true }))} onMouseLeave={() => setHoverState({ Tags: false })}> +
setHoverState(prevState => ({ ...prevState, Tags: true })) } onMouseLeave={ () => setHoverState({ Tags: false }) }>

Tags

-
setHoverState(prevState => ({ ...prevState, External: true }))} onMouseLeave={() => setHoverState({ External: false })}> +
setHoverState(prevState => ({ ...prevState, External: true })) } onMouseLeave={ () => setHoverState({ External: false }) }>

External Docs

-
setHoverState(prevState => ({ ...prevState, Components: true }))} onMouseLeave={() => setHoverState({ Components: false })}> +
setHoverState(prevState => ({ ...prevState, Components: true })) } onMouseLeave={ () => setHoverState({ Components: false }) }> Components
diff --git a/cypress/test/AlgoliaSearch.cy.js b/cypress/test/AlgoliaSearch.cy.js new file mode 100644 index 00000000000..21d2654a6d2 --- /dev/null +++ b/cypress/test/AlgoliaSearch.cy.js @@ -0,0 +1,27 @@ +import { mount } from 'cypress/react' +import AlgoliaSearch from '../../components/AlgoliaSearch' +import { SearchButton } from '../../components/AlgoliaSearch'; +import { DocSearchModal } from '@docsearch/react' + +describe('AlgoliaSearch component', () => { + it('renders without errors', () => { + mount( + + Search + + ) + }) + + it('performs search for a specific page', () => { + mount( + + Open Search + + ); + cy.get('button').click(); // Open the search modal + cy.get('input[placeholder="Search resources"]').type('welcome') + cy.should('have.value', 'welcome') + // Check if the docsearch-list element contains the text 'Welcome' + cy.get('#docsearch-list').contains('Welcome') + }); +}); \ No newline at end of file diff --git a/cypress/test/GeneratorInstallation.cy.js b/cypress/test/GeneratorInstallation.cy.js new file mode 100644 index 00000000000..0428284badf --- /dev/null +++ b/cypress/test/GeneratorInstallation.cy.js @@ -0,0 +1,8 @@ +import { mount } from 'cypress/react'; +import GeneratorInstallation from '../../components/GeneratorInstallation'; + +describe('GeneratorInstallation', () => { + it('renders without errors', () => { + mount(); + }); +}); \ No newline at end of file diff --git a/cypress/test/OpenAPIComparison.cy.js b/cypress/test/OpenAPIComparison.cy.js new file mode 100644 index 00000000000..86de5e2dd51 --- /dev/null +++ b/cypress/test/OpenAPIComparison.cy.js @@ -0,0 +1,57 @@ +import { mount } from '@cypress/react' +import OpenAPIComparison from '../../components/OpenAPIComparison' + +describe('OpenAPIComparison', () => { + it('renders without errors', () => { + mount(); + + }); + + it('changes background color on hover', () => { + mount(); + + // Hover over the "Info" element + cy.contains('Info').trigger('mouseover'); + cy.get('[data-testid="OpenAPI-sec-info"]').should('exist'); + + // Hover over the "Servers" element + cy.contains('Servers').trigger('mouseover'); + cy.get('[data-testid="OpenAPI-sec-servers"]').should('exist'); + + // Hover over the "Paths" element + cy.contains('Paths').trigger('mouseover'); + cy.get('[data-testid="OpenAPI-paths"]').should('exist'); + + // Hover over the "Path Item" element + cy.contains('Path Item').trigger('mouseover'); + cy.get('[data-testid="OpenAPI-path-item"]').should('exist'); + + // Hover over the "Summary and description" element + cy.contains('Summary and description').trigger('mouseover'); + cy.get('[data-testid="OpenAPI-summary"]').should('exist'); + + // Hover over the "Operation (GET, PUT, POST, etc.)" element + cy.contains('Operation (GET, PUT, POST, etc.)').trigger('mouseover'); + cy.get('[data-testid="OpenAPI-operation"]').should('exist'); + + // Hover over the "Request" element + cy.contains('Request').trigger('mouseover'); + cy.get('[data-testid="OpenAPI-request"]').should('exist'); + + // Hover over the "Responses" element + cy.contains('Responses').trigger('mouseover'); + cy.get('[data-testid="OpenAPI-responses"]').should('exist'); + + // Hover over the "Tags" element + cy.contains('Tags').trigger('mouseover'); + cy.get('[data-testid="OpenAPI-tags"]').should('exist'); + + // Hover over the "External Docs" element + cy.contains('External Docs').trigger('mouseover'); + cy.get('[data-testid="OpenAPI-external"]').should('exist'); + + // Hover over the "Components" element + cy.contains('Components').trigger('mouseover'); + cy.get('[data-testid="OpenAPI-components"]').should('exist'); + }); +});