tbonelee commented on code in PR #5262:
URL: https://github.com/apache/zeppelin/pull/5262#discussion_r3347001572


##########
zeppelin-web-angular/e2e/tests/notebook/action-bar/action-bar-functionality.spec.ts:
##########
@@ -46,7 +47,19 @@ test.describe('Notebook Action Bar Functionality', () => {
 
     const titleInputField = actionBarPage.titleEditor.locator('input');
     await expect(titleInputField).toBeVisible();
-    await titleInputField.fill(notebookName);
+    // Retry fill+dispatch until value sticks.
+    await expect(async () => {
+      await titleInputField.click();
+      await titleInputField.fill(notebookName);
+      await titleInputField.evaluate((el: HTMLInputElement) => {
+        el.dispatchEvent(new Event('input', { bubbles: true }));
+        el.dispatchEvent(new Event('change', { bubbles: true }));
+      });
+      const actual = await titleInputField.inputValue();
+      if (actual !== notebookName) {
+        throw new Error(`titleInput retry: got "${actual}"`);
+      }
+    }).toPass({ timeout: 15000, intervals: [200, 500, 1000, 2000] });

Review Comment:
   Same as the comment above.



##########
zeppelin-web-angular/e2e/tests/home/home-page-notebook-actions.spec.ts:
##########
@@ -54,7 +53,20 @@ test.describe('Home Page Notebook Actions', () => {
 
       // When: User types special characters that could break regex or URL 
encoding
       for (const specialInput of ['[test]', '*.note', '/folder/sub', 'a?b=c']) 
{
-        await homePage.nodeList.filterInput.fill(specialInput);
+        // Retry fill+dispatch until value sticks.
+        const input = homePage.nodeList.filterInput;
+        await expect(async () => {
+          await input.click();
+          await input.fill(specialInput);
+          await input.evaluate((el: HTMLInputElement) => {
+            el.dispatchEvent(new Event('input', { bubbles: true }));
+            el.dispatchEvent(new Event('change', { bubbles: true }));
+          });
+          const actual = await input.inputValue();
+          if (actual !== specialInput) {
+            throw new Error(`filterInput retry: got "${actual}"`);
+          }
+        }).toPass({ timeout: 15000, intervals: [200, 500, 1000, 2000] });

Review Comment:
   This logic seems to overlap with the earlier code. How about extracting it 
into a shared/common function? I thought it served the same purpose in terms of 
intent as well. What do you think?



##########
zeppelin-web-angular/e2e/models/base-page.ts:
##########
@@ -104,10 +104,22 @@ export class BasePage {
     await expect(locator).toBeVisible({ timeout });
     await expect(locator).toBeEnabled({ timeout: 5000 });
 
-    // Click first so Angular's form control is focused and its initial 
setValue cycle
-    // has completed before we overwrite it.  Then fill() atomically sets the 
value.
-    await locator.click();
-    await locator.fill(value);
-    await expect(locator).toHaveValue(value, { timeout: 10000 });
+    // Ant-modal autofocus + Angular form initialization race: any of fill / 
type /
+    // pressSequentially can land BEFORE the form-control's initial value sync,
+    // after which Angular silently resets the input back to the model's 
initial
+    // value (placeholder). ng-dirty is set but the visible value is wrong.
+    await expect(async () => {
+      await locator.click();
+      await locator.fill(value);
+      await locator.evaluate((el: HTMLInputElement) => {
+        el.dispatchEvent(new Event('input', { bubbles: true }));
+        el.dispatchEvent(new Event('change', { bubbles: true }));
+      });
+      // Verify the value stuck — if Angular reset it, this throws and toPass 
retries.
+      const actual = await locator.inputValue();
+      if (actual !== value) {
+        throw new Error(`fillAndVerifyInput retry: expected "${value}" got 
"${actual}"`);
+      }
+    }).toPass({ timeout: 15000, intervals: [200, 500, 1000, 2000] });

Review Comment:
   Same as the below comment.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to