Skip to content

Commit 86f9326

Browse files
Copilotanupriya13
andcommitted
Add functional tests for FlatList component
Co-authored-by: anupriya13 <54227869+anupriya13@users.noreply.github.com>
1 parent 45a143a commit 86f9326

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

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

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,66 @@ describe('FlatList Tests', () => {
126126
const dump = await dumpVisualTree('flatlist-nested');
127127
expect(dump).toMatchSnapshot();
128128
});
129+
130+
// Functional tests for fast refresh scenarios
131+
test('FlatList styles should render correctly with multicolumn layout', async () => {
132+
await searchBox('Multi');
133+
await goToFlatListExample('Multi Column');
134+
135+
const component = await app.findElementByTestID('flat_list');
136+
await component.waitForDisplayed({timeout: 5000});
137+
const dump = await dumpVisualTree('flat_list');
138+
expect(dump).toMatchSnapshot();
139+
});
140+
141+
test('FlatList contents should update with search filtering', async () => {
142+
await searchBox('Basic');
143+
await goToFlatListExample('Basic');
144+
145+
// Test filtering content with specific text
146+
await searchBoxBasic('5');
147+
148+
const component = await app.findElementByTestID('flatlist-basic');
149+
await component.waitForDisplayed({timeout: 5000});
150+
const dump = await dumpVisualTree('flatlist-basic');
151+
expect(dump).toMatchSnapshot();
152+
});
153+
154+
test('FlatList scrolling should work with inverted list', async () => {
155+
await searchBox('Inverted');
156+
await goToFlatListExample('Inverted');
157+
158+
const component = await app.findElementByTestID('flat_list');
159+
await component.waitForDisplayed({timeout: 5000});
160+
const dump = await dumpVisualTree('flat_list');
161+
expect(dump).toMatchSnapshot();
162+
});
163+
164+
test('FlatList footer should update correctly', async () => {
165+
await searchBox('Basic');
166+
await goToFlatListExample('Basic');
167+
168+
// The basic example includes a footer by default, verify it's rendered
169+
const component = await app.findElementByTestID('flatlist-basic');
170+
await component.waitForDisplayed({timeout: 5000});
171+
172+
// Look for footer content in the visual tree
173+
const dump = await dumpVisualTree('flatlist-basic');
174+
expect(dump).toMatchSnapshot();
175+
expect(JSON.stringify(dump)).toContain('LIST FOOTER');
176+
});
177+
178+
test('FlatList header should update correctly', async () => {
179+
await searchBox('Basic');
180+
await goToFlatListExample('Basic');
181+
182+
// The basic example includes a header by default, verify it's rendered
183+
const component = await app.findElementByTestID('flatlist-basic');
184+
await component.waitForDisplayed({timeout: 5000});
185+
186+
// Look for header content in the visual tree
187+
const dump = await dumpVisualTree('flatlist-basic');
188+
expect(dump).toMatchSnapshot();
189+
expect(JSON.stringify(dump)).toContain('LIST HEADER');
190+
});
129191
});

0 commit comments

Comments
 (0)