Skip to content

refactor(test): expand e2e coverage for tab bar layout direction#4072

Open
LKuchno wants to merge 5 commits into
mainfrom
@lkuchno/e2e-update-test-tabs-tab-bar-layout-direction
Open

refactor(test): expand e2e coverage for tab bar layout direction#4072
LKuchno wants to merge 5 commits into
mainfrom
@lkuchno/e2e-update-test-tabs-tab-bar-layout-direction

Conversation

@LKuchno
Copy link
Copy Markdown
Collaborator

@LKuchno LKuchno commented May 20, 2026

Summary

  • Expands the test-tabs-tab-bar-layout-direction Detox suite to cover two previously missing iOS-only scenarios: system LTR + React Native forced RTL, and system RTL + React Native allowRTL: false (forced LTR). These scenarios test the interaction between the OS-level writing direction and the React Native I18nManager overrides independently, which the previous cross-platform tests could not exercise.
  • Fixes the beforeEachbeforeAll regression in the LTR suite's setup hook, preventing redundant app reloads between tests.
  • Corrects label assertions in both default-state tests: the direction picker now correctly initialises to ltr / rtl (reflecting the resolved effective direction) rather than the previously expected inherit.
  • Updates the scenario's E2E test field from Other: Covers first two manual scenarios to Yes: Covers all scenarios, and removes the stale note about iOS-specific tests being pending.

Changes

  • E2E/Tabs: Added two new describeIfiOS blocks covering (1) system LTR + RN forced RTL and (2) system RTL + RN allowRTL: false, each with default-state, explicit direction override, and cycle-through tests
  • E2E/Tabs: Changed beforeEach to beforeAll in the LTR suite to avoid redundant reloadReactNative calls between individual test cases
  • E2E/Tabs: Corrected toHaveLabel assertions for the direction picker default state ('direction: ltr' / 'direction: rtl' instead of 'direction: inherit')
  • E2E/Tabs: Renamed describe blocks to system/RN settings: LTR|RTL to clarify they cover both OS and React Native direction settings
  • Scenario: Updated test-tabs-tab-bar-layout-direction/scenario.md to mark E2E coverage as complete and remove the "iOS tests pending" note

@LKuchno LKuchno requested a review from Copilot May 20, 2026 15:10
@LKuchno LKuchno added platform:ios Issue related to iOS part of the library area:tabs Issue related to bottom tabs type:e2e Actions related to e2e maintenance and development, especially automation. labels May 20, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR expands the Detox E2E coverage for the “tab bar layout direction” scenario, specifically to validate iOS-only combinations where the OS writing direction and React Native I18nManager overrides are intentionally set to disagree.

Changes:

  • Expanded the existing test-tabs-tab-bar-layout-direction Detox suite with two new iOS-only scenario blocks (system LTR + RN forced RTL, and system RTL + RN forced LTR via allowRTL: false).
  • Reduced redundant setup work by switching the LTR suite hook from beforeEach to beforeAll.
  • Updated default-state assertions so the direction picker reflects the resolved effective direction (ltr/rtl) rather than inherit, and refreshed scenario documentation to indicate complete E2E coverage.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
FabricExample/e2e/single-feature-tests/tabs/test-tabs-tab-bar-layout-direction.e2e.ts Adds iOS-only direction-mismatch coverage, adjusts setup hooks, and updates label/order assertions.
apps/src/tests/single-feature-tests/tabs/test-tabs-tab-bar-layout-direction/scenario.md Updates the scenario doc to reflect that E2E coverage now spans all listed LTR/RTL configurations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

'iOS only: Tab Bar Layout Direction - system settings: LTR and RN settings: RTL',
() => {
beforeAll(async () => {
await device.launchApp({ newInstance: true });
Comment on lines +260 to +265
it('overrides system RTL settings and renders the tab bar in ltr order', async () => {
await selectDirection('ltr');
await expectTab1ToBeLeftOfTab2(true);
});

it('follows RN RTL settings when direction is set to inherit', async () => {
},
);
describeIfiOS(
'Tab Bar Layout Direction - system settings: RTL and RN settings: LTR',
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (2)

FabricExample/e2e/single-feature-tests/tabs/test-tabs-tab-bar-layout-direction.e2e.ts:248

  • This iOS-only suite changes the RN RTL configuration (allowRTL: false) and reloads RN, but afterAll only relaunches with different iOS writing-direction launchArgs. Because I18nManager.allowRTL/forceRTL can persist across relaunches, this risks leaking the forced-LTR RN setting into later Detox tests. Add cleanup that restores RN RTL settings to defaults (allowRTL=true, forceRTL=false) and restarts so later suites start from a known baseline.
    afterAll(async () => {
      await launchAppWithAttributes({
        AppleTextDirection: 'NO',
        NSForceRightToLeftWritingDirection: 'NO',
        I18NIsRTL: 'NO',
      });
    });

FabricExample/e2e/single-feature-tests/tabs/test-tabs-tab-bar-layout-direction.e2e.ts:329

  • This iOS-only suite sets forceRTL: true and reloads RN, but afterAll only relaunches the app without resetting the persisted I18nManager RTL configuration. That can leave the whole app in RTL for subsequent Detox test files. Add cleanup to restore forceRTL/allowRTL defaults and restart so the rest of the e2e run isn’t affected.
    afterAll(async () => {
      await launchAppWithAttributes();
    });

Comment on lines +218 to +224
await device.launchApp({
newInstance: true,
launchArgs: {
AppleTextDirection: 'YES',
NSForceRightToLeftWritingDirection: 'YES',
I18NIsRTL: 'YES',
},
Comment on lines +163 to 171
await expect(element(by.id('is-rtl-information'))).toHaveText(
'I18nManager.isRTL == true',
);
await expect(element(by.id('react-force-rtl-picker'))).toHaveLabel(
'forceRTL: false',
);
await expect(element(by.id('react-allow-rtl-picker'))).toHaveLabel(
'allowRTL: true',
);
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.

It's as expected, we want to set RN RTL and keep it set for this test suites. afterAll function relaunch app setting direction back to LTR.

@LKuchno LKuchno requested a review from kligarski May 21, 2026 08:16
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 platform:ios Issue related to iOS part of the library 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