Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/storybook.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: dDevKit Components
name: dDevKit Components Storybook

on:
workflow_dispatch:
Expand Down Expand Up @@ -38,6 +38,15 @@ jobs:
name: storybook-build
path: apps/storybook/storybook-static

- name: Install Playwright
run: pnpm dlx playwright install --with-deps

- name: Serve Storybook and run tests
run: |
pnpm dlx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"pnpm dlx http-server apps/storybook/storybook-static --port 6006 --silent" \
"pnpm dlx wait-on tcp:127.0.0.1:6006 && pnpm --filter @geist/storybook test:storybook-runner"

# smoke test, disabled for now
# - name: Build gql
# run: pnpm --filter graphql build:gql
Expand Down
2 changes: 2 additions & 0 deletions apps/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"build": "storybook build",
"preview": "vite preview",
"test": "vitest",
"test:storybook-runner": "test-storybook",
"config:setup": "node --experimental-json-modules ./src/scripts/setup.mjs",
"deploy:fleek": "fleek --debug sites deploy"
},
Expand Down Expand Up @@ -108,6 +109,7 @@
"@storybook/addon-links": "^8.3.4",
"@storybook/addon-onboarding": "^8.3.4",
"@storybook/addon-themes": "^8.3.4",
"@storybook/test-runner": "^0.22.0",
"@storybook/blocks": "^8.3.4",
"@storybook/react": "^8.3.4",
"@storybook/react-vite": "^8.3.4",
Expand Down
23 changes: 23 additions & 0 deletions apps/storybook/src/stories/token/TokenPriceChart.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { TokenPriceChart } from "@geist/ui-react/components/token/token-price-chart";
import { BY_CHAIN_ID, Token } from "@geist/ui-react/lib/token/config";
import type { Meta, StoryObj } from "@storybook/react";
import { expect, userEvent, within } from "@storybook/test";
import { mainnet } from "viem/chains";
import { withWagmiProvider } from "#stories/decorators/wagmi.tsx";

Expand Down Expand Up @@ -31,4 +32,26 @@ export const StETH: Story = {
},
],
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);

const chart = await canvas.findByTestId(
"token-price-chart-with-feed",
undefined,
{
timeout: 2000,
},
);

await expect(chart).toBeInTheDocument();
await userEvent.hover(chart);

// broken at CI, TODO

// const label = await canvas.findByText("stETH", undefined, {
// timeout: 5000,
// });

// await expect(label).toBeInTheDocument();
},
};
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
import { TRANSACTION } from "@geist/domain/user.fixture";
import { TransactionCard } from "@geist/ui-react/components/transactions/transaction-card";
import type { Meta, StoryObj } from "@storybook/react";
import { expect, within } from "@storybook/test";
import { mainnet } from "viem/chains";
import { withWagmiProvider } from "../decorators/wagmi";

const meta = {
title: "Transactions/TransactionCard",
component: TransactionCard,
args: {},
play: async ({ canvasElement }) => {
console.log("canvasElement", canvasElement);
const canvas = within(canvasElement);

const cardTitle = await canvas.findByText("Transaction", undefined, {
timeout: 2000,
});

await expect(cardTitle).toBeInTheDocument();
},
} satisfies Meta<typeof TransactionCard>;

export default meta;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export const TokenBalanceChart = ({
};
});
return (
<div className="w-full h-full]">
<div className="w-full h-full">
<ChartContainer
config={chartConfig}
style={{ height: "600px", width: "600px" }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const TokenPriceChartWithFeed = ({
) satisfies ChartConfig;

return (
<div className="w-full h-full]">
<div className="w-full h-full" data-testid="token-price-chart-with-feed">
<ChartContainer
config={chartConfig}
style={{ height: "600px", width: "600px" }}
Expand Down
Loading