Added e2e tests

This commit is contained in:
Toni Matković 2019-11-05 15:01:36 +01:00
parent 8a99f59ba5
commit 26f101d090
2 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,8 @@
<html>
<body>
<redoc spec-url="../demo/openapi.yaml" disable-infinite-scroll="true"></redoc>
<script src="../bundles/redoc.standalone.js"></script>
</body>
</html>

View File

@ -0,0 +1,37 @@
describe('Infinite scroll disabling', () => {
beforeEach(() => {
cy.visit('disable-infinite-scroll-index.html');
});
it('should initially have only info component', () => {
cy.get('.api-content')
.children()
.should('have.length', 2)
.first()
.should('have.text', 'Swagger Petstore')
.last()
.should('have.text', 'Introduction');
});
it('should render only 1 component after menu item click', () => {
cy.contains('pet')
.click()
.contains('Add a new pet to the store')
.click()
.window().then($window => {
expect($window.scrollY).to.be.closeTo(300, 20); })
.get('#operation/addPet')
.should(' have.text', 'Add new pet to the store inventory.');
});
it('should test group menu item click', () => {
cy.contains('pet')
.click()
.children()
.should('have.length', 2)
.first()
.should('have.text', 'pet')
.last()
.should('have.text', 'Everything about your Pets');
});
});