fix(e2e): 修复ESM模式下__dirname未定义导致Staging E2E失败
Preview Deploy / Deploy Preview Environment (pull_request) Failing after 20s
AI Code Review / AI Code Review (pull_request) Failing after 24s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 6m23s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 7m32s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 34s
CI/CD Pipeline / Integration Tests (pull_request) Failing after 1389h38m59s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 1389h39m47s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 1389h39m12s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 1389h39m47s
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 1389h39m14s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 1389h39m48s
CI/CD Pipeline / Build Production Worker Image (pull_request) Failing after 1389h39m49s
CI/CD Pipeline / Build Production API Image (pull_request) Failing after 1389h39m49s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 1389h39m50s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 1389h39m52s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 1389h39m53s
CI/CD Pipeline / Check if frontend-only change (pull_request) Has been skipped
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 1390h11m56s
CI/CD Pipeline / Build Production Web Image (pull_request) Failing after 1390h11m58s
CI/CD Pipeline / Production Browser E2E (pull_request) Failing after 1390h11m55s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 1390h12m1s
Preview Deploy / Deploy Preview Environment (pull_request) Failing after 20s
AI Code Review / AI Code Review (pull_request) Failing after 24s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 6m23s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 7m32s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 34s
CI/CD Pipeline / Integration Tests (pull_request) Failing after 1389h38m59s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 1389h39m47s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 1389h39m12s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 1389h39m47s
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 1389h39m14s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 1389h39m48s
CI/CD Pipeline / Build Production Worker Image (pull_request) Failing after 1389h39m49s
CI/CD Pipeline / Build Production API Image (pull_request) Failing after 1389h39m49s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 1389h39m50s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 1389h39m52s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 1389h39m53s
CI/CD Pipeline / Check if frontend-only change (pull_request) Has been skipped
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 1390h11m56s
CI/CD Pipeline / Build Production Web Image (pull_request) Failing after 1390h11m58s
CI/CD Pipeline / Production Browser E2E (pull_request) Failing after 1390h11m55s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 1390h12m1s
根因:Playwright在ESM模式下运行,CommonJS的__dirname全局变量不存在。 修复:使用fileURLToPath(import.meta.url) + path.dirname 实现ESM兼容的__dirname。 影响用例: - core-generation.spec.ts: walks through 5-step wizard and starts generation - core-upload.spec.ts: uploads a video asset and shows it in the asset library
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import { expect, test, type APIRequestContext } from "@playwright/test"
|
||||
import * as fs from "node:fs"
|
||||
import * as path from "node:path"
|
||||
import { fileURLToPath } from "node:url"
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
const PASSWORD = "SmokePass123!"
|
||||
const apiBase = process.env.E2E_API_BASE || "/api/v1"
|
||||
const apiOrigin = apiBase.endsWith("/api/v1") ? apiBase.slice(0, -"/api/v1".length) : ""
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { expect, test, type APIRequestContext } from "@playwright/test"
|
||||
import * as fs from "node:fs"
|
||||
import * as path from "node:path"
|
||||
import { fileURLToPath } from "node:url"
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
const PASSWORD = "SmokePass123!"
|
||||
const apiBase = process.env.E2E_API_BASE || "/api/v1"
|
||||
const apiOrigin = apiBase.endsWith("/api/v1") ? apiBase.slice(0, -"/api/v1".length) : ""
|
||||
|
||||
Reference in New Issue
Block a user