Skip to content

Commit 634c619

Browse files
committed
onTabSelected added to display toast on screen, scenario updated to dont use devtools
1 parent 1c29f34 commit 634c619

2 files changed

Lines changed: 22 additions & 18 deletions

File tree

apps/src/tests/single-feature-tests/tabs/test-tabs-more-navigation-controller/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
import { CenteredLayoutView } from '@apps/shared/CenteredLayoutView';
1212
import { ToastProvider, useToast } from '@apps/shared/';
1313
import { Colors } from '@apps/shared/styling';
14-
import type { MoreTabSelectedEvent } from 'react-native-screens';
14+
import type { MoreTabSelectedEvent, TabSelectedEvent } from 'react-native-screens';
1515

1616
const scenarioDescription: ScenarioDescription = {
1717
name: 'More navigation controller',
@@ -107,6 +107,12 @@ function AppContents() {
107107
toast.push({ message: 'onMoreTabSelected', backgroundColor: Colors.GreenLight60 });
108108
},
109109
}}
110+
onTabSelected={(event: NativeSyntheticEvent<TabSelectedEvent>) => {
111+
toast.push({
112+
backgroundColor: Colors.BlueLight100,
113+
message: `onTabSelected: ${JSON.stringify(event.nativeEvent.selectedScreenKey)}`,
114+
});
115+
}}
110116
/>
111117
);
112118
}

apps/src/tests/single-feature-tests/tabs/test-tabs-more-navigation-controller/scenario.md

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,13 @@ Other: Ongoing research.
1818

1919
- On iPad: The More tab only appears when the window is resized to a compact width size class. For iOS 18 and older, a Split View must be triggered to achieve this.
2020

21-
- Toasts: A new toast should appear only after the steps where the "Expected" section explicitly mentions it.
22-
23-
- DevTools: On the focused device, press Shift+Cmd+D and select 'Open DevTools' from the menu. To view the logs relevant to this scenario, filter the console output by `TabSelected`.
21+
- Toasts: A blue toast with the message `onTabSelected:"<selected tab name>"` should appear after each tab selection - except when the More tab list is displayed (which triggers a green `onMoreTabSelected` toast instead). In this scenario, this action is only mentioned in steps involving non-intuitive situations.
2422

2523
## Steps - iPhone
2624

2725
### Baseline
2826

29-
1. Launch the app and navigate to the **More navigation controller** scenario. Open DevTools.
27+
1. Launch the app and navigate to the **More navigation controller** scenario.
3028

3129
- [ ] Expected: Tab bar shows **First**, **Second**, **Third**, **Fourth**, and **More**. The **First** tab is selected. The content area displays `First` as the route key.
3230

@@ -36,19 +34,19 @@ Other: Ongoing research.
3634

3735
2. Tap the **More** tab in the tab bar.
3836

39-
- [ ] Expected: The native More screen opens, listing **Fifth** and **Sixth** as available tabs. A green toast appears at the bottom with the message onMoreTabSelected. In the console, the onMoreTabSelected event should be logged with selectedScreenKey,provenance and target values corresponding to last onTabSelected event.
37+
- [ ] Expected: The native More screen opens, listing **Fifth** and **Sixth** as available tabs. A green toast appears at the bottom with the message `onMoreTabSelected`.
4038

4139
3. Tap **Fifth** in the More screen list.
4240

43-
- [ ] Expected: The **Fifth** tab content is shown. The route key label reads `Fifth`. The More tab remains selected in the tab bar. No new onMoreTabSelected event appears in the console log.
41+
- [ ] Expected: The **Fifth** tab content is shown. The route key label reads `Fifth`. The More tab remains selected in the tab bar.
4442

4543
4. Tap **Third** tab in the tab bar.
4644

4745
- [ ] Expected: **Third** tab becomes active. Tab bar selection updates, and the route key label reads `Third`.
4846

4947
5. Tap the **More** tab in the tab bar.
5048

51-
- [ ] Expected: The Fifth tab content is displayed, and the route key label reads `Fifth`. The Tab Bar updates to show that the More tab is selected. No new onMoreTabSelected event appears in the console log.
49+
- [ ] Expected: The Fifth tab content is displayed, and the route key label reads `Fifth`. The Tab Bar updates to show that the More tab is selected.
5250

5351
6. Tap the **More** tab again.
5452

@@ -70,7 +68,7 @@ Other: Ongoing research.
7068

7169
- [ ] Expected: **Fifth** tab content is shown, and the route key label reads `Fifth`. The More tab is selected in the tab bar. No crash or blank screen.
7270

73-
1. Tap **"Select First"** and then tap **"Select Sixth"**.
71+
10. Tap **"Select First"** and then tap **"Select Sixth"**.
7472

7573
- [ ] Expected: **Sixth** tab content is shown, and the route key label reads `Sixth`. The More tab is selected in the tab bar.
7674

@@ -92,23 +90,23 @@ Other: Ongoing research.
9290

9391
2. Navigate between tabs using tab items from tab bar.
9492

95-
- [ ] Expected: Each transition updates the route key label and tab bar selection correctly. No visual glitches or stale route key labels. No onMoreTabSelected event appears in the console log.
93+
- [ ] Expected: Each transition updates the route key label and tab bar selection correctly. No visual glitches or stale route key labels.
9694

9795
3. Navigate between tabs using buttons from screen.
9896

99-
- [ ] Expected: Each transition updates the route key label and tab bar selection correctly. No visual glitches or stale route key labels. No onMoreTabSelected event appears in the console log.
97+
- [ ] Expected: Each transition updates the route key label and tab bar selection correctly. No visual glitches or stale route key labels.
10098

10199
---
102100

103101
### More tab — tap interaction with app resizing
104102

105103
4. Select `First` tab and resize app to iPhone size view.
106104

107-
- [ ] Expected: Tab bar shows **First**, **Second**, **Third**, **Fourth**, and **More**. The **First** tab is selected. The content area displays `First` as the route key. No onMoreTabSelected event appears in the console log.
105+
- [ ] Expected: Tab bar shows **First**, **Second**, **Third**, **Fourth**, and **More**. The **First** tab is selected. The content area displays `First` as the route key.
108106

109107
5. Tap the **More** tab in the tab bar.
110108

111-
- [ ] Expected: The native More screen opens, listing **Fifth** and **Sixth** as available tabs. A green toast appears at the bottom with the message onMoreTabSelected. In the console, the onMoreTabSelected event should be logged with selectedScreenKey,provenance and target values corresponding to last onTabSelected event.
109+
- [ ] Expected: The native More screen opens, listing **Fifth** and **Sixth** as available tabs. A green toast appears at the bottom with the message `onMoreTabSelected`.
112110

113111
6. Tap **Fifth** in the More screen list.
114112

@@ -120,17 +118,17 @@ Other: Ongoing research.
120118

121119
8. Tap the **More** tab in the tab bar.
122120

123-
- [ ] Expected: The **Fifth** tab content is shown. The route key label reads `Fifth`. Tab bar selection updates - More tab is selected. No onMoreTabSelected event appears in the console log.
121+
- [ ] Expected: The **Fifth** tab content is shown. The route key label reads `Fifth`. Tab bar selection updates - More tab is selected.
124122

125123
9. Tap the **More** tab again.
126124

127125
- [ ] Expected: The native More screen opens, listing **Fifth** and **Sixth** as available tabs. New green toast appear with `onMoreTabSelected` message.
128126

129127
10. Tap **Second** tab in the tab bar.
130128

131-
- [ ] Expected: **Second** tab becomes active. Tab bar selection updates, and the route key label reads `Second`. In the console, the onTabSelected event should be logged with selectedScreenKey set to 'Second'.
129+
- [ ] Expected: **Second** tab becomes active. Tab bar selection updates, and the route key label reads `Second`. A blue toast appears at the bottom with the message `onTabSelected:"Second"`.
132130

133-
11. Tap **"More"** tab bar item and select **"Sixth"** from the More list.
131+
11. Tap **"More"** tab bar item and select **"Sixth"** from the More list.
134132

135133
- [ ] Expected: **Sixth** tab content is shown, and the route key label reads `Sixth`. The More tab is selected in the tab bar. No crash or blank screen.
136134

@@ -140,9 +138,9 @@ Other: Ongoing research.
140138

141139
13. Resize app to full size.
142140

143-
- [ ] Expected: The More tab disappears, and the tab bar shows all six tabs at the top of the screen. The **Second** tab becomes active, and the route key label reads `Second`. In the console, the onTabSelected event should be logged with selectedScreenKey set to 'Second', taget set to the same value as in step 11, and provenance increased by 2.
141+
- [ ] Expected: The More tab disappears, and the tab bar shows all six tabs at the top of the screen. The **Second** tab becomes active, and the route key label reads `Second`.
144142

145-
14. Select **Third** tab and switch to **Fifth**
143+
14. Select **Third** tab and switch to **Fifth**
146144

147145
- [ ] Expected: **Fifth** tab is selected, and the route key label reads `Fifth`.
148146

0 commit comments

Comments
 (0)