From aa4a267abe044712a777091b43054df87c8a527a Mon Sep 17 00:00:00 2001 From: Alex Varchuk Date: Thu, 23 Sep 2021 14:54:42 +0300 Subject: [PATCH] chore: add integration test for cover issue --- e2e/integration/menu.e2e.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/e2e/integration/menu.e2e.ts b/e2e/integration/menu.e2e.ts index e1b053d1..533fb0ea 100644 --- a/e2e/integration/menu.e2e.ts +++ b/e2e/integration/menu.e2e.ts @@ -25,6 +25,29 @@ describe('Menu', () => { .should('be.visible'); }); + it('should sync active menu items while scroll back and scroll again', () => { + cy.contains('h2', 'Add a new pet to the store') + .scrollIntoView() + .wait(100) + .get('[role=menuitem].active') + .children() + .last() + .should('have.text', 'Add a new pet to the store') + .should('be.visible'); + + cy.contains('h1', 'Swagger Petstore') + .scrollIntoView() + .wait(100) + + cy.contains('h1', 'Introduction') + .scrollIntoView() + .wait(100) + .get('[role=menuitem].active') + .should('have.text', 'Introduction'); + + cy.url().should('include', '#section/Introduction'); + }); + it('should update URL hash when clicking on menu items', () => { cy.contains('[role=menuitem].-depth1', 'pet').click({ force: true }); cy.location('hash').should('equal', '#tag/pet');