Skip to content

Commit 6db680c

Browse files
committed
fix(e2e): click before fill to ensure onFocus fires on WebKit (iPhone 11)
Playwright's fill() is supposed to focus the element before typing, but on WebKit/Safari (used for the iPhone 11 test project), the synthetic onFocus event is not always reliably dispatched in CI's headless environment. The Field component tracks 'interacted' state (set on onFocus or onChange) to decide whether to show validation errors after blur. If onFocus doesn't fire, 'interacted' stays false and the error message never renders, causing the E2E assertion to fail with 'element(s) not found'. Fix: add an explicit .click() before .fill() in both validation tests. A click is guaranteed to trigger focus events in all browsers, ensuring 'interacted' is set to true before we blur and check for the error. Applied to both phone-number and name validation tests for consistency.
1 parent b07b417 commit 6db680c

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

e2e/profile.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ test('Validate phone number when updating data', async ({
3030
name: /nomor whatsapp/i,
3131
})
3232

33-
// Fill phoneNumber with invalid value
33+
// Click first to ensure onFocus fires reliably on WebKit (iPhone 11),
34+
// then fill with invalid value and blur to trigger client-side validation.
35+
await phoneNumber.click()
3436
await phoneNumber.fill('6512345678')
3537
await phoneNumber.blur()
3638

@@ -64,7 +66,9 @@ test('Validate name when updating data', async ({ page, noscript, screen }) => {
6466
name: /nama lengkap/i,
6567
})
6668

67-
// Clear name and trigger validation
69+
// Click first to ensure onFocus fires reliably on WebKit (iPhone 11),
70+
// then clear and blur to trigger client-side validation.
71+
await name.click()
6872
await name.fill('')
6973
await name.blur()
7074

0 commit comments

Comments
 (0)