From a36616c855e3964624b0b6cf589d155d07e7f4ce Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Thu, 18 Dec 2025 10:06:58 +0800 Subject: [PATCH] [GitHub Workflow] Fix e2e test + cache node_modules (#6500) --- .github/workflows/auto-test.yml | 49 +++++++++++++++++---- .github/workflows/close-incorrect-issue.yml | 1 - test/e2e/specs/monitor-form.spec.js | 8 ++-- 3 files changed, 45 insertions(+), 13 deletions(-) diff --git a/.github/workflows/auto-test.yml b/.github/workflows/auto-test.yml index 46fe5d23f..f0dfdfa55 100644 --- a/.github/workflows/auto-test.yml +++ b/.github/workflows/auto-test.yml @@ -15,7 +15,7 @@ on: jobs: auto-test: - needs: [ check-linters ] + needs: [ e2e-test ] runs-on: ${{ matrix.os }} timeout-minutes: 15 @@ -33,6 +33,13 @@ jobs: - run: git config --global core.autocrlf false # Mainly for Windows - uses: actions/checkout@v4 + - name: Cache/Restore node_modules + uses: actions/cache@v4 + id: node-modules-cache + with: + path: node_modules + key: node-modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} + - name: Use Node.js ${{ matrix.node }} uses: actions/setup-node@v6 with: @@ -46,7 +53,7 @@ jobs: # As a lot of dev dependencies are not supported on ARMv7, we have to test it separately and just test if `npm ci --production` works armv7-simple-test: - needs: [ ] + needs: [ e2e-test ] runs-on: ${{ matrix.os }} timeout-minutes: 15 if: ${{ github.repository == 'louislam/uptime-kuma' }} @@ -60,11 +67,18 @@ jobs: - run: git config --global core.autocrlf false # Mainly for Windows - uses: actions/checkout@v4 + - name: Cache/Restore node_modules + uses: actions/cache@v4 + id: node-modules-cache + with: + path: node_modules + key: node-modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} + - name: Use Node.js ${{ matrix.node }} uses: actions/setup-node@v6 with: node-version: ${{ matrix.node }} - - run: npm ci --production + - run: npm install --production check-linters: runs-on: ubuntu-latest @@ -73,6 +87,13 @@ jobs: - run: git config --global core.autocrlf false # Mainly for Windows - uses: actions/checkout@v4 + - name: Cache/Restore node_modules + uses: actions/cache@v4 + id: node-modules-cache + with: + path: node_modules + key: node-modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} + - name: Use Node.js 20 uses: actions/setup-node@v6 with: @@ -81,17 +102,29 @@ jobs: - run: npm run lint:prod e2e-test: - needs: [ ] - runs-on: ubuntu-24.04-arm + needs: [ check-linters ] + runs-on: ARM64 + env: + PLAYWRIGHT_VERSION: ~1.39.0 steps: - run: git config --global core.autocrlf false # Mainly for Windows - uses: actions/checkout@v4 - - name: Use Node.js 20 + - name: Cache/Restore node_modules + uses: actions/cache@v4 + id: node-modules-cache + with: + path: node_modules + key: node-modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} + + - name: Setup Node.js uses: actions/setup-node@v6 with: - node-version: 20 + node-version: 22 - run: npm install - - run: npx playwright install + + - name: Install Playwright ${{ env.PLAYWRIGHT_VERSION }} + run: npx playwright@${{ env.PLAYWRIGHT_VERSION }} install + - run: npm run build - run: npm run test-e2e diff --git a/.github/workflows/close-incorrect-issue.yml b/.github/workflows/close-incorrect-issue.yml index 9d4616931..f618cd7c2 100644 --- a/.github/workflows/close-incorrect-issue.yml +++ b/.github/workflows/close-incorrect-issue.yml @@ -20,6 +20,5 @@ jobs: uses: actions/setup-node@v6 with: node-version: ${{ matrix.node-version }} - cache: 'npm' - run: npm ci - run: node extra/close-incorrect-issue.js ${{ secrets.GITHUB_TOKEN }} ${{ github.event.issue.number }} ${{ github.event.issue.user.login }} diff --git a/test/e2e/specs/monitor-form.spec.js b/test/e2e/specs/monitor-form.spec.js index b41f6ceb9..c8734fa90 100644 --- a/test/e2e/specs/monitor-form.spec.js +++ b/test/e2e/specs/monitor-form.spec.js @@ -53,7 +53,7 @@ test.describe("Monitor Form", () => { const friendlyName = "Example DNS NS"; await page.getByTestId("friendly-name-input").fill(friendlyName); - await page.getByTestId("hostname-input").fill("example.com"); + await page.getByTestId("hostname-input").fill("kuma.pet"); const resolveTypeSelect = page.getByTestId("resolve-type-select"); await resolveTypeSelect.click(); @@ -65,9 +65,9 @@ test.describe("Monitor Form", () => { await page.getByTestId("add-condition-button").click(); expect(await page.getByTestId("condition").count()).toEqual(2); // 2 explicitly added - await page.getByTestId("condition-value").nth(0).fill("a.iana-servers.net"); + await page.getByTestId("condition-value").nth(0).fill("carl.ns.cloudflare.com"); await page.getByTestId("condition-and-or").nth(0).selectOption("or"); - await page.getByTestId("condition-value").nth(1).fill("b.iana-servers.net"); + await page.getByTestId("condition-value").nth(1).fill("jean.ns.cloudflare.com"); await screenshot(testInfo, page); await page.getByTestId("save-button").click(); @@ -86,7 +86,7 @@ test.describe("Monitor Form", () => { const friendlyName = "Example DNS NS"; await page.getByTestId("friendly-name-input").fill(friendlyName); - await page.getByTestId("hostname-input").fill("example.com"); + await page.getByTestId("hostname-input").fill("kuma.pet"); const resolveTypeSelect = page.getByTestId("resolve-type-select"); await resolveTypeSelect.click();