From d220a0ae0ec759c3542edbf12cf76c8b37b5081d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Fidelis?= Date: Mon, 2 May 2022 09:20:23 -0300 Subject: [PATCH 1/2] refactor: change landing page title --- src/pages/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 67e21d844..21f65c109 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -13,7 +13,7 @@ const Home: NextPage = () => { return ( <> - Developers portal | Home + VTEX Developers From 07db875664b65eacd3c87c68e2f315b2d673a340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Fidelis?= Date: Mon, 2 May 2022 17:04:01 -0300 Subject: [PATCH 2/2] test: add a test to simulate user navigation in an API reference page --- .../integration/catalog-API-page.spec.js | 34 +++++++++++++++++++ src/tests/cypress/support/commands.js | 4 +++ 2 files changed, 38 insertions(+) create mode 100644 src/tests/cypress/integration/catalog-API-page.spec.js diff --git a/src/tests/cypress/integration/catalog-API-page.spec.js b/src/tests/cypress/integration/catalog-API-page.spec.js new file mode 100644 index 000000000..155fe40e2 --- /dev/null +++ b/src/tests/cypress/integration/catalog-API-page.spec.js @@ -0,0 +1,34 @@ +/// + +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}`) + }) +}) diff --git a/src/tests/cypress/support/commands.js b/src/tests/cypress/support/commands.js index 119ab03f7..e3152771a 100644 --- a/src/tests/cypress/support/commands.js +++ b/src/tests/cypress/support/commands.js @@ -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) +})