Skip to content

Commit 2f4d578

Browse files
committed
Fixed the searchBox helper
1 parent 734b98b commit 2f4d578

9 files changed

Lines changed: 67 additions & 20 deletions

packages/e2e-test-app-fabric/test/AccessibilityTest.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,17 @@ const searchBox = async (input: string) => {
2525
const searchBox = await app.findElementByTestID('example_search');
2626
await app.waitUntil(
2727
async () => {
28+
// Clear before each attempt: WinAppDriver's setValue can fall back to
29+
// synthesised keystrokes for custom RN TextInputs, which append rather
30+
// than replace. Without the clear, a retry produces concatenated text
31+
// and the comparison never converges.
32+
await searchBox.clearValue();
2833
await searchBox.setValue(input);
2934
return (await searchBox.getText()) === input;
3035
},
3136
{
32-
interval: 1500,
33-
timeout: 5000,
37+
interval: 500,
38+
timeout: 10000,
3439
timeoutMsg: `Unable to enter correct search text into test searchbox.`,
3540
},
3641
);

packages/e2e-test-app-fabric/test/ButtonComponentTest.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ const searchBox = async (input: string) => {
2626
const searchBox = await app.findElementByTestID('example_search');
2727
await app.waitUntil(
2828
async () => {
29+
// Clear before each attempt: WinAppDriver's setValue can fall back to
30+
// synthesised keystrokes for custom RN TextInputs, which append rather
31+
// than replace. Without the clear, a retry produces concatenated text
32+
// and the comparison never converges.
33+
await searchBox.clearValue();
2934
await searchBox.setValue(input);
3035
if (input === '') {
3136
return (await searchBox.getText()) === 'Search...';
@@ -34,8 +39,8 @@ const searchBox = async (input: string) => {
3439
}
3540
},
3641
{
37-
interval: 1500,
38-
timeout: 5000,
42+
interval: 500,
43+
timeout: 10000,
3944
timeoutMsg: `Unable to enter correct search text into test searchbox.`,
4045
},
4146
);

packages/e2e-test-app-fabric/test/FlatListComponentTest.test.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,17 @@ const searchBox = async (input: string) => {
2828
const searchBox = await app.findElementByTestID('example_search');
2929
await app.waitUntil(
3030
async () => {
31+
// Clear before each attempt: WinAppDriver's setValue can fall back to
32+
// synthesised keystrokes for custom RN TextInputs, which append rather
33+
// than replace. Without the clear, a retry produces concatenated text
34+
// and the comparison never converges.
35+
await searchBox.clearValue();
3136
await searchBox.setValue(input);
3237
return (await searchBox.getText()) === input;
3338
},
3439
{
35-
interval: 1500,
36-
timeout: 5000,
40+
interval: 500,
41+
timeout: 10000,
3742
timeoutMsg: `Unable to enter correct search text into test searchbox.`,
3843
},
3944
);
@@ -43,12 +48,14 @@ const searchBoxBasic = async (input: string) => {
4348
const searchBox = await app.findElementByTestID('search_bar_flat_list');
4449
await app.waitUntil(
4550
async () => {
51+
// See comment in searchBox above for the clearValue rationale.
52+
await searchBox.clearValue();
4653
await searchBox.setValue(input);
4754
return (await searchBox.getText()) === input;
4855
},
4956
{
50-
interval: 1500,
51-
timeout: 5000,
57+
interval: 500,
58+
timeout: 10000,
5259
timeoutMsg: `Unable to enter correct search text into test searchbox.`,
5360
},
5461
);

packages/e2e-test-app-fabric/test/PointerButtonComponentTest.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ const searchBox = async (input: string) => {
2525
const searchBox = await app.findElementByTestID('example_search');
2626
await app.waitUntil(
2727
async () => {
28+
// Clear before each attempt: WinAppDriver's setValue can fall back to
29+
// synthesised keystrokes for custom RN TextInputs, which append rather
30+
// than replace. Without the clear, a retry produces concatenated text
31+
// and the comparison never converges.
32+
await searchBox.clearValue();
2833
await searchBox.setValue(input);
2934
if (input === '') {
3035
return (await searchBox.getText()) === 'Search...';
@@ -33,8 +38,8 @@ const searchBox = async (input: string) => {
3338
}
3439
},
3540
{
36-
interval: 1500,
37-
timeout: 5000,
41+
interval: 500,
42+
timeout: 10000,
3843
timeoutMsg: `Unable to enter correct search text into test searchbox.`,
3944
},
4045
);

packages/e2e-test-app-fabric/test/RNTesterNavigation.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,17 @@ async function goToExample(example: string) {
3737

3838
await app.waitUntil(
3939
async () => {
40+
// Clear before each attempt: WinAppDriver's setValue can fall back to
41+
// synthesised keystrokes for custom RN TextInputs, which append rather
42+
// than replace. Without the clear, a retry produces concatenated text
43+
// and the comparison never converges.
44+
await searchBox.clearValue();
4045
await searchBox.setValue(searchString);
4146
return (await searchBox.getText()) === searchString;
4247
},
4348
{
44-
interval: 1500,
45-
timeout: 5000,
49+
interval: 500,
50+
timeout: 10000,
4651
timeoutMsg: `Unable to enter correct search text into test searchbox.`,
4752
},
4853
);

packages/e2e-test-app-fabric/test/SwitchComponentTest.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,17 @@ const searchBox = async (input: string) => {
1414
const searchBox = await app.findElementByTestID('example_search');
1515
await app.waitUntil(
1616
async () => {
17+
// Clear before each attempt: WinAppDriver's setValue can fall back to
18+
// synthesised keystrokes for custom RN TextInputs, which append rather
19+
// than replace. Without the clear, a retry produces concatenated text
20+
// and the comparison never converges.
21+
await searchBox.clearValue();
1722
await searchBox.setValue(input);
1823
return (await searchBox.getText()) === input;
1924
},
2025
{
21-
interval: 1500,
22-
timeout: 5000,
26+
interval: 500,
27+
timeout: 10000,
2328
timeoutMsg: `Unable to enter correct search text into test searchbox.`,
2429
},
2530
);

packages/e2e-test-app-fabric/test/TextInputComponentTest.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,17 @@ const searchBox = async (input: string) => {
2525
const searchBox = await app.findElementByTestID('example_search');
2626
await app.waitUntil(
2727
async () => {
28+
// Clear before each attempt: WinAppDriver's setValue can fall back to
29+
// synthesised keystrokes for custom RN TextInputs, which append rather
30+
// than replace. Without the clear, a retry produces "onPressInonPressIn"
31+
// and the comparison never converges.
32+
await searchBox.clearValue();
2833
await searchBox.setValue(input);
2934
return (await searchBox.getText()) === input;
3035
},
3136
{
32-
interval: 1500,
33-
timeout: 5000,
37+
interval: 500,
38+
timeout: 10000,
3439
timeoutMsg: `Unable to enter correct search text into test searchbox.`,
3540
},
3641
);

packages/e2e-test-app-fabric/test/TouchableComponentTest.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,20 @@ const searchBox = async (input: string) => {
2525
const searchBox = await app.findElementByTestID('example_search');
2626
await app.waitUntil(
2727
async () => {
28+
// Clear before each attempt: WinAppDriver's setValue can fall back to
29+
// synthesised keystrokes for custom RN TextInputs, which append rather
30+
// than replace. Without the clear, a retry produces concatenated text
31+
// and the comparison never converges.
32+
await searchBox.clearValue();
2833
await searchBox.setValue(input);
2934
if (input === '') {
3035
return (await searchBox.getText()) === 'Search...';
3136
}
3237
return (await searchBox.getText()) === input;
3338
},
3439
{
35-
interval: 1500,
36-
timeout: 5000,
40+
interval: 500,
41+
timeout: 10000,
3742
timeoutMsg: `Unable to enter correct search text into test searchbox.`,
3843
},
3944
);

packages/e2e-test-app-fabric/test/ViewComponentTest.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,17 @@ const searchBox = async (input: string) => {
2525
const searchBox = await app.findElementByTestID('example_search');
2626
await app.waitUntil(
2727
async () => {
28+
// Clear before each attempt: WinAppDriver's setValue can fall back to
29+
// synthesised keystrokes for custom RN TextInputs, which append rather
30+
// than replace. Without the clear, a retry produces concatenated text
31+
// and the comparison never converges.
32+
await searchBox.clearValue();
2833
await searchBox.setValue(input);
2934
return (await searchBox.getText()) === input;
3035
},
3136
{
32-
interval: 1500,
33-
timeout: 5000,
37+
interval: 500,
38+
timeout: 10000,
3439
timeoutMsg: `Unable to enter correct search text into test searchbox.`,
3540
},
3641
);

0 commit comments

Comments
 (0)