Skip to content

Commit 69f9913

Browse files
authored
test(e2e, Fabric): add e2e tests for issue/PR examples 662..691 (#2916)
## Description Check which example screens from issues/PRs can be used in e2e testing for tests `Test662, Test691` and implement them if possible for Fabric. ### Test662 Skipped because we can't check new animation in any meaningful way. ### Test691 Test created, only on iOS (original issue was related to iOS modal behavior - on Android `presentation: 'modal'` screens are regular screens so their behavior differs). It checks if modal remains open after changing the tab. ## Changes - add `Test691` e2e test - add testIDs to `Test691` test screen - 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 - [ ] Ensured that CI passes
1 parent 5b482bc commit 69f9913

3 files changed

Lines changed: 57 additions & 4 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { device, expect, element, by } from 'detox';
2+
import { describeIfiOS } from '../e2e-utils';
3+
4+
// issue related to iOS modal behavior
5+
describeIfiOS('Test691', () => {
6+
beforeAll(async () => {
7+
await device.reloadReactNative();
8+
});
9+
10+
it('Test691 should exist', async () => {
11+
await waitFor(element(by.id('root-screen-tests-Test691')))
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-Test691'))).toBeVisible();
17+
await element(by.id('root-screen-tests-Test691')).tap();
18+
});
19+
20+
it('modal on tab1 should open', async () => {
21+
await expect(element(by.text('This is a first screen!'))).toBeVisible();
22+
23+
await element(by.id('first-button-open-modal')).tap();
24+
25+
await expect(element(by.text('This is a first screen!'))).not.toBeVisible();
26+
await expect(element(by.text('This is a modal screen!'))).toBeVisible();
27+
});
28+
29+
it('switching tabs should not hide the modal', async () => {
30+
await element(by.id('modal-button-go-to-tab2')).tap();
31+
32+
await expect(element(by.text('This is a modal screen!'))).toBeVisible();
33+
await expect(element(by.text('This is a first screen!'))).not.toBeVisible();
34+
await expect(
35+
element(by.text('This is a second screen!')),
36+
).not.toBeVisible();
37+
});
38+
39+
it('closing the modal should reveal changed tab', async () => {
40+
await element(by.text('Modal')).swipe('down', 'fast');
41+
42+
await expect(element(by.text('This is a modal screen!'))).not.toBeVisible();
43+
await expect(element(by.text('This is a second screen!'))).toBeVisible();
44+
});
45+
});

apps/src/tests/Test691.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ function First({ navigation }) {
1212
return (
1313
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
1414
<Text style={{ fontSize: 30 }}>This is a first screen!</Text>
15-
<Button onPress={() => navigation.navigate('Modal')} title="Modal" />
15+
<Button
16+
onPress={() => navigation.navigate('Modal')}
17+
title="Modal"
18+
testID="first-button-open-modal"
19+
/>
1620
</View>
1721
);
1822
}
@@ -21,7 +25,11 @@ function Modal({ navigation }) {
2125
return (
2226
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
2327
<Text style={{ fontSize: 30 }}>This is a modal screen!</Text>
24-
<Button onPress={() => navigation.navigate('Tab2')} title="Tab2" />
28+
<Button
29+
onPress={() => navigation.navigate('Tab2')}
30+
title="Tab2"
31+
testID="modal-button-go-to-tab2"
32+
/>
2533
</View>
2634
);
2735
}

apps/src/tests/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ export { default as Test648 } from './Test648'; // [E2E skipped]: can't chec
2121
export { default as Test649 } from './Test649'; // [E2E created](iOS): headerLargeTitle is supported only on iOS
2222
export { default as Test654 } from './Test654'; // [E2E created](iOS): issue related to iOS native back button
2323
export { default as Test658 } from './Test658'; // [E2E created]
24-
export { default as Test662 } from './Test662';
25-
export { default as Test691 } from './Test691';
24+
export { default as Test662 } from './Test662'; // [E2E skipped]: can't check animation in a meaningful way
25+
export { default as Test691 } from './Test691'; // [E2E created](iOS): issue related to iOS modal behavior
2626
export { default as Test702 } from './Test702';
2727
export { default as Test706 } from './Test706';
2828
export { default as Test713 } from './Test713';

0 commit comments

Comments
 (0)