-
-
Notifications
You must be signed in to change notification settings - Fork 638
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
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
75d8ccc
adding tests for remaining files
reachaadrika 549b2ec
Merge branch 'master' of https://github.com/reachaadrika/website into…
reachaadrika 52f6a53
Merge branch 'master' into new_tests
reachaadrika 1ccc3e8
Merge branch 'master' into new_tests
reachaadrika 57c5b7c
Merge branch 'master' into new_tests
reachaadrika 2d024b0
Merge branch 'master' into new_tests
reachaadrika f542533
Merge branch 'master' into new_tests
reachaadrika be5effd
Merge branch 'master' into new_tests
reachaadrika 6f2693d
Merge branch 'master' into new_tests
reachaadrika 86b15d3
Merge branch 'master' into new_tests
reachaadrika e5da592
Merge branch 'master' into new_tests
reachaadrika 80b330e
fixes and new changes
reachaadrika 6c76a05
Merge branch 'new_tests' of https://github.com/reachaadrika/website i…
reachaadrika 77db5ea
Merge branch 'master' of https://github.com/reachaadrika/website into…
reachaadrika 9f185b9
Merge branch 'master' into new_tests
reachaadrika 6e86161
Merge branch 'master' into new_tests
reachaadrika 74d88fc
add check for docssearch-list
reachaadrika 2a12993
Update formatting
akshatnema File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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( | ||
<AlgoliaSearch> | ||
<SearchButton>Search</SearchButton> | ||
</AlgoliaSearch> | ||
) | ||
}) | ||
|
||
it('performs search for a specific page', () => { | ||
mount( | ||
<AlgoliaSearch> | ||
<SearchButton>Open Search</SearchButton> | ||
</AlgoliaSearch> | ||
); | ||
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') | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { mount } from 'cypress/react'; | ||
import GeneratorInstallation from '../../components/GeneratorInstallation'; | ||
|
||
describe('GeneratorInstallation', () => { | ||
it('renders without errors', () => { | ||
mount(<GeneratorInstallation />); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { mount } from '@cypress/react' | ||
import OpenAPIComparison from '../../components/OpenAPIComparison' | ||
|
||
describe('OpenAPIComparison', () => { | ||
it('renders without errors', () => { | ||
mount(<OpenAPIComparison />); | ||
|
||
}); | ||
|
||
it('changes background color on hover', () => { | ||
mount(<OpenAPIComparison />); | ||
|
||
// 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'); | ||
}); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 thedocsearch-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