Skip to content

chore(test): e2e test-tabs-lifecycle-events#3937

Open
LKuchno wants to merge 23 commits into
mainfrom
@lkuchno/e2e-test-tabs-events
Open

chore(test): e2e test-tabs-lifecycle-events#3937
LKuchno wants to merge 23 commits into
mainfrom
@lkuchno/e2e-test-tabs-events

Conversation

@LKuchno
Copy link
Copy Markdown
Collaborator

@LKuchno LKuchno commented Apr 24, 2026

Description

Updates the test screen component and manual scenario. Adds a Detox suite for tab lifecycle events - onWillAppear, onDidAppear, onWillDisappear, onDidDisappear. Events are surfaced as numbered, color-coded toasts so that both firing order and identity can be asserted programmatically.

Closes: https://github.com/software-mansion/react-native-screens-labs/issues/1123?issue=software-mansion%7Creact-native-screens-labs%7C1183

Changes

e2e/single-feature-tests/tabs/test-tabs-events.e2e.ts
Detox suite with 5 it blocks. A shared dismissToast helper waits for a toast by label and taps it. Toast labels carry numeric prefixes (1. TabA: onWillAppear) so assertions are order-sensitive. Event order assertions are branched by device.getPlatform() to account for the differing iOS / Android firing sequence. The re-tap test is Android only.

test-tabs-events/index.tsx
Added tabBarItemTestID to each route config (tab-a-item, tab-b-item, tab-c-item) so tab bar items are directly addressable by the E2E suite. Added testID to the content container of TabScreen, keyed by route as tabContent-{routeKey}, used to assert which tab is currently visible.

test-tabs-events/scenario.md
Updated E2E status from "ongoing research" to "partially automated" with notes on what is not automated.

@LKuchno LKuchno changed the title chore(test): test-tabs-events screen with scenario chore(test): e2e test-tabs-events Apr 24, 2026
@LKuchno LKuchno added area:tabs Issue related to bottom tabs type:chore A general maintenance task, that does not fall into other categories. type:e2e Actions related to e2e maintenance and development, especially automation. labels Apr 24, 2026
@LKuchno LKuchno marked this pull request as draft April 24, 2026 13:24
@LKuchno
Copy link
Copy Markdown
Collaborator Author

LKuchno commented Apr 27, 2026

Android tests are failing because toasts and the Tabs screen list are displayed 'under' the system navigation bar on older Android versions. This test is waiting for a fix or a workaround.

@LKuchno LKuchno marked this pull request as ready for review April 28, 2026 11:23
@LKuchno LKuchno requested review from Copilot and kkafar April 28, 2026 11:24
@kkafar kkafar changed the base branch from main to @lkuchno/test-tabs-events May 12, 2026 10:43
@kkafar kkafar changed the base branch from @lkuchno/test-tabs-events to main May 12, 2026 10:43
Copy link
Copy Markdown
Member

@kkafar kkafar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. But let's first land #3936 and update this PR before we land it.


async function tapTab(label: string) {
if (device.getPlatform() === 'android') {
await element(by.text(`Tab ${label}`)).tap();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't tapping by id work on Android? Is this something we need to work on? I believe @kmichalikk added the testID for tabs on Android also.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I was writing this test I think there was problem with it, but now it works correctly.
I've changed this part of code to tap element by testID.
06824d0

describe('Tabs lifecycle events', () => {
beforeAll(async () => {
await device.reloadReactNative();
await selectSingleFeatureTestsScreen('Tabs', 'test-tabs-events');
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we change name of the test, this will need to be updated.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LKuchno LKuchno changed the title chore(test): e2e test-tabs-events chore(test): e2e test-tabs-lifecycle-events May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:tabs Issue related to bottom tabs type:chore A general maintenance task, that does not fall into other categories. type:e2e Actions related to e2e maintenance and development, especially automation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants