Skip to content

docs: Create Storybook Stories for the Components in the Profile and Operator Page #1127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

AvivAbachi
Copy link
Collaborator

@AvivAbachi AvivAbachi commented May 19, 2025

✨ New Storybook

  • Profile Page:
    • LineProfileDetails
    • LineProfileRide.stories
    • LineProfileStop.stories
  • Operator Page:
    • OperatorGaps.stories
    • OperatorInfo.stories
    • OperatorRoutes.stories

🧩 Updated Components

  • BusToolTip.tsx:
    • Added Ant Design Skeleton loader for consistent UI.

🛠️ Updated Stories

  • Updated story titles for better organization in Storybook.
  • Integrated waitForContent utility for improved testing.
  • Switched default date arguments to use getPastDate.
  • Fix Types with satisfies<typeof SomeComponent>
  • Remove tags: ['autodocs'], set by default on .storybook/main.ts
  • Fix Sort by alphabetical
  • Some refactors

🏷️ Config

  • tsconfig.json:
    • Simplified the exclusion pattern for .storybook/* files.

Copy link
Contributor

github-actions bot commented May 19, 2025

@NoamGaash
Copy link
Member

Cool! Regarding test stabilization, there are waitBeforeCapture (it can receive a callback async function) and storybook play functions that can be used to take the visual screenshot after the test is stable.
I'll try to play with it today

@AvivAbachi
Copy link
Collaborator Author

is working 🙂
But I think we can do it in a better way on Another fix

Copy link
Member

@NoamGaash NoamGaash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional comments - (feel free to merge as-is if you prefer to)

@AvivAbachi
Copy link
Collaborator Author

AvivAbachi commented May 19, 2025

@NoamGaash

1 Storybook play() (Work but need to add for each component)

const meta = {
  ...
  play: waitForContent,
} satisfies Meta<typeof SomeComponent>

2 Storybook Parameters (It is not used in Applitools)

parameters: {
  eyes: {
    waitBeforeCapture: async function () {
      const timeout = 180_000;
      const pollInterval = 100;
      const start = Date.now();

      while (document.querySelector('.ant-skeleton-content')) {
        if (Date.now() - start > timeout) {
          throw new Error('Timeout waiting for skeleton to disappear');
        }
        await new Promise((resolve) => setTimeout(resolve, pollInterval));
      }
    },
  },
}

3 Storybook Parameters (Failed "No Image Content")

parameters: {
  eyes: {
    waitBeforeCapture: waitForContent
  },
}

4 applitools.config.js (It is not used in Applitools)

export default {
  storybookConfigDir: '.storybook',
  async waitBeforeCapture() {
    const timeout = 180_000
    const pollInterval = 100
    const start = Date.now()

    while (document.querySelector('.ant-skeleton-content')) {
      if (Date.now() - start > timeout) {
        throw new Error('Timeout waiting for skeleton to disappear')
      }
      await new Promise((resolve) => setTimeout(resolve, pollInterval))
    }
  },
}

@AvivAbachi
Copy link
Collaborator Author

@NoamGaash
I use the play() function. If it can be set as a global setting, please do so.
It's ready for merge.

@AvivAbachi AvivAbachi requested a review from aviv1620 as a code owner May 26, 2025 07:07
@AvivAbachi AvivAbachi enabled auto-merge (squash) May 26, 2025 09:35
@AvivAbachi AvivAbachi disabled auto-merge May 26, 2025 09:35
@AvivAbachi AvivAbachi merged commit f0d363e into main Jun 8, 2025
23 of 25 checks passed
@AvivAbachi AvivAbachi deleted the 1097-create-storybook-stories-for-the-components-in-the-operator-profile-page branch June 8, 2025 12:15
@NoamGaash
Copy link
Member

Thanks @AvivAbachi !

AvivAbachi added a commit that referenced this pull request Jun 10, 2025
…Operator Page (#1127)

Co-authored-by: Noam Gaash <[email protected]>
Co-authored-by: Noam Gaash <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

create storybook stories for the components in the operator profile page
2 participants