Skip to content

Commit

Permalink
Fix e2e tests!
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeasday committed Jul 1, 2022
1 parent ea331bf commit 3396d2b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ logFilters:

nodeLinker: node-modules

npmRegistryServer: "https://registry.yarnpkg.com"
npmRegistryServer: "http://localhost:6000"

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
Expand Down
11 changes: 1 addition & 10 deletions cypress/generated/addon-docs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,7 @@ import { skipOn } from '@cypress/skip-test';
describe('addon-docs', () => {
beforeEach(() => {
cy.visitStorybook();
cy.navigateToStory('example-button', 'primary');
cy.viewAddonTab('Docs');
});

it('should have docs tab', () => {
// MDX rendering
cy.getDocsElement().find('h1').should('contain.text', 'Button');

// inline story rendering
cy.getDocsElement().find('button').should('contain.text', 'Button');
cy.navigateToStory('example-button', 'docs');
});

skipOn('vue3', () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/generated/basic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe('Basic CLI', () => {

describe('Welcome story (MDX)', () => {
it('should load and display', () => {
cy.navigateToStory('example-introduction', 'page');
cy.navigateToStory('example-introduction', 'docs');
cy.getDocsElement().should('contain.text', 'Welcome to Storybook');
});
});
Expand Down
4 changes: 2 additions & 2 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Cypress.Commands.add('visitStorybook', () => {
const host = Cypress.env('location') || 'http://localhost:8001';
return cy
.clearLocalStorage()
.visit(`${host}/?path=/story/example-introduction--page`)
.visit(`${host}/?path=/story/example-introduction--docs`)
.get(`#storybook-preview-iframe`, { log: false })
.its('0.contentDocument.body', { log: false })
.should('not.be.empty')
Expand Down Expand Up @@ -98,7 +98,7 @@ Cypress.Commands.add('navigateToStory', (kind, name) => {
cy.log(`navigateToStory ${kind} ${name}`);

// docs-only stories
if (name !== 'page') {
if (name !== 'docs') {
// Section might be collapsed
cy.get(`#${kindId}`).then(async ($item) => {
if ($item.attr('aria-expanded') === 'false') {
Expand Down

0 comments on commit 3396d2b

Please sign in to comment.