From 7e6b10d72b666b24ba2a2ad7133f97bc5488843e Mon Sep 17 00:00:00 2001 From: Mark de Vocht Date: Sun, 17 May 2026 11:20:11 +0300 Subject: [PATCH] android test fix --- playground/e2e/Buttons.test.js | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/playground/e2e/Buttons.test.js b/playground/e2e/Buttons.test.js index d5dbce89ed..fedf6c892c 100644 --- a/playground/e2e/Buttons.test.js +++ b/playground/e2e/Buttons.test.js @@ -1,3 +1,4 @@ +import { Platform } from 'react-native'; import Utils from './Utils'; import TestIDs from '../src/testIDs'; @@ -22,14 +23,21 @@ describe('Buttons', () => { }); it(':android: should not effect left buttons when hiding back button', async () => { - await elementById(TestIDs.TOGGLE_BACK).tap(); - await expect(elementById(TestIDs.LEFT_BUTTON)).toBeVisible(); - await expect(elementById(TestIDs.TEXTUAL_LEFT_BUTTON)).toBeVisible(); - await expect(elementById(TestIDs.BACK_BUTTON)).toBeVisible(); - - await elementById(TestIDs.TOGGLE_BACK).tap(); - await expect(elementById(TestIDs.LEFT_BUTTON)).toBeVisible(); - await expect(elementById(TestIDs.TEXTUAL_LEFT_BUTTON)).toBeVisible(); + // Jest mock runs with Platform.OS === 'ios'; this test asserts Android-only topBar behavior. + const platform = Platform.OS; + Platform.OS = 'android'; + try { + await elementById(TestIDs.TOGGLE_BACK).tap(); + await expect(elementById(TestIDs.LEFT_BUTTON)).toBeVisible(); + await expect(elementById(TestIDs.TEXTUAL_LEFT_BUTTON)).toBeVisible(); + await expect(elementById(TestIDs.BACK_BUTTON)).toBeVisible(); + + await elementById(TestIDs.TOGGLE_BACK).tap(); + await expect(elementById(TestIDs.LEFT_BUTTON)).toBeVisible(); + await expect(elementById(TestIDs.TEXTUAL_LEFT_BUTTON)).toBeVisible(); + } finally { + Platform.OS = platform; + } }); it('sets right buttons', async () => { await expect(elementById(TestIDs.BUTTON_ONE)).toBeVisible();