Skip to content

Commit

Permalink
try and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leagrdv committed Dec 24, 2024
1 parent 0d92279 commit d84461a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
6 changes: 4 additions & 2 deletions packages/components/cypress/e2e/megadropdown.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('megadropdown', () => {
cy.viewport('iphone-6+');
cy.getComponents(
MEGADROPDOWN_ID,
'default',
'tests',
'post-megadropdown',
'post-megadropdown-trigger',
);
Expand All @@ -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`);
});

Expand All @@ -50,7 +51,7 @@ describe('megadropdown', () => {
cy.viewport(1920, 1080);
cy.getComponents(
MEGADROPDOWN_ID,
'default',
'tests',
'post-megadropdown',
'post-megadropdown-trigger',
);
Expand All @@ -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`);
});

Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -8,7 +8,7 @@ const { id, ...metaWithoutId } = meta;
export default {
...metaWithoutId,
title: 'Snapshots',
decorators: [],
decorators: [megadropdownDecorator],
};

type Story = StoryObj<HTMLPostMegadropdownElement>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const meta: MetaComponent<HTMLPostMegadropdownElement> = {
tags: ['package:WebComponents'],
component: 'post-megadropdown',
render: render,
decorators: [decorator],
parameters: {
design: {
type: 'figma',
Expand All @@ -22,7 +21,7 @@ const meta: MetaComponent<HTMLPostMegadropdownElement> = {

export default meta;

function decorator(story: StoryFn, context: StoryContext) {
export function megadropdownDecorator(story: StoryFn, context: StoryContext) {
return html`
<post-mainnavigation>
<post-list title-hidden="">
Expand All @@ -32,7 +31,6 @@ function decorator(story: StoryFn, context: StoryContext) {
`;
}

// RENDERERS
function render() {
return html`
<post-megadropdown-trigger for="pakete">Pakete</post-megadropdown-trigger>
Expand Down Expand Up @@ -64,4 +62,9 @@ function render() {
// STORIES
type Story = StoryObj<HTMLPostLanguageOptionElement>;

export const Default: Story = {};
export const Default: Story = {
decorators: [megadropdownDecorator],
};

// No decorators on the test page
export const Tests: Story = {};

0 comments on commit d84461a

Please sign in to comment.