[GitHub Workflow] Fix e2e test + cache node_modules (#6500)

This commit is contained in:
Louis Lam 2025-12-18 10:06:58 +08:00 committed by GitHub
parent 3b0ab450d3
commit a36616c855
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 45 additions and 13 deletions

View File

@ -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

View File

@ -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 }}

View File

@ -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();