This is an automated email from the ASF dual-hosted git repository.
bbovenzi 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 92a9e5aad39 Wait for variable form validation before asserting Save is
enabled (#75239)
92a9e5aad39 is described below
commit 92a9e5aad39ee372797c4676b94949c0eec2bd22
Author: Himanshu Chawla <[email protected]>
AuthorDate: Thu Oct 22 01:42:18 2026 +0530
Wait for variable form validation before asserting Save is enabled (#75239)
Rendering the JSON warning does not wait for asynchronous form validity
updates, so the submission tests can race the disabled Save button.
Co-authored-by: Himanshu Chawla
<[email protected]>
---
.../ui/src/pages/Variables/ManageVariable/VariableForm.test.tsx | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git
a/airflow-core/src/airflow/ui/src/pages/Variables/ManageVariable/VariableForm.test.tsx
b/airflow-core/src/airflow/ui/src/pages/Variables/ManageVariable/VariableForm.test.tsx
index 70b4e0b09e9..3d310338bda 100644
---
a/airflow-core/src/airflow/ui/src/pages/Variables/ManageVariable/VariableForm.test.tsx
+++
b/airflow-core/src/airflow/ui/src/pages/Variables/ManageVariable/VariableForm.test.tsx
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+import "@testing-library/jest-dom/vitest";
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest";
@@ -56,7 +57,7 @@ describe("VariableForm", () => {
fireEvent.change(screen.getByLabelText(/value/iu), { target: { value:
'{"enabled": true,' } });
await waitFor(() =>
expect(screen.getByText(/variables\.form\.invalidJson/u)).toBeInTheDocument());
- expect(screen.getByRole("button", { name: /save/iu })).toBeEnabled();
+ await waitFor(() => expect(screen.getByRole("button", { name: /save/iu
})).toBeEnabled());
fireEvent.click(screen.getByRole("button", { name: /save/iu }));
@@ -74,7 +75,7 @@ describe("VariableForm", () => {
fireEvent.change(screen.getByLabelText(/value/iu), { target: { value:
"[DRAFT] plain string value" } });
await waitFor(() =>
expect(screen.getByText(/variables\.form\.invalidJson/u)).toBeInTheDocument());
- expect(screen.getByRole("button", { name: /save/iu })).toBeEnabled();
+ await waitFor(() => expect(screen.getByRole("button", { name: /save/iu
})).toBeEnabled());
fireEvent.click(screen.getByRole("button", { name: /save/iu }));
@@ -92,7 +93,7 @@ describe("VariableForm", () => {
fireEvent.change(screen.getByLabelText(/value/iu), { target: { value: "{{
var.value.x }}" } });
await waitFor(() =>
expect(screen.getByText(/variables\.form\.invalidJson/u)).toBeInTheDocument());
- expect(screen.getByRole("button", { name: /save/iu })).toBeEnabled();
+ await waitFor(() => expect(screen.getByRole("button", { name: /save/iu
})).toBeEnabled());
fireEvent.click(screen.getByRole("button", { name: /save/iu }));