Skip to content

Add Functional Tests for FlatList Component #14768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Add functional tests for FlatList component",
"packageName": "react-native-windows",
"email": "[email protected]",
"dependentChangeType": "patch"
}
61 changes: 61 additions & 0 deletions packages/e2e-test-app-fabric/test/FlatListComponentTest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,65 @@ describe('FlatList Tests', () => {
const dump = await dumpVisualTree('flatlist-nested');
expect(dump).toMatchSnapshot();
});

test('FlatList styles should render correctly with multicolumn layout', async () => {
await searchBox('Multi');
await goToFlatListExample('Multi Column');

const component = await app.findElementByTestID('flat_list');
await component.waitForDisplayed({timeout: 5000});
const dump = await dumpVisualTree('flat_list');
expect(dump).toMatchSnapshot();
});

test('FlatList contents should update with search filtering', async () => {
await searchBox('Basic');
await goToFlatListExample('Basic');

// Test filtering content with specific text
await searchBoxBasic('5');

const component = await app.findElementByTestID('flatlist-basic');
await component.waitForDisplayed({timeout: 5000});
const dump = await dumpVisualTree('flatlist-basic');
expect(dump).toMatchSnapshot();
});

test('FlatList scrolling should work with inverted list', async () => {
await searchBox('Inverted');
await goToFlatListExample('Inverted');

const component = await app.findElementByTestID('flat_list');
await component.waitForDisplayed({timeout: 5000});
const dump = await dumpVisualTree('flat_list');
expect(dump).toMatchSnapshot();
});

test('FlatList footer should update correctly', async () => {
await searchBox('Basic');
await goToFlatListExample('Basic');

// The basic example includes a footer by default, verify it's rendered
const component = await app.findElementByTestID('flatlist-basic');
await component.waitForDisplayed({timeout: 5000});

// Look for footer content in the visual tree
const dump = await dumpVisualTree('flatlist-basic');
expect(dump).toMatchSnapshot();
expect(JSON.stringify(dump)).toContain('LIST FOOTER');
});

test('FlatList header should update correctly', async () => {
await searchBox('Basic');
await goToFlatListExample('Basic');

// The basic example includes a header by default, verify it's rendered
const component = await app.findElementByTestID('flatlist-basic');
await component.waitForDisplayed({timeout: 5000});

// Look for header content in the visual tree
const dump = await dumpVisualTree('flatlist-basic');
expect(dump).toMatchSnapshot();
expect(JSON.stringify(dump)).toContain('LIST HEADER');
});
});