test(techdocs): cover entity docs sub-routes

Signed-off-by: Camila Belo <camilaibs@gmail.com>
This commit is contained in:
Camila Belo
2022-05-17 12:40:16 +02:00
parent 449d6527e4
commit 7977420779
3 changed files with 66 additions and 0 deletions
@@ -25,5 +25,62 @@ describe('Catalog', () => {
cy.contains('Owned (10)').should('be.visible');
});
it('Should navigate to a docs tab', () => {
cy.loginAsGuest();
cy.visit('/catalog');
cy.contains('techdocs-e2e-fixture').click();
cy.location().should(loc => {
expect(loc.pathname).to.eq(
'/catalog/default/component/techdocs-e2e-fixture',
);
});
cy.getCatalogDocsTab().click();
cy.getTechDocsShadowRoot()
.find('h1')
.contains('Home page')
.should('be.visible');
});
it('Should navigate to a sub-route in docs tab', () => {
cy.loginAsGuest();
cy.visit('/catalog');
cy.contains('techdocs-e2e-fixture').click();
cy.location().should(loc => {
expect(loc.pathname).to.eq(
'/catalog/default/component/techdocs-e2e-fixture',
);
});
cy.getCatalogDocsTab().click();
cy.getTechDocsShadowRoot()
.find('h1')
.contains('Home page')
.should('be.visible');
cy.getTechDocsShadowRoot().within(() => {
cy.getTechDocsNavigation().find('a').contains('Sub-page 1').click();
});
cy.location().should(loc => {
expect(loc.pathname).to.eq(
'/catalog/default/component/techdocs-e2e-fixture/docs/sub-page-one/',
);
});
cy.getTechDocsShadowRoot()
.find('h1')
.contains('Sub-page 1')
.should('be.visible');
});
});
});
+4
View File
@@ -64,6 +64,10 @@ Cypress.Commands.add('getTechDocsNavigation', () => {
cy.get('[data-md-type="navigation"]');
});
Cypress.Commands.add('getCatalogDocsTab', () => {
cy.get('button[role="tab"]').contains('Docs');
});
Cypress.Commands.add('mockSockJSNode', () => {
cy.intercept('GET', '**/sockjs-node/info**', {
body: {
+5
View File
@@ -42,6 +42,11 @@ declare namespace Cypress {
* @example cy.getTechDocsNavigation
*/
getTechDocsNavigation(): Chainable<Element>;
/**
* Get the Catalog docs tab
* @example cy.getCatalogDocsTab
*/
getCatalogDocsTab(): Chainable<Element>;
/**
* Intercept the TechDocs API calls
* @example cy.interceptTechDocsAPICalls