Skip to content

Commit baedab6

Browse files
committed
avoid running pointless tests if they are platform-specific
1 parent dada416 commit baedab6

3 files changed

Lines changed: 31 additions & 42 deletions

File tree

FabricExample/e2e/e2e-utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const describeIfiOS = device.getPlatform() === 'ios' ? describe : describe.skip;
Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,26 @@
11
import { device, expect, element, by } from 'detox';
2+
import { describeIfiOS } from '../e2e-utils';
23

3-
describe('Test528', () => {
4+
// Detox currently supports orientation only on iOS
5+
describeIfiOS('Test528', () => {
46
beforeAll(async () => {
57
await device.reloadReactNative();
68
});
79

8-
it('Test528 should exist', async () => {
9-
await waitFor(element(by.id('root-screen-tests-Test528')))
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-Test528'))).toBeVisible();
15-
await element(by.id('root-screen-tests-Test528')).tap();
10+
it('headerRight button should be visible after orientation change', async () => {
11+
await expect(element(by.text('Custom Button'))).toBeVisible(100);
12+
await device.setOrientation('landscape');
13+
await expect(element(by.text('Custom Button'))).toBeVisible(100);
14+
await device.setOrientation('portrait');
15+
await expect(element(by.text('Custom Button'))).toBeVisible(100);
1616
});
1717

18-
// Detox currently supports orientation only on iOS
19-
if (device.getPlatform() === 'ios') {
20-
it('headerRight button should be visible after orientation change', async () => {
21-
await expect(element(by.text('Custom Button'))).toBeVisible(100);
22-
await device.setOrientation('landscape');
23-
await expect(element(by.text('Custom Button'))).toBeVisible(100);
24-
await device.setOrientation('portrait');
25-
await expect(element(by.text('Custom Button'))).toBeVisible(100);
26-
});
27-
28-
it('headerRight button should be visible after coming back from horizontal screen', async () => {
29-
await element(by.text('Go to Screen 2')).tap();
30-
await device.setOrientation('landscape');
31-
await element(by.id('BackButton')).tap();
32-
await expect(element(by.text('Custom Button'))).toBeVisible(100);
33-
await device.setOrientation('portrait');
34-
await expect(element(by.text('Custom Button'))).toBeVisible(100);
35-
});
36-
}
18+
it('headerRight button should be visible after coming back from horizontal screen', async () => {
19+
await element(by.text('Go to Screen 2')).tap();
20+
await device.setOrientation('landscape');
21+
await element(by.id('BackButton')).tap();
22+
await expect(element(by.text('Custom Button'))).toBeVisible(100);
23+
await device.setOrientation('portrait');
24+
await expect(element(by.text('Custom Button'))).toBeVisible(100);
25+
});
3726
});
Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { device, expect, element, by } from 'detox';
2+
import { describeIfiOS } from '../e2e-utils';
23

3-
describe('Test577', () => {
4+
// Detox currently supports orientation only on iOS
5+
describeIfiOS('Test577', () => {
46
beforeAll(async () => {
57
await device.reloadReactNative();
68
});
@@ -15,18 +17,15 @@ describe('Test577', () => {
1517
await element(by.id('root-screen-tests-Test577')).tap();
1618
});
1719

18-
// This issue is related to iOS modal
19-
if (device.getPlatform() === 'ios') {
20-
it('does not display content underneath modal with gesture disabled when attempting to close it', async () => {
21-
await element(by.text('Open modal')).tap();
20+
it('does not display content underneath modal with gesture disabled when attempting to close it', async () => {
21+
await element(by.text('Open modal')).tap();
2222

23-
// Original bug was happening after a few consecutive attempts to close the modal.
24-
// See this GIF: https://github.com/software-mansion/react-native-screens/issues/577#issue-666185758
25-
// Decided to try it a few times.
26-
for (let i = 0; i < 5; ++i) {
27-
await element(by.text('Modal')).swipe('down', 'fast');
28-
await expect(element(by.text('Open modal'))).not.toBeVisible();
29-
}
30-
});
31-
}
23+
// Original bug was happening after a few consecutive attempts to close the modal.
24+
// See this GIF: https://github.com/software-mansion/react-native-screens/issues/577#issue-666185758
25+
// Decided to try it a few times.
26+
for (let i = 0; i < 5; ++i) {
27+
await element(by.text('Modal')).swipe('down', 'fast');
28+
await expect(element(by.text('Open modal'))).not.toBeVisible();
29+
}
30+
});
3231
});

0 commit comments

Comments
 (0)