Skip to content

Commit

Permalink
Merge pull request #32 from vtex/add/rapidoc-test
Browse files Browse the repository at this point in the history
Add/rapidoc test
  • Loading branch information
JosueFidelis authored May 9, 2022
2 parents 296b561 + 07db875 commit ec99581
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const Home: NextPage = () => {
return (
<>
<Head>
<title>Developers portal | Home</title>
<title>VTEX Developers</title>
</Head>
<Grid sx={styles.grid}>
<NewsletterSection />
Expand Down
34 changes: 34 additions & 0 deletions src/tests/cypress/integration/catalog-API-page.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/// <reference types="cypress" />

describe('Catalog API', () => {
beforeEach(() => {
cy.visit('/docs/api-reference/catalog#overview')
})

it('API search', () => {
const typedText = 'Create SKU Service Value'

cy.getRapidocElement('#nav-bar-search').type(`${typedText}{enter}`)

cy.getRapidocElement('.nav-scroll').children('div').should('have.length', 5)

cy.getRapidocElement('.nav-scroll')
.children('.nav-bar-tag-and-paths')
.should('have.length', 1)
.children('div')
.should('have.length', 2)

cy.getRapidocElement('.nav-scroll')
.find('.nav-bar-tag-and-paths > div')
.eq(0)
.should('contain', 'SKU Service Value')

cy.getRapidocElement('.nav-scroll')
.find('.nav-bar-tag-and-paths > div')
.eq(1)
.contains(typedText)
.click()

cy.getRapidocElement('h2').should('contain', `${typedText}`)
})
})
4 changes: 4 additions & 0 deletions src/tests/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })

Cypress.Commands.add('getRapidocElement', (selector) => {
cy.get('rapi-doc').shadow().find(selector)
})

0 comments on commit ec99581

Please sign in to comment.