2019-10-13 14:24:17 +02:00
|
|
|
import { getStorybookPreview, visitExample } from '../helper';
|
2019-10-12 18:19:25 +02:00
|
|
|
|
2019-10-13 14:24:17 +02:00
|
|
|
describe('Navigation', () => {
|
2019-10-12 18:19:25 +02:00
|
|
|
beforeEach(() => {
|
2019-10-13 14:24:17 +02:00
|
|
|
visitExample('official-storybook');
|
2019-10-12 18:55:04 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should search navigation item', () => {
|
|
|
|
cy.get('#storybook-explorer-searchfield')
|
|
|
|
.click()
|
|
|
|
.type('persisting the action logger');
|
|
|
|
|
|
|
|
cy.get('.sidebar-container a')
|
|
|
|
.should('contain', 'Persisting the action logger')
|
|
|
|
.and('not.contain', 'a11y');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should display no results after searching a non-existing navigation item', () => {
|
|
|
|
cy.get('#storybook-explorer-searchfield')
|
|
|
|
.click()
|
|
|
|
.type('zzzzzzzzzz');
|
|
|
|
|
|
|
|
cy.get('.sidebar-container').should('contain', 'This filter resulted in 0 results');
|
2019-10-12 18:19:25 +02:00
|
|
|
});
|
|
|
|
});
|
2019-10-13 14:24:17 +02:00
|
|
|
|
|
|
|
describe('Routing', () => {
|
|
|
|
it('should navigate to story addons-a11y-basebutton--default', () => {
|
|
|
|
visitExample('official-storybook');
|
|
|
|
cy.get('#exploreraddons-a11y-basebutton--label').click();
|
|
|
|
|
|
|
|
cy.url().should('include', 'path=/story/addons-a11y-basebutton--label');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should directly visit a certain story and render correctly', () => {
|
|
|
|
visitExample('official-storybook', '?path=/story/addons-a11y-basebutton--label');
|
|
|
|
getStorybookPreview().should('contain', 'Testing the a11y addon');
|
|
|
|
});
|
|
|
|
});
|