Skip to content

Commit d05c4c3

Browse files
authored
test(e2e, Fabric): add e2e tests for issue/PR examples 648..649 (#2897)
## Description Check which example screens from issues/PRs can be used in e2e testing for tests `Test648, Test649` and implement them if possible for Fabric. ### Test648 Skipped because we can't check new animation in any meaningful way. ### Test649 Test created, only on iOS (`headerLargeTitle` is supported only on iOS). It checks if `headerLargeTitle` isn't collapsed when coming back from a screen without `headerLargeTitle`. I changed `Test649` screen to match original issue. ## Changes - add `Test649` - change header to normal size on Second screen in `Test649` to match original issue - add comments for every test screen from this PR in `apps/src/tests/index.ts` with the reason for (not) implementing e2e test for it ## Test code and steps to reproduce CI ## Checklist - [x] Ensured that CI passes
1 parent 5de3f70 commit d05c4c3

File tree

3 files changed

+59
-7
lines changed

3 files changed

+59
-7
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { device, expect, element, by } from 'detox';
2+
import { describeIfiOS } from '../e2e-utils';
3+
4+
// headerLargeTitle is supported only on iOS
5+
describeIfiOS('Test649', () => {
6+
beforeAll(async () => {
7+
await device.reloadReactNative();
8+
});
9+
10+
it('Test649 should exist', async () => {
11+
await waitFor(element(by.id('root-screen-tests-Test649')))
12+
.toBeVisible()
13+
.whileElement(by.id('root-screen-examples-scrollview'))
14+
.scroll(600, 'down', NaN, 0.85);
15+
16+
await expect(element(by.id('root-screen-tests-Test649'))).toBeVisible();
17+
await element(by.id('root-screen-tests-Test649')).tap();
18+
});
19+
20+
it('header large title "First" should be fully visible', async () => {
21+
await expect(
22+
element(
23+
by
24+
.text('First')
25+
.withAncestor(by.type('_UINavigationBarLargeTitleView')),
26+
),
27+
).toBeVisible(100);
28+
});
29+
30+
it('header title "Second" should not be a large title', async () => {
31+
await element(by.id('first-button-go-to-second')).tap();
32+
await expect(
33+
element(
34+
by
35+
.text('Second')
36+
.withAncestor(by.type('_UINavigationBarLargeTitleView')),
37+
),
38+
).not.toBeVisible(100);
39+
});
40+
41+
it('header large title "First" should be fully visible after coming back from Second', async () => {
42+
await element(by.id('second-button-go-to-first')).tap();
43+
await expect(
44+
element(
45+
by
46+
.text('First')
47+
.withAncestor(by.type('_UINavigationBarLargeTitleView')),
48+
),
49+
).toBeVisible(100);
50+
});
51+
});

apps/src/tests/Test649.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ const Stack = createNativeStackNavigator();
88
export default function App() {
99
return (
1010
<NavigationContainer>
11-
<Stack.Navigator
12-
screenOptions={{
11+
<Stack.Navigator>
12+
<Stack.Screen name="First" component={First} options={{
1313
headerLargeTitle: true,
14-
}}>
15-
<Stack.Screen name="First" component={First} />
14+
}}/>
1615
<Stack.Screen name="Second" component={Second} />
1716
</Stack.Navigator>
1817
</NavigationContainer>
@@ -21,10 +20,11 @@ export default function App() {
2120

2221
function First({ navigation }) {
2322
return (
24-
<ScrollView>
23+
<ScrollView contentContainerStyle={{ marginTop: 160, height: 1500 }}>
2524
<Button
2625
title="Tap me for second screen"
2726
onPress={() => navigation.navigate('Second')}
27+
testID="first-button-go-to-second"
2828
/>
2929
</ScrollView>
3030
);
@@ -36,6 +36,7 @@ function Second({ navigation }) {
3636
<Button
3737
title="Tap me for first screen"
3838
onPress={() => navigation.popTo('First')}
39+
testID="second-button-go-to-first"
3940
/>
4041
</ScrollView>
4142
);

apps/src/tests/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ export { default as Test624 } from './Test624'; // [E2E skipped]: PR changed
1717
export { default as Test640 } from './Test640'; // [E2E created]
1818
export { default as Test642 } from './Test642'; // [E2E skipped]: can't check status bar visibility/style
1919
export { default as Test645 } from './Test645'; // [E2E created](iOS): headerLargeTitle is supported only on iOS
20-
export { default as Test648 } from './Test648';
21-
export { default as Test649 } from './Test649';
20+
export { default as Test648 } from './Test648'; // [E2E skipped]: can't check animation in a meaningful way
21+
export { default as Test649 } from './Test649'; // [E2E created](iOS): headerLargeTitle is supported only on iOS
2222
export { default as Test654 } from './Test654';
2323
export { default as Test658 } from './Test658';
2424
export { default as Test662 } from './Test662';

0 commit comments

Comments
 (0)