forked from Redocly/redoc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add a few more integration tests
- Loading branch information
1 parent
13165fb
commit b33b954
Showing
14 changed files
with
1,004 additions
and
396 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
describe('Menu', () => { | ||
before(() => { | ||
cy.visit('e2e/standalone.html'); | ||
}); | ||
|
||
it('should have valid items count', function() { | ||
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') | ||
.scrollIntoView() | ||
.get('.menu-item.active:not(.-depth0)') | ||
.should('have.text', 'Introduction'); | ||
|
||
cy | ||
.contains('h2', 'Add a new pet to the store') | ||
.scrollIntoView() | ||
.get('.menu-item.active:not(.-depth0)') | ||
.should('have.length', 2) | ||
.last() | ||
.should('have.text', 'Add a new pet to the store') | ||
.should('be.visible'); | ||
}); | ||
|
||
it('should update URL hash on clicking on menu items', function() { | ||
cy.contains('.menu-item.-depth1', 'pet').click({ force: true }); | ||
cy.location('hash').should('equal', '#tag/pet'); | ||
|
||
cy.contains('.menu-item', 'Find pet by ID').click({ force: true }); | ||
cy.location('hash').should('equal', '#operation/getPetById'); | ||
|
||
cy.contains('.menu-item', 'OpenAPI Specification').click({ force: true }); | ||
cy.location('hash').should('equal', '#section/OpenAPI-Specification'); | ||
}); | ||
|
||
it('should deactivate tag when other is activated', function() { | ||
const petItem = () => cy.contains('.menu-item.-depth1', 'pet'); | ||
|
||
petItem() | ||
.click({ force: true }) | ||
.should('have.class', 'active'); | ||
cy.contains('.menu-item.-depth1', 'store').click({ force: true }); | ||
petItem().should('not.have.class', 'active'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
describe('Search', () => { | ||
before(() => { | ||
cy.visit('e2e/standalone.html'); | ||
}); | ||
|
||
it('should be closed by default', function() { | ||
cy | ||
.get('.menu-content div') | ||
.filter('.search-box') | ||
.should('have.length', 0); | ||
}); | ||
|
||
it('should not open for less than 3 symbols', function() { | ||
cy.get('.search-input').type('in', { force: true }); | ||
cy | ||
.get('.menu-content div') | ||
.filter('.search-box') | ||
.should('have.length', 0); | ||
}); | ||
|
||
it('should find 3 results when typed int', function() { | ||
cy.get('.search-input').type('t', { force: true }); | ||
cy | ||
.get('.search-results') | ||
.find('li') | ||
.should('have.length', 3) | ||
.first() | ||
.should('contain', 'Introduction'); | ||
}); | ||
|
||
it('should clear when ESQ is pressed', function() { | ||
cy.get('.search-input').type('{esc}', { force: true }); | ||
cy | ||
.get('.menu-content div') | ||
.filter('.search-box') | ||
.should('have.length', 0); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
describe('Standalone bundle test', function() { | ||
function baseCheck(name: string, url: string) { | ||
describe(name, () => { | ||
before(() => { | ||
cy.visit(url); | ||
}); | ||
|
||
it('Render and check no errors', function() { | ||
cy.get('.api-info').should('exist'); | ||
}); | ||
|
||
it('Render and click all the menu items', function() { | ||
cy.get('.menu-content li').click({ multiple: true, force: true }); | ||
}); | ||
}); | ||
} | ||
|
||
baseCheck('OAS3 mode', 'e2e/standalone.html'); | ||
baseCheck('OAS2 compatibility mode', 'e2e/standalone-compatibility.html'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const wp = require('@cypress/webpack-preprocessor'); | ||
|
||
const webpackOptions = { | ||
resolve: { | ||
extensions: ['.ts', '.js'], | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.ts$/, | ||
exclude: [/node_modules/], | ||
use: [ | ||
{ | ||
loader: 'awesome-typescript-loader', | ||
options: { | ||
configFileName: 'e2e/tsconfig.json', | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}; | ||
|
||
const options = { | ||
webpackOptions, | ||
}; | ||
|
||
module.exports = wp(options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const cypressTypeScriptPreprocessor = require('./cy-ts-preprocessor'); | ||
|
||
module.exports = on => { | ||
on('file:preprocessor', cypressTypeScriptPreprocessor); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<html> | ||
|
||
<body> | ||
<redoc spec-url="../demo/openapi.yaml"></redoc> | ||
<redoc spec-url="../demo/openapi.yaml" native-scrollbars></redoc> | ||
<script src="../bundles/redoc.standalone.js"></script> | ||
</body> | ||
|
||
</html> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
"node_modules", | ||
".tmp", | ||
"lib", | ||
"e2e" | ||
"e2e/**" | ||
], | ||
"include": [ | ||
"./custom.d.ts", | ||
|
Oops, something went wrong.