chore: remove some {force: true} from e2e tests

This commit is contained in:
Roman Hotsiy 2018-07-16 18:29:36 +03:00
parent c7b3e47366
commit d0e037c586
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
3 changed files with 26 additions and 30 deletions

View File

@ -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');
});
});

View File

@ -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');
});
});

View File

@ -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 });
});
});