From 3396d2b4e547e2664293337ab23c3a2180d4f76e Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Fri, 1 Jul 2022 12:05:28 +1000 Subject: [PATCH] Fix e2e tests! --- .yarnrc.yml | 2 +- cypress/generated/addon-docs.spec.ts | 11 +---------- cypress/generated/basic.spec.ts | 2 +- cypress/support/commands.js | 4 ++-- 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/.yarnrc.yml b/.yarnrc.yml index f7b4413ce31d..e8091d79ed31 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -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 diff --git a/cypress/generated/addon-docs.spec.ts b/cypress/generated/addon-docs.spec.ts index 0efffca5d2b5..c493254021f5 100644 --- a/cypress/generated/addon-docs.spec.ts +++ b/cypress/generated/addon-docs.spec.ts @@ -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', () => { diff --git a/cypress/generated/basic.spec.ts b/cypress/generated/basic.spec.ts index 589762497a2f..8acc2b4de523 100644 --- a/cypress/generated/basic.spec.ts +++ b/cypress/generated/basic.spec.ts @@ -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'); }); }); diff --git a/cypress/support/commands.js b/cypress/support/commands.js index d5e6e32cadfb..abd02f1d6ed8 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -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') @@ -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') {