test(techdocs): cover entity docs sub-routes
Signed-off-by: Camila Belo <camilaibs@gmail.com>
This commit is contained in:
@@ -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');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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: {
|
||||
|
||||
Vendored
+5
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user