From c53abf2f5a3cee62c76ad5f1cdd43487ba354c67 Mon Sep 17 00:00:00 2001 From: Thomas Trompette Date: Fri, 12 Jan 2024 18:32:00 +0100 Subject: [PATCH] Fix chromatic tests + re-enable (#3414) * Fix chromatic tests + re-enable * Try to run command manually * Fix * Fix * Fix * Fix * Fix --------- Co-authored-by: Thomas Trompette Co-authored-by: Charles Bochet --- .github/workflows/ci-chromatic.yaml | 13 +++++-------- packages/twenty-front/package.json | 3 ++- .../__stories__/Threads.stories.tsx | 19 ------------------- .../modules/favorites/hooks/useFavorites.ts | 2 +- 4 files changed, 8 insertions(+), 29 deletions(-) delete mode 100644 packages/twenty-front/src/modules/activities/emails/components/__stories__/Threads.stories.tsx diff --git a/.github/workflows/ci-chromatic.yaml b/.github/workflows/ci-chromatic.yaml index 9afb99a0e..fa3364c57 100644 --- a/.github/workflows/ci-chromatic.yaml +++ b/.github/workflows/ci-chromatic.yaml @@ -12,6 +12,7 @@ jobs: runs-on: ubuntu-latest env: REACT_APP_SERVER_BASE_URL: http://127.0.0.1:3000 + CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} steps: - name: Cancel Previous Runs uses: styfle/cancel-workflow-action@0.11.0 @@ -31,11 +32,7 @@ jobs: echo "REACT_APP_SERVER_BASE_URL: $REACT_APP_SERVER_BASE_URL" >> .env - name: Front / Install Dependencies run: yarn - # - name: Publish to Chromatic - # uses: chromaui/action@v1 - # with: - # workingDir: ./packages/twenty-front - # projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} - # onlyChanged: true - # buildScriptName: storybook:build - \ No newline at end of file + - name: Publish to Chromatic + run: | + cd packages/twenty-front + yarn nx chromatic:ci diff --git a/packages/twenty-front/package.json b/packages/twenty-front/package.json index f5f2abb0e..68e792df4 100644 --- a/packages/twenty-front/package.json +++ b/packages/twenty-front/package.json @@ -37,7 +37,8 @@ "storybook:pages:coverage": "STORYBOOK_SCOPE=pages yarn storybook:coverage", "graphql:data:generate": "dotenv cross-var graphql-codegen -- --config codegen.cjs", "graphql:metadata:generate": "dotenv cross-var graphql-codegen -- --config codegen-metadata.cjs", - "chromatic": "dotenv cross-var npx chromatic --project-token=$CHROMATIC_PROJECT_TOKEN" + "chromatic": "cross-var npx chromatic --project-token=$CHROMATIC_PROJECT_TOKEN --build-script-name=storybook:build", + "chromatic:ci": "cross-var npx chromatic --project-token=$CHROMATIC_PROJECT_TOKEN --build-script-name=storybook:build --exit-zero-on-changes" }, "engines": { "node": "^18.17.1", diff --git a/packages/twenty-front/src/modules/activities/emails/components/__stories__/Threads.stories.tsx b/packages/twenty-front/src/modules/activities/emails/components/__stories__/Threads.stories.tsx deleted file mode 100644 index 92fbf44e5..000000000 --- a/packages/twenty-front/src/modules/activities/emails/components/__stories__/Threads.stories.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { Meta, StoryObj } from '@storybook/react'; - -import { Threads } from '../Threads'; - -const meta: Meta = { - title: 'Modules/Activity/Emails/Threads', - component: Threads, - args: { - entity: { - targetObjectNameSingular: 'person', - id: '52ba3fd0-c723-4482-8b11-5fc24a587c71', - }, - }, -}; - -export default meta; -type Story = StoryObj; - -export const Default: Story = {}; diff --git a/packages/twenty-front/src/modules/favorites/hooks/useFavorites.ts b/packages/twenty-front/src/modules/favorites/hooks/useFavorites.ts index f006541bb..0303673d2 100644 --- a/packages/twenty-front/src/modules/favorites/hooks/useFavorites.ts +++ b/packages/twenty-front/src/modules/favorites/hooks/useFavorites.ts @@ -83,7 +83,7 @@ export const useFavorites = () => { return favorite; }) - .toSorted((a, b) => a.position - b.position); + .sort((a, b) => a.position - b.position); }, [ favoriteRelationFieldMetadataItems, favorites,