From d84461a4b5f3b335dd94bb6bd911f32094f516ae Mon Sep 17 00:00:00 2001 From: leagrdv Date: Tue, 24 Dec 2024 10:04:53 +0100 Subject: [PATCH] try and fix tests --- packages/components/cypress/e2e/megadropdown.cy.ts | 6 ++++-- .../megadropdown/megadropdown.snapshot.stories.ts | 4 ++-- .../megadropdown/megadropdown.stories.ts | 11 +++++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/packages/components/cypress/e2e/megadropdown.cy.ts b/packages/components/cypress/e2e/megadropdown.cy.ts index 9bb51c2090..57fb2ec474 100644 --- a/packages/components/cypress/e2e/megadropdown.cy.ts +++ b/packages/components/cypress/e2e/megadropdown.cy.ts @@ -7,7 +7,7 @@ describe('megadropdown', () => { cy.viewport('iphone-6+'); cy.getComponents( MEGADROPDOWN_ID, - 'default', + 'tests', 'post-megadropdown', 'post-megadropdown-trigger', ); @@ -24,6 +24,7 @@ describe('megadropdown', () => { it('should open on trigger click', () => { cy.get('@megadropdown-trigger').should('exist'); cy.get('@megadropdown-trigger').click(); + cy.wait(500); cy.get('@megadropdown').should(`be.visible`); }); @@ -50,7 +51,7 @@ describe('megadropdown', () => { cy.viewport(1920, 1080); cy.getComponents( MEGADROPDOWN_ID, - 'default', + 'tests', 'post-megadropdown', 'post-megadropdown-trigger', ); @@ -67,6 +68,7 @@ describe('megadropdown', () => { it('should open on trigger click', () => { cy.get('@megadropdown-trigger').should('exist'); cy.get('@megadropdown-trigger').click(); + cy.wait(500); cy.get('@megadropdown').should(`be.visible`); }); diff --git a/packages/documentation/src/stories/raw-components/megadropdown/megadropdown.snapshot.stories.ts b/packages/documentation/src/stories/raw-components/megadropdown/megadropdown.snapshot.stories.ts index 002343e2a6..0a181fba8a 100644 --- a/packages/documentation/src/stories/raw-components/megadropdown/megadropdown.snapshot.stories.ts +++ b/packages/documentation/src/stories/raw-components/megadropdown/megadropdown.snapshot.stories.ts @@ -1,5 +1,5 @@ import type { StoryContext, StoryObj } from '@storybook/web-components'; -import meta from './megadropdown.stories'; +import meta, { megadropdownDecorator } from './megadropdown.stories'; import { html } from 'lit'; import { schemes } from '@/shared/snapshots/schemes'; @@ -8,7 +8,7 @@ const { id, ...metaWithoutId } = meta; export default { ...metaWithoutId, title: 'Snapshots', - decorators: [], + decorators: [megadropdownDecorator], }; type Story = StoryObj; diff --git a/packages/documentation/src/stories/raw-components/megadropdown/megadropdown.stories.ts b/packages/documentation/src/stories/raw-components/megadropdown/megadropdown.stories.ts index 8404240fdb..b29381a353 100644 --- a/packages/documentation/src/stories/raw-components/megadropdown/megadropdown.stories.ts +++ b/packages/documentation/src/stories/raw-components/megadropdown/megadropdown.stories.ts @@ -9,7 +9,6 @@ const meta: MetaComponent = { tags: ['package:WebComponents'], component: 'post-megadropdown', render: render, - decorators: [decorator], parameters: { design: { type: 'figma', @@ -22,7 +21,7 @@ const meta: MetaComponent = { export default meta; -function decorator(story: StoryFn, context: StoryContext) { +export function megadropdownDecorator(story: StoryFn, context: StoryContext) { return html` @@ -32,7 +31,6 @@ function decorator(story: StoryFn, context: StoryContext) { `; } -// RENDERERS function render() { return html` Pakete @@ -64,4 +62,9 @@ function render() { // STORIES type Story = StoryObj; -export const Default: Story = {}; +export const Default: Story = { + decorators: [megadropdownDecorator], +}; + +// No decorators on the test page +export const Tests: Story = {};