From d0e037c5866e5a20fc966d04f1c233c40ba6b3a7 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Mon, 16 Jul 2018 18:29:36 +0300 Subject: [PATCH] chore: remove some {force: true} from e2e tests --- e2e/integration/menu.e2e.ts | 21 +++++++++------------ e2e/integration/search.e2e.ts | 29 ++++++++++++++--------------- e2e/integration/standalone.e2e.ts | 6 +++--- 3 files changed, 26 insertions(+), 30 deletions(-) diff --git a/e2e/integration/menu.e2e.ts b/e2e/integration/menu.e2e.ts index 50dc4653..52f05244 100644 --- a/e2e/integration/menu.e2e.ts +++ b/e2e/integration/menu.e2e.ts @@ -3,22 +3,19 @@ describe('Menu', () => { cy.visit('e2e/standalone.html'); }); - it('should have valid items count', function() { - cy - .get('.menu-content') + it('should have valid items count', () => { + cy.get('.menu-content') .find('li') .should('have.length', 6 + (2 + 8 + 4) + (1 + 8)); }); - it('should sync active menu items while scroll', function() { - cy - .contains('h1', 'Introduction') + it('should sync active menu items while scroll', () => { + cy.contains('h1', 'Introduction') .scrollIntoView() .get('[role=menuitem].active:not(.-depth0)') .should('have.text', 'Introduction'); - cy - .contains('h2', 'Add a new pet to the store') + cy.contains('h2', 'Add a new pet to the store') .scrollIntoView() .get('[role=menuitem].active:not(.-depth0)') .should('have.length', 2) @@ -27,21 +24,21 @@ describe('Menu', () => { .should('be.visible'); }); - it('should update URL hash when clicking on menu items', function() { + 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'); - cy.contains('[role=menuitem]', 'Find pet by ID').click({ force: true }); + cy.contains('[role=menuitem]', 'Find pet by ID').click(); cy.location('hash').should('equal', '#operation/getPetById'); }); - it('should deactivate tag when other is activated', function() { + it('should deactivate tag when other is activated', () => { const petItem = () => cy.contains('[role=menuitem].-depth1', 'pet'); petItem() .click({ force: true }) .should('have.class', 'active'); - cy.contains('[role=menuitem].-depth1', 'store').click({ force: true }); + cy.contains('[role=menuitem].-depth1', 'store').click(); petItem().should('not.have.class', 'active'); }); }); diff --git a/e2e/integration/search.e2e.ts b/e2e/integration/search.e2e.ts index 8242d513..b7be090b 100644 --- a/e2e/integration/search.e2e.ts +++ b/e2e/integration/search.e2e.ts @@ -7,49 +7,48 @@ describe('Search', () => { cy.visit('e2e/standalone.html'); }); - it('should correctly show and hide search results box', function() { + it('should correctly show and hide search results box', () => { getSearchResults().should('not.exist'); // should not open for less than 3 symbols - getSearchInput().type('in', { force: true }); + getSearchInput().type('in'); getSearchResults().should('not.exist'); - getSearchInput().type('t', { force: true }); - cy - .get('[role=search] [role=menuitem]') + getSearchInput().type('t'); + cy.get('[role=search] [role=menuitem]') .should('have.length', 3) .first() .should('contain', 'Introduction'); - getSearchInput().type('{esc}', { force: true }); + getSearchInput().type('{esc}'); getSearchResults().should('not.exist'); }); - it('should support arrow navigation', function() { - getSearchInput().type('int', { force: true }); + it('should support arrow navigation', () => { + getSearchInput().type('int'); - getSearchInput().type('{downarrow}', { force: true }); + getSearchInput().type('{downarrow}'); getResult(0).should('have.class', 'active'); - getSearchInput().type('{downarrow}', { force: true }); + getSearchInput().type('{downarrow}'); getResult(1).should('have.class', 'active'); getResult(0).should('not.have.class', 'active'); - getSearchInput().type('{uparrow}', { force: true }); + getSearchInput().type('{uparrow}'); getResult(1).should('not.have.class', 'active'); getResult(0).should('have.class', 'active'); - getSearchInput().type('{uparrow}', { force: true }); + getSearchInput().type('{uparrow}'); getResult(0).should('have.class', 'active'); - getSearchInput().type('{enter}', { force: true }); + getSearchInput().type('{enter}'); cy.contains('[role=navigation] [role=menuitem]', 'Introduction').should('have.class', 'active'); }); - it('should mark search results', function() { + it('should mark search results', () => { cy.get('[data-markjs]').should('not.exist'); - getSearchInput().type('int', { force: true }); + getSearchInput().type('int'); cy.get('[data-markjs]').should('exist'); }); }); diff --git a/e2e/integration/standalone.e2e.ts b/e2e/integration/standalone.e2e.ts index 08a7fc90..587c73b4 100644 --- a/e2e/integration/standalone.e2e.ts +++ b/e2e/integration/standalone.e2e.ts @@ -1,15 +1,15 @@ -describe('Standalone bundle test', function() { +describe('Standalone bundle test', () => { function baseCheck(name: string, url: string) { describe(name, () => { before(() => { cy.visit(url); }); - it('Render and check no errors', function() { + it('Render and check no errors', () => { cy.get('.api-info').should('exist'); }); - it('Render and click all the menu items', function() { + it('Render and click all the menu items', () => { cy.get('.menu-content li').click({ multiple: true, force: true }); }); });