This is an automated email from the ASF dual-hosted git repository.

jli pushed a commit to branch feat/dataset-playwright-tests
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 529a672fc1e17f2b2c592d80e0e74fc8cc09e10b
Author: Joe Li <[email protected]>
AuthorDate: Thu Nov 6 09:37:29 2025 -0800

    fix(playwright): use relative API paths to support APP_ROOT prefix
    
    Convert absolute API paths (/api/v1/...) to relative paths (api/v1/...)
    in Playwright API helpers to properly handle baseURL with path prefix.
    
    Problem:
    - CI test "should delete a dataset" was failing in app_prefix configuration
    - Absolute paths starting with / bypass Playwright's baseURL
    - With baseURL=http://localhost:8081/app/prefix/, requests went to
      http://localhost:8081/api/v1/... (missing /app/prefix/)
    
    Solution:
    - Remove leading / from all API endpoint constants
    - Playwright now correctly prepends baseURL to relative paths
    - Works in both standard (no prefix) and app_prefix configurations
    
    Files changed:
    - playwright/helpers/api/database.ts - DATABASE endpoint
    - playwright/helpers/api/dataset.ts - DATASET endpoint
    - playwright/helpers/api/requests.ts - CSRF token endpoint + comment
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude <[email protected]>
---
 superset-frontend/playwright/helpers/api/database.ts | 2 +-
 superset-frontend/playwright/helpers/api/dataset.ts  | 2 +-
 superset-frontend/playwright/helpers/api/requests.ts | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/superset-frontend/playwright/helpers/api/database.ts 
b/superset-frontend/playwright/helpers/api/database.ts
index 5a7feb2e9b..e3fac9e5fc 100644
--- a/superset-frontend/playwright/helpers/api/database.ts
+++ b/superset-frontend/playwright/helpers/api/database.ts
@@ -21,7 +21,7 @@ import { Page, APIResponse } from '@playwright/test';
 import { apiPost, apiDelete, ApiRequestOptions } from './requests';
 
 const ENDPOINTS = {
-  DATABASE: '/api/v1/database/',
+  DATABASE: 'api/v1/database/',
 } as const;
 
 /**
diff --git a/superset-frontend/playwright/helpers/api/dataset.ts 
b/superset-frontend/playwright/helpers/api/dataset.ts
index fcf8bee8a8..b126781311 100644
--- a/superset-frontend/playwright/helpers/api/dataset.ts
+++ b/superset-frontend/playwright/helpers/api/dataset.ts
@@ -21,7 +21,7 @@ import { Page, APIResponse } from '@playwright/test';
 import { apiPost, apiDelete, ApiRequestOptions } from './requests';
 
 const ENDPOINTS = {
-  DATASET: '/api/v1/dataset/',
+  DATASET: 'api/v1/dataset/',
 } as const;
 
 /**
diff --git a/superset-frontend/playwright/helpers/api/requests.ts 
b/superset-frontend/playwright/helpers/api/requests.ts
index 66e91e39c6..387a586a57 100644
--- a/superset-frontend/playwright/helpers/api/requests.ts
+++ b/superset-frontend/playwright/helpers/api/requests.ts
@@ -38,12 +38,12 @@ function getBaseUrl(_page: Page): string {
 
 /**
  * Get CSRF token from the API endpoint
- * Superset provides a CSRF token via /api/v1/security/csrf_token/
+ * Superset provides a CSRF token via api/v1/security/csrf_token/
  * The session cookie is automatically included by page.request
  */
 async function getCsrfToken(page: Page): Promise<string> {
   try {
-    const response = await page.request.get('/api/v1/security/csrf_token/', {
+    const response = await page.request.get('api/v1/security/csrf_token/', {
       failOnStatusCode: false,
     });
 

Reply via email to