From 55a0e44ee286c8aec5e5529b59b5d817abc190b2 Mon Sep 17 00:00:00 2001 From: Harini Malothu Date: Mon, 28 Jul 2025 23:37:51 +0530 Subject: [PATCH 1/4] Fix for pressevent testcases --- .../test/TextInputComponentTest.test.ts | 93 ++++++------------- 1 file changed, 30 insertions(+), 63 deletions(-) diff --git a/packages/e2e-test-app-fabric/test/TextInputComponentTest.test.ts b/packages/e2e-test-app-fabric/test/TextInputComponentTest.test.ts index 92235e2b8fc..57f75c638cf 100644 --- a/packages/e2e-test-app-fabric/test/TextInputComponentTest.test.ts +++ b/packages/e2e-test-app-fabric/test/TextInputComponentTest.test.ts @@ -194,69 +194,6 @@ describe('TextInput Tests', () => { }, ); }); - test('TextInput triggers onPressIn and updates state text', async () => { - // Scroll the example into view - await searchBox('onPressIn'); - const component = await app.findElementByTestID('textinput-pressin'); - await component.waitForDisplayed({timeout: 5000}); - const dump = await dumpVisualTree('textinput-pressin'); - expect(dump).toMatchSnapshot(); - - // Trigger onPressIn (click only) - await component.click(); - const stateText = await app.findElementByTestID( - 'textinput-state-display-in', - ); - - await app.waitUntil( - async () => { - const currentText = await stateText.getText(); - return currentText === 'Holding down the click/touch'; - }, - { - timeout: 5000, - timeoutMsg: 'State text not updated after onPressIn.', - }, - ); - // Assertion - expect(await stateText.getText()).toBe('Holding down the click/touch'); - // This step helps avoid UI lock by unfocusing the input - const search = await app.findElementByTestID('example_search'); - await search.setValue(''); - }); - test('TextInput triggers onPressOut and updates state text', async () => { - // Scroll the example into view - await searchBox('onPressOut'); - const component = await app.findElementByTestID('textinput-pressout'); - await component.waitForDisplayed({timeout: 5000}); - const dump = await dumpVisualTree('textinput-pressout'); - expect(dump).toMatchSnapshot(); - - // Trigger onPressOut followed by onPressOut (using touchAction for press and release) - await component.click(); - const stateText = await app.findElementByTestID( - 'textinput-state-display-out', - ); - - // Wait for onPressOut to update the state text - await app.waitUntil( - async () => { - const currentText = await stateText.getText(); - return currentText === 'Released click/touch'; - }, - { - timeout: 5000, - timeoutMsg: 'State text not updated after onPressOut.', - }, - ); - - // Assertion - expect(await stateText.getText()).toBe('Released click/touch'); - - // Clean up by unfocusing the input - const search = await app.findElementByTestID('example_search'); - await search.setValue(''); - }); test('TextInputs can have attributed text', async () => { const component = await app.findElementByTestID('text-input'); await component.waitForDisplayed({timeout: 5000}); @@ -988,4 +925,34 @@ describe('TextInput Tests', () => { const dump = await dumpVisualTree('textinput-searchbox'); expect(dump).toMatchSnapshot(); }); + test('TextInput triggers onPressIn and updates state text', async () => { + // Scroll the example into view + await searchBox('onPressIn'); + const component = await app.findElementByTestID('textinput-pressin'); + await component.waitForDisplayed({ timeout: 5000 }); + const dump = await dumpVisualTree('textinput-pressin'); + expect(dump).toMatchSnapshot(); + await component.click(); + + //await componentFocusTrue.click(); + const stateText = await app.findElementByTestID( + 'textinput-state-display-in', + ); + expect(await stateText.getText()).toBe('Holding down the click/touch'); + // This step helps avoid UI lock by unfocusing the input + }); + test('TextInput triggers onPressOut and updates state text', async () => { + // Scroll the example into view + const component = await app.findElementByTestID('textinput-pressout'); + await component.waitForDisplayed({ timeout: 5000 }); + const dump = await dumpVisualTree('textinput-pressout'); + expect(dump).toMatchSnapshot(); + const stateText = await app.findElementByTestID( + 'textinput-state-display-out', + ); + // Trigger onPressOut followed by onPressOut (using touchAction for press and release) + await component.click(); + // Assertion + expect(await stateText.getText()).toBe('Released click/touch'); + }); }); From e151fa3bf5c214e0d0ed8cdd7d7e590f338c39df Mon Sep 17 00:00:00 2001 From: Harini Malothu Date: Tue, 29 Jul 2025 10:15:33 +0530 Subject: [PATCH 2/4] Fixed linting errors --- .../test/TextInputComponentTest.test.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/e2e-test-app-fabric/test/TextInputComponentTest.test.ts b/packages/e2e-test-app-fabric/test/TextInputComponentTest.test.ts index 57f75c638cf..964c0c1f5b3 100644 --- a/packages/e2e-test-app-fabric/test/TextInputComponentTest.test.ts +++ b/packages/e2e-test-app-fabric/test/TextInputComponentTest.test.ts @@ -929,30 +929,30 @@ describe('TextInput Tests', () => { // Scroll the example into view await searchBox('onPressIn'); const component = await app.findElementByTestID('textinput-pressin'); - await component.waitForDisplayed({ timeout: 5000 }); + await component.waitForDisplayed({timeout: 5000}); const dump = await dumpVisualTree('textinput-pressin'); expect(dump).toMatchSnapshot(); await component.click(); //await componentFocusTrue.click(); const stateText = await app.findElementByTestID( - 'textinput-state-display-in', + 'textinput-state-display-in', ); expect(await stateText.getText()).toBe('Holding down the click/touch'); // This step helps avoid UI lock by unfocusing the input - }); + }); test('TextInput triggers onPressOut and updates state text', async () => { // Scroll the example into view const component = await app.findElementByTestID('textinput-pressout'); - await component.waitForDisplayed({ timeout: 5000 }); + await component.waitForDisplayed({timeout: 5000}); const dump = await dumpVisualTree('textinput-pressout'); expect(dump).toMatchSnapshot(); const stateText = await app.findElementByTestID( - 'textinput-state-display-out', + 'textinput-state-display-out', ); // Trigger onPressOut followed by onPressOut (using touchAction for press and release) await component.click(); // Assertion expect(await stateText.getText()).toBe('Released click/touch'); - }); + }); }); From 262b9d610ba4d5c106fb2131f885ae83c455cdf1 Mon Sep 17 00:00:00 2001 From: Harini Malothu Date: Wed, 30 Jul 2025 13:40:02 +0530 Subject: [PATCH 3/4] Updated testcase --- .../test/TextInputComponentTest.test.ts | 38 +++++++++++++++---- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/packages/e2e-test-app-fabric/test/TextInputComponentTest.test.ts b/packages/e2e-test-app-fabric/test/TextInputComponentTest.test.ts index 964c0c1f5b3..67c7a9bce16 100644 --- a/packages/e2e-test-app-fabric/test/TextInputComponentTest.test.ts +++ b/packages/e2e-test-app-fabric/test/TextInputComponentTest.test.ts @@ -932,27 +932,51 @@ describe('TextInput Tests', () => { await component.waitForDisplayed({timeout: 5000}); const dump = await dumpVisualTree('textinput-pressin'); expect(dump).toMatchSnapshot(); - await component.click(); - //await componentFocusTrue.click(); + // Trigger onPressIn (click only) + await component.click(); const stateText = await app.findElementByTestID( 'textinput-state-display-in', ); + + await app.waitUntil( + async () => { + const currentText = await stateText.getText(); + return currentText === 'Holding down the click/touch'; + }, + { + timeout: 5000, + timeoutMsg: 'State text not updated after onPressIn.', + }, + ); + // Assertion expect(await stateText.getText()).toBe('Holding down the click/touch'); - // This step helps avoid UI lock by unfocusing the input }); test('TextInput triggers onPressOut and updates state text', async () => { - // Scroll the example into view const component = await app.findElementByTestID('textinput-pressout'); await component.waitForDisplayed({timeout: 5000}); const dump = await dumpVisualTree('textinput-pressout'); expect(dump).toMatchSnapshot(); + + // Trigger onPressOut followed by onPressOut (using touchAction for press and release) + await component.click(); const stateText = await app.findElementByTestID( 'textinput-state-display-out', ); - // Trigger onPressOut followed by onPressOut (using touchAction for press and release) - await component.click(); + + // Wait for onPressOut to update the state text + await app.waitUntil( + async () => { + const currentText = await stateText.getText(); + return currentText === 'Released click/touch'; + }, + { + timeout: 10000, + timeoutMsg: 'State text not updated after onPressOut.', + }, + ); + // Assertion expect(await stateText.getText()).toBe('Released click/touch'); }); -}); +}); \ No newline at end of file From 15c7ce57ab4e7b3a072d668aca08d2577b081059 Mon Sep 17 00:00:00 2001 From: Harini Malothu Date: Wed, 30 Jul 2025 14:30:24 +0530 Subject: [PATCH 4/4] Fixed linting errors --- .../e2e-test-app-fabric/test/TextInputComponentTest.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/e2e-test-app-fabric/test/TextInputComponentTest.test.ts b/packages/e2e-test-app-fabric/test/TextInputComponentTest.test.ts index 67c7a9bce16..1894a4bca81 100644 --- a/packages/e2e-test-app-fabric/test/TextInputComponentTest.test.ts +++ b/packages/e2e-test-app-fabric/test/TextInputComponentTest.test.ts @@ -979,4 +979,4 @@ describe('TextInput Tests', () => { // Assertion expect(await stateText.getText()).toBe('Released click/touch'); }); -}); \ No newline at end of file +});