Skip to content

Commit ab7732a

Browse files
authored
test(e2e, Fabric): add e2e tests for issue/PR examples 619..640 (#2850)
## Description Check which example screens from issues/PRs can be used in e2e testing for tests `Test619, ..., Test640` and implement them if possible for Fabric. ### Test619 Skipped because we can't check components "jumping". ### Test624 Skipped because the change in PR #624 is connected to internal JS prop. The test screen seems to be repurposed. ### Test640 Test created. It checks if `RefreshControl` works correctly with `modal` (refresh instead of the modal closing). ## Changes - add `Test640` - 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 16e6ae9 commit ab7732a

3 files changed

Lines changed: 43 additions & 5 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { device, expect, element, by } from 'detox';
2+
3+
describe('Test640', () => {
4+
beforeAll(async () => {
5+
await device.reloadReactNative();
6+
});
7+
8+
it('Test640 should exist', async () => {
9+
await waitFor(element(by.id('root-screen-tests-Test640')))
10+
.toBeVisible()
11+
.whileElement(by.id('root-screen-examples-scrollview'))
12+
.scroll(600, 'down', NaN, 0.85);
13+
14+
await expect(element(by.id('root-screen-tests-Test640'))).toBeVisible();
15+
await element(by.id('root-screen-tests-Test640')).tap();
16+
});
17+
18+
it('scrolling down on modal should not close the modal but activate refresh', async () => {
19+
await element(by.id('home-button-go-to-modal')).tap();
20+
await element(by.text('Scroll to 4')).swipe('down', 'fast');
21+
22+
if (device.getPlatform() === 'android') {
23+
await expect(element(by.id('modal-refresh-control'))).toBeVisible();
24+
} else {
25+
await expect(element(by.type('UIRefreshControl'))).toBeVisible();
26+
}
27+
28+
await expect(element(by.id('home-button-go-to-modal'))).not.toBeVisible();
29+
});
30+
});

apps/src/tests/Test640.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ function wait(timeout) {
1919

2020
function HomeScreen({ navigation }) {
2121
return (
22-
<Button title="Navigate" onPress={() => navigation.navigate('Modal')} />
22+
<Button
23+
title="Navigate"
24+
onPress={() => navigation.navigate('Modal')}
25+
testID="home-button-go-to-modal"
26+
/>
2327
);
2428
}
2529

@@ -35,7 +39,11 @@ function Modal({ navigation }) {
3539
return (
3640
<ScrollView
3741
refreshControl={
38-
<RefreshControl refreshing={refreshing} onRefresh={onRefresh} />
42+
<RefreshControl
43+
refreshing={refreshing}
44+
onRefresh={onRefresh}
45+
testID="modal-refresh-control"
46+
/>
3947
}
4048
contentInsetAdjustmentBehavior="automatic"
4149
scrollToOverflowEnabled

apps/src/tests/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ export { default as Test556 } from './Test556'; // [E2E skipped]: can't chec
1212
export { default as Test564 } from './Test564'; // [E2E skipped]: issue still present
1313
export { default as Test577 } from './Test577'; // [E2E created](iOS): issue is related to iOS modal
1414
export { default as Test593 } from './Test593'; // [E2E created]
15-
export { default as Test619 } from './Test619';
16-
export { default as Test624 } from './Test624';
17-
export { default as Test640 } from './Test640';
15+
export { default as Test619 } from './Test619'; // [E2E skipped]: can't check components jumping
16+
export { default as Test624 } from './Test624'; // [E2E skipped]: PR changed library internals, test screen seems unrelated
17+
export { default as Test640 } from './Test640'; // [E2E created]
1818
export { default as Test642 } from './Test642';
1919
export { default as Test645 } from './Test645';
2020
export { default as Test648 } from './Test648';

0 commit comments

Comments
 (0)