diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 00000000..e43e314f --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,32 @@ +name: E2E Tests + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + merge_group: + branches: [ "main" ] + +jobs: + e2e: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Rush Install + run: node common/scripts/install-run-rush.js install + + - name: Rush build + run: node common/scripts/install-run-rush.js build + + - name: Install Playwright Browsers + run: npx playwright install --with-deps + + - name: Run E2E tests + run: node common/scripts/install-run-rush.js e2e:test --verbose diff --git a/.github/workflows/sync-screenshot.yml b/.github/workflows/sync-screenshot.yml new file mode 100644 index 00000000..330f52bb --- /dev/null +++ b/.github/workflows/sync-screenshot.yml @@ -0,0 +1,49 @@ +name: Sync Screenshot +on: + workflow_dispatch + +concurrency: + group: "manual-sync-screenshot" + cancel-in-progress: false + +jobs: + e2e: + # can not update screenshot run on main. + if: github.ref_name != 'main' + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Set Git user.name and user.email from trigger actor + run: | + git config --global user.name "${{ github.actor }}" + git config --global user.email "${{ github.actor }}@users.noreply.github.com" + + - name: Rush Install + run: node common/scripts/install-run-rush.js install + + - name: Rush build + run: node common/scripts/install-run-rush.js build + + - name: Install Playwright Browsers + run: npx playwright install --with-deps + + - name: Run E2E tests + run: node common/scripts/install-run-rush.js e2e:update-screenshot --verbose + + - name: Commit and push changes + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git add . + if git diff-index --quiet HEAD; then + echo "No changes to commit" + else + git commit -m "chore: sync screenshot" + git push https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }} HEAD:${{ github.ref_name }} + fi diff --git a/.gitignore b/.gitignore index 240f4c66..bc0211d3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# e2e results +test-results/ + # Logs *.log npm-debug.log* diff --git a/apps/demo-free-layout/src/components/add-node/index.tsx b/apps/demo-free-layout/src/components/add-node/index.tsx index 872c1a69..66bc3911 100644 --- a/apps/demo-free-layout/src/components/add-node/index.tsx +++ b/apps/demo-free-layout/src/components/add-node/index.tsx @@ -7,6 +7,7 @@ export const AddNode = (props: { disabled: boolean }) => { const addNode = useAddNode(); return (