From 2bfd702fcd6b78c25685af9978c4fe6cbc4345ac Mon Sep 17 00:00:00 2001 From: pietro909 <2094604+pietro909@users.noreply.github.com> Date: Thu, 7 Apr 2022 10:46:25 +0200 Subject: [PATCH] chore: [IA-805] Update e2e tests (#3889) * Add TestID to list and items * Update test to account for pagination * Update MessageListItem snapshot Co-authored-by: Emilio Pavia --- ts/__e2e__/messages.e2e.ts | 7 +++++-- ts/components/messages/paginated/MessageList/Item.tsx | 1 + .../__tests__/__snapshots__/Item.test.tsx.snap | 9 +++++++++ ts/components/messages/paginated/MessageList/index.tsx | 5 ++++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ts/__e2e__/messages.e2e.ts b/ts/__e2e__/messages.e2e.ts index 7ed7bfd37a0..fa9d704ad8f 100644 --- a/ts/__e2e__/messages.e2e.ts +++ b/ts/__e2e__/messages.e2e.ts @@ -22,13 +22,16 @@ describe("Messages Screen", () => { // exists (but is not visible) await waitFor( - element(by.id(`MessageListItem_00000000000000000000000021`)) + element(by.id(`MessageListItem_00000000000000000000000020`)) ) .toBeVisible() .withTimeout(e2eWaitRenderTimeout); + // check for infinite scrolling + await element(by.id(`MessageList_inbox`)).scrollTo("bottom"); + await waitFor( - element(by.id(`MessageListItem_00000000000000000000000001`)) + element(by.id(`MessageListItem_00000000000000000000000008`)) ) .toExist() .withTimeout(e2eWaitRenderTimeout); diff --git a/ts/components/messages/paginated/MessageList/Item.tsx b/ts/components/messages/paginated/MessageList/Item.tsx index 423c2e1efad..60b8f806c03 100644 --- a/ts/components/messages/paginated/MessageList/Item.tsx +++ b/ts/components/messages/paginated/MessageList/Item.tsx @@ -267,6 +267,7 @@ const MessageListItem = ({ accessible={true} accessibilityLabel={announceMessage(message, isRead, maybeItemBadge)} accessibilityRole="button" + testID={`MessageListItem_${message.id}`} > diff --git a/ts/components/messages/paginated/MessageList/__tests__/__snapshots__/Item.test.tsx.snap b/ts/components/messages/paginated/MessageList/__tests__/__snapshots__/Item.test.tsx.snap index 5f1ea733167..d86493519e8 100644 --- a/ts/components/messages/paginated/MessageList/__tests__/__snapshots__/Item.test.tsx.snap +++ b/ts/components/messages/paginated/MessageList/__tests__/__snapshots__/Item.test.tsx.snap @@ -21,6 +21,7 @@ exports[`MessageList Item component when \`isRead\` is true should match the sna "paddingVertical": 16, } } + testID="MessageListItem_PMT00003" > { // when filteredMessage is defined, this component is used // in search, so loading data on demand should be prevented @@ -292,6 +293,7 @@ const MessageList = ({ onLayout={handleOnLayoutChange} onEndReached={onEndReached} onEndReachedThreshold={0.1} + testID={testID} ListFooterComponent={renderListFooter} /> @@ -319,6 +321,7 @@ const mapStateToProps = (state: GlobalState, { filter }: OwnProps) => { const didLoad = pot.isSome(paginatedState); return { allMessages, + testID: `MessageList_${isArchive ? "archive" : "inbox"}`, error, hasPaidBadge: (category: UIMessage["category"]) => isNoticePaid(state, category),