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

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 3f60fa9e2c7 Fix Firefox and WebKit UI e2e runs failing at login 
(#73872)
3f60fa9e2c7 is described below

commit 3f60fa9e2c7d918be2230e39b802600ed5ebe42e
Author: Jarek Potiuk <[email protected]>
AuthorDate: Tue Sep 29 06:13:36 2026 +0200

    Fix Firefox and WebKit UI e2e runs failing at login (#73872)
    
    * Fix Firefox and WebKit UI e2e runs failing at login
    
    The e2e global setup always logged in with the first configured
    Playwright project (Chromium), even when a run was narrowed to Firefox or
    WebKit. Only the selected browser is installed for such runs, both by
    breeze and, since the UI dependency caching change, by the CI workflow, so
    the setup could not launch Chromium and every test failed on a missing
    auth state file.
    
    Generated-by: Claude Opus 5
    
    * Guard against a Playwright config without projects in e2e setup
    
    Generated-by: Claude Opus 5
---
 airflow-core/src/airflow/ui/tests/e2e/global-setup.ts      | 14 +++++++++++---
 dev/breeze/src/airflow_breeze/commands/testing_commands.py |  2 ++
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/airflow-core/src/airflow/ui/tests/e2e/global-setup.ts 
b/airflow-core/src/airflow/ui/tests/e2e/global-setup.ts
index 77313e49102..c8cd9d00b05 100644
--- a/airflow-core/src/airflow/ui/tests/e2e/global-setup.ts
+++ b/airflow-core/src/airflow/ui/tests/e2e/global-setup.ts
@@ -30,10 +30,18 @@ const browsers = { chromium, firefox, webkit };
  * Authenticate once before all tests and save state for reuse
  */
 async function globalSetup(config: FullConfig) {
-  const [firstProject] = config.projects as [FullConfig["projects"][number]];
-  const baseURL = firstProject.use.baseURL ?? testConfig.connection.baseUrl;
+  // `config.projects` lists every project even when `--project` narrows the 
run, and only the
+  // selected browser may be installed, so log in with the browser named in 
TEST_BROWSER.
+  const setupProject =
+    config.projects.find((project) => project.name === 
process.env.TEST_BROWSER) ?? config.projects[0];
+
+  if (setupProject === undefined) {
+    throw new Error("No Playwright projects are configured");
+  }
+
+  const baseURL = setupProject.use.baseURL ?? testConfig.connection.baseUrl;
   const { password, username } = testConfig.credentials;
-  const browserName = firstProject.name as keyof typeof browsers;
+  const browserName = setupProject.name as keyof typeof browsers;
   const browserType = browsers[browserName];
 
   const authDir = path.dirname(AUTH_FILE);
diff --git a/dev/breeze/src/airflow_breeze/commands/testing_commands.py 
b/dev/breeze/src/airflow_breeze/commands/testing_commands.py
index bff08631040..c66cac3d89d 100644
--- a/dev/breeze/src/airflow_breeze/commands/testing_commands.py
+++ b/dev/breeze/src/airflow_breeze/commands/testing_commands.py
@@ -1706,6 +1706,8 @@ def ui_e2e_tests(
             "TEST_PASSWORD": test_admin_password,
             "TEST_DAG_ID": "example_bash_operator",
         }
+        if browser != "all":
+            env_vars["TEST_BROWSER"] = browser
 
         if force_reinstall_deps:
             clean_cmd = ["pnpm", "install", "--force"]

Reply via email to