2020-05-09 11:34:04 +02:00
|
|
|
import { visit } from '../helper';
|
2019-10-12 18:19:25 +02:00
|
|
|
|
2019-10-13 14:24:17 +02:00
|
|
|
describe('Navigation', () => {
|
2020-03-04 20:49:03 +01:00
|
|
|
before(() => {
|
2020-05-09 11:34:04 +02:00
|
|
|
visit('official-storybook');
|
2019-10-12 18:55:04 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should search navigation item', () => {
|
2020-10-07 21:20:15 +02:00
|
|
|
cy.get('#storybook-explorer-searchfield').click().clear().type('syntax');
|
2019-10-12 18:55:04 +02:00
|
|
|
|
2020-10-07 21:20:15 +02:00
|
|
|
cy.get('#storybook-explorer-menu button')
|
|
|
|
.should('contain', 'SyntaxHighlighter')
|
2019-10-12 18:55:04 +02:00
|
|
|
.and('not.contain', 'a11y');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should display no results after searching a non-existing navigation item', () => {
|
2020-03-27 20:04:50 +01:00
|
|
|
cy.get('#storybook-explorer-searchfield').click().clear().type('zzzzzzzzzz');
|
2019-10-12 18:55:04 +02:00
|
|
|
|
2020-10-07 22:18:33 +02:00
|
|
|
cy.get('#storybook-explorer-menu button').should('be.hidden');
|
2019-10-12 18:19:25 +02:00
|
|
|
});
|
|
|
|
});
|
2019-10-13 14:24:17 +02:00
|
|
|
|
|
|
|
describe('Routing', () => {
|
2020-04-23 16:07:46 +02:00
|
|
|
it('should navigate to story addons-a11y-basebutton--default', () => {
|
2020-05-09 11:34:04 +02:00
|
|
|
visit('official-storybook');
|
2020-03-04 20:49:03 +01:00
|
|
|
|
|
|
|
cy.get('#addons-a11y-basebutton--label').click();
|
2019-10-13 14:24:17 +02:00
|
|
|
cy.url().should('include', 'path=/story/addons-a11y-basebutton--label');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should directly visit a certain story and render correctly', () => {
|
2020-05-09 11:34:04 +02:00
|
|
|
visit('official-storybook/?path=/story/addons-a11y-basebutton--label');
|
2019-10-16 16:11:56 +02:00
|
|
|
|
2020-05-09 11:34:04 +02:00
|
|
|
cy.getStoryElement().should('contain.text', 'Testing the a11y addon');
|
2019-10-13 14:24:17 +02:00
|
|
|
});
|
|
|
|
});
|