This commit is contained in:
Norbert de Langen 2020-04-23 16:07:46 +02:00
parent d8317ae5ef
commit 4eeaccd929
No known key found for this signature in database
GPG Key ID: 976651DA156C2825
2 changed files with 5 additions and 11 deletions

View File

@ -22,13 +22,10 @@ describe('Navigation', () => {
});
describe('Routing', () => {
before(() => {
visitExample('official-storybook');
});
it('should navigate to story addons-a11y-basebutton--default', () => {
cy.get('#addons-a11y-basebutton--label').click();
visitExample('official-storybook');
cy.get('#addons-a11y-basebutton--label').click();
cy.url().should('include', 'path=/story/addons-a11y-basebutton--label');
});

View File

@ -38,18 +38,15 @@ Cypress.Commands.add(
);
Cypress.Commands.add('preview', {}, () => {
return cy.get(`#storybook-preview-iframe`).then({ timeout: 10000 }, (iframe) => {
return cy.get(`#storybook-preview-iframe`).then({ timeout: 20000 }, (iframe) => {
const content = iframe[0].contentDocument;
const element = content !== null ? content.documentElement : null;
return cy
.wrap(iframe)
.get(iframe, { timeout: 20000 })
.should(() => {
expect(element).not.null;
if (element !== null) {
expect(element.querySelector('#root > *')).not.null;
}
expect(element.querySelector('#root')).not.null;
})
.then(() => {
return element.querySelector('#root');