mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-22 08:36:33 +03:00
chore: remove some {force: true} from e2e tests
This commit is contained in:
parent
c7b3e47366
commit
d0e037c586
|
@ -3,22 +3,19 @@ describe('Menu', () => {
|
||||||
cy.visit('e2e/standalone.html');
|
cy.visit('e2e/standalone.html');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should have valid items count', function() {
|
it('should have valid items count', () => {
|
||||||
cy
|
cy.get('.menu-content')
|
||||||
.get('.menu-content')
|
|
||||||
.find('li')
|
.find('li')
|
||||||
.should('have.length', 6 + (2 + 8 + 4) + (1 + 8));
|
.should('have.length', 6 + (2 + 8 + 4) + (1 + 8));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should sync active menu items while scroll', function() {
|
it('should sync active menu items while scroll', () => {
|
||||||
cy
|
cy.contains('h1', 'Introduction')
|
||||||
.contains('h1', 'Introduction')
|
|
||||||
.scrollIntoView()
|
.scrollIntoView()
|
||||||
.get('[role=menuitem].active:not(.-depth0)')
|
.get('[role=menuitem].active:not(.-depth0)')
|
||||||
.should('have.text', 'Introduction');
|
.should('have.text', 'Introduction');
|
||||||
|
|
||||||
cy
|
cy.contains('h2', 'Add a new pet to the store')
|
||||||
.contains('h2', 'Add a new pet to the store')
|
|
||||||
.scrollIntoView()
|
.scrollIntoView()
|
||||||
.get('[role=menuitem].active:not(.-depth0)')
|
.get('[role=menuitem].active:not(.-depth0)')
|
||||||
.should('have.length', 2)
|
.should('have.length', 2)
|
||||||
|
@ -27,21 +24,21 @@ describe('Menu', () => {
|
||||||
.should('be.visible');
|
.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.contains('[role=menuitem].-depth1', 'pet').click({ force: true });
|
||||||
cy.location('hash').should('equal', '#tag/pet');
|
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');
|
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');
|
const petItem = () => cy.contains('[role=menuitem].-depth1', 'pet');
|
||||||
|
|
||||||
petItem()
|
petItem()
|
||||||
.click({ force: true })
|
.click({ force: true })
|
||||||
.should('have.class', 'active');
|
.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');
|
petItem().should('not.have.class', 'active');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,49 +7,48 @@ describe('Search', () => {
|
||||||
cy.visit('e2e/standalone.html');
|
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');
|
getSearchResults().should('not.exist');
|
||||||
|
|
||||||
// should not open for less than 3 symbols
|
// should not open for less than 3 symbols
|
||||||
getSearchInput().type('in', { force: true });
|
getSearchInput().type('in');
|
||||||
getSearchResults().should('not.exist');
|
getSearchResults().should('not.exist');
|
||||||
|
|
||||||
getSearchInput().type('t', { force: true });
|
getSearchInput().type('t');
|
||||||
cy
|
cy.get('[role=search] [role=menuitem]')
|
||||||
.get('[role=search] [role=menuitem]')
|
|
||||||
.should('have.length', 3)
|
.should('have.length', 3)
|
||||||
.first()
|
.first()
|
||||||
.should('contain', 'Introduction');
|
.should('contain', 'Introduction');
|
||||||
|
|
||||||
getSearchInput().type('{esc}', { force: true });
|
getSearchInput().type('{esc}');
|
||||||
getSearchResults().should('not.exist');
|
getSearchResults().should('not.exist');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should support arrow navigation', function() {
|
it('should support arrow navigation', () => {
|
||||||
getSearchInput().type('int', { force: true });
|
getSearchInput().type('int');
|
||||||
|
|
||||||
getSearchInput().type('{downarrow}', { force: true });
|
getSearchInput().type('{downarrow}');
|
||||||
getResult(0).should('have.class', 'active');
|
getResult(0).should('have.class', 'active');
|
||||||
|
|
||||||
getSearchInput().type('{downarrow}', { force: true });
|
getSearchInput().type('{downarrow}');
|
||||||
getResult(1).should('have.class', 'active');
|
getResult(1).should('have.class', 'active');
|
||||||
getResult(0).should('not.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(1).should('not.have.class', 'active');
|
||||||
getResult(0).should('have.class', 'active');
|
getResult(0).should('have.class', 'active');
|
||||||
|
|
||||||
getSearchInput().type('{uparrow}', { force: true });
|
getSearchInput().type('{uparrow}');
|
||||||
getResult(0).should('have.class', 'active');
|
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');
|
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');
|
cy.get('[data-markjs]').should('not.exist');
|
||||||
getSearchInput().type('int', { force: true });
|
getSearchInput().type('int');
|
||||||
cy.get('[data-markjs]').should('exist');
|
cy.get('[data-markjs]').should('exist');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
describe('Standalone bundle test', function() {
|
describe('Standalone bundle test', () => {
|
||||||
function baseCheck(name: string, url: string) {
|
function baseCheck(name: string, url: string) {
|
||||||
describe(name, () => {
|
describe(name, () => {
|
||||||
before(() => {
|
before(() => {
|
||||||
cy.visit(url);
|
cy.visit(url);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Render and check no errors', function() {
|
it('Render and check no errors', () => {
|
||||||
cy.get('.api-info').should('exist');
|
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 });
|
cy.get('.menu-content li').click({ multiple: true, force: true });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user