From a36616c855e3964624b0b6cf589d155d07e7f4ce Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Thu, 18 Dec 2025 10:06:58 +0800 Subject: [PATCH 1/2] [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(); From 5d955f954b60410cd2dc5370d429753de524a2ef Mon Sep 17 00:00:00 2001 From: iotux <46082385+iotux@users.noreply.github.com> Date: Thu, 18 Dec 2025 09:53:47 +0700 Subject: [PATCH 2/2] feat: add platform/arch information to `sendInfo` (#6497) Co-authored-by: Frank Elsinga --- server/client.js | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/server/client.js b/server/client.js index 72f0a4e8e..4076242c0 100644 --- a/server/client.js +++ b/server/client.js @@ -142,27 +142,23 @@ async function sendAPIKeyList(socket) { * @returns {Promise} */ async function sendInfo(socket, hideVersion = false) { - let version; - let latestVersion; - let isContainer; - let dbType; - - if (!hideVersion) { - version = checkVersion.version; - latestVersion = checkVersion.latestVersion; - isContainer = (process.env.UPTIME_KUMA_IS_CONTAINER === "1"); - dbType = Database.dbConfig.type; - } - - socket.emit("info", { - version, - latestVersion, - isContainer, - dbType, + const info = { primaryBaseURL: await setting("primaryBaseURL"), serverTimezone: await server.getTimezone(), serverTimezoneOffset: server.getTimezoneOffset(), - }); + }; + if (!hideVersion) { + info.version = checkVersion.version; + info.latestVersion = checkVersion.latestVersion; + info.isContainer = (process.env.UPTIME_KUMA_IS_CONTAINER === "1"); + info.dbType = Database.dbConfig.type; + info.runtime = { + platform: process.platform, // linux or win32 + arch: process.arch, // x86 or arm + }; + } + + socket.emit("info", info); } /**