Skip to content

Commit c060495

Browse files
committed
test update for ios 26 only
1 parent aabbd8b commit c060495

File tree

3 files changed

+36
-14
lines changed

3 files changed

+36
-14
lines changed

playground/e2e/SearchBar.test.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ describe.e2e(':ios: SearchBar', () => {
1717
await expect(elementByTraits(['searchField'])).toBeNotVisible();
1818
});
1919

20-
it('find magnifying button in integrated placement and tap it', async () => {
20+
it('find magnifying button in integrated placement and tap it (iOS 26+)', async () => {
21+
try {
22+
await expect(elementById(TestIDs.TOGGLE_PLACEMENT_BTN)).toExist();
23+
} catch (e) {
24+
console.log('Skipping - requires iOS 26+');
25+
return;
26+
}
2127
await elementById(TestIDs.TOGGLE_PLACEMENT_BTN).tap();
2228
await elementById(TestIDs.SHOW_SEARCH_BAR_BTN).tap();
2329
const searchButton = element(
@@ -46,11 +52,21 @@ describe.e2e(':ios: SearchBar Modal', () => {
4652
it('searching then exiting works', async () => {
4753
await elementById(TestIDs.SHOW_SEARCH_BAR_BTN).tap();
4854
await elementByTraits(['searchField']).replaceText('foo');
49-
await elementById(TestIDs.DISMISS_MODAL_TOPBAR_BTN).tap();
50-
await expect(elementById(TestIDs.OPTIONS_TAB)).toBeVisible();
55+
try {
56+
await expect(elementById(TestIDs.TOGGLE_PLACEMENT_BTN)).toExist();
57+
} catch (e) {
58+
await elementById(TestIDs.DISMISS_MODAL_TOPBAR_BTN).tap();
59+
await expect(elementById(TestIDs.OPTIONS_TAB)).toBeVisible();
60+
}
5161
});
5262

53-
it('find magnifying button in integrated placement and tap it', async () => {
63+
it('find magnifying button in integrated placement and tap it (iOS 26+)', async () => {
64+
try {
65+
await expect(elementById(TestIDs.TOGGLE_PLACEMENT_BTN)).toExist();
66+
} catch (e) {
67+
console.log('Skipping - requires iOS 26+');
68+
return;
69+
}
5470
await elementById(TestIDs.TOGGLE_PLACEMENT_BTN).tap();
5571
await elementById(TestIDs.SHOW_SEARCH_BAR_BTN).tap();
5672
const searchButton = element(

playground/src/screens/SearchBar.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import { Platform } from 'react-native';
23
import { NavigationProps } from 'react-native-navigation';
34

45
import Root from '../components/Root';
@@ -36,11 +37,13 @@ export default class SearchBar extends React.Component<Props> {
3637
<Button label="Show TopBar" testID={SHOW_TOP_BAR_BTN} onPress={this.showTopBar} />
3738
<Button label="Hide SearchBar" testID={HIDE_SEARCH_BAR_BTN} onPress={this.hideSearchBar} />
3839
<Button label="Show SearchBar" testID={SHOW_SEARCH_BAR_BTN} onPress={this.showSearchBar} />
39-
<Button
40-
label={`Toggle Placement (${this.state.placement})`}
41-
testID={TOGGLE_PLACEMENT_BTN}
42-
onPress={this.togglePlacement}
43-
/>
40+
{parseInt(String(Platform.Version), 10) >= 26 && (
41+
<Button
42+
label={`Toggle Placement (${this.state.placement})`}
43+
testID={TOGGLE_PLACEMENT_BTN}
44+
onPress={this.togglePlacement}
45+
/>
46+
)}
4447
</Root>
4548
);
4649
}

playground/src/screens/SearchBarModal.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import { Platform } from 'react-native';
23
import { NavigationProps } from 'react-native-navigation';
34
import Button from '../components/Button';
45
import Root from '../components/Root';
@@ -34,11 +35,13 @@ export default class SearchBarModal extends React.Component<Props> {
3435
{/* <Button label="Show TopBar" testID={SHOW_TOP_BAR_BTN} onPress={this.showTopBar} /> */}
3536
<Button label="Hide SearchBar" testID={HIDE_SEARCH_BAR_BTN} onPress={this.hideSearchBar} />
3637
<Button label="Show SearchBar" testID={SHOW_SEARCH_BAR_BTN} onPress={this.showSearchBar} />
37-
<Button
38-
label={`Toggle Placement (${this.state.placement})`}
39-
testID={TOGGLE_PLACEMENT_BTN}
40-
onPress={this.togglePlacement}
41-
/>
38+
{parseInt(String(Platform.Version), 10) >= 26 && (
39+
<Button
40+
label={`Toggle Placement (${this.state.placement})`}
41+
testID={TOGGLE_PLACEMENT_BTN}
42+
onPress={this.togglePlacement}
43+
/>
44+
)}
4245
</Root>
4346
);
4447
}

0 commit comments

Comments
 (0)