|
| 1 | +import { device, expect, element, by } from 'detox'; |
| 2 | + |
| 3 | +describe('Test432', () => { |
| 4 | + beforeAll(async () => { |
| 5 | + await device.reloadReactNative(); |
| 6 | + }); |
| 7 | + |
| 8 | + it('Test432 should exist', async () => { |
| 9 | + await waitFor(element(by.id('root-screen-tests-Test432'))) |
| 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-Test432'))).toBeVisible(); |
| 15 | + await element(by.id('root-screen-tests-Test432')).tap(); |
| 16 | + }); |
| 17 | + |
| 18 | + it('headerRight element should be fully visible', async () => { |
| 19 | + await expect(element(by.id('home-headerRight'))).toBeVisible(100); |
| 20 | + }); |
| 21 | + |
| 22 | + it('headerRight elements should toggle and stay fully visible', async () => { |
| 23 | + await element(by.id('home-button-go-to-details')).tap(); |
| 24 | + await expect(element(by.id('details-headerRight-red'))).toBeVisible(100); |
| 25 | + |
| 26 | + await element(by.id('details-button-toggle-subviews')).tap(); |
| 27 | + // On Android, we need to wait for some elements (e.g. at first, this square is only 25% visible) |
| 28 | + waitFor(element(by.id('details-headerRight-green'))).toBeVisible(100); |
| 29 | + |
| 30 | + await element(by.id('details-button-toggle-subviews')).tap(); |
| 31 | + await expect(element(by.id('details-headerRight-red'))).toBeVisible(100); |
| 32 | + |
| 33 | + if (device.getPlatform() === 'ios') { |
| 34 | + await element(by.id('BackButton')).tap(); |
| 35 | + } else { |
| 36 | + await device.pressBack(); |
| 37 | + } |
| 38 | + |
| 39 | + await expect(element(by.id('home-headerRight'))).toBeVisible(100); |
| 40 | + }); |
| 41 | + |
| 42 | + it('headerLeft and headerRight elements should toggle and stay fully visible', async () => { |
| 43 | + await element(by.id('home-button-go-to-info')).tap(); |
| 44 | + await expect(element(by.id('info-headerRight-green-1'))).toBeVisible(100); |
| 45 | + |
| 46 | + await element(by.id('info-button-toggle-subviews')).tap(); |
| 47 | + waitFor(element(by.id('info-headerRight-green-1'))).toBeVisible(100); |
| 48 | + waitFor(element(by.id('info-headerRight-green-2'))).toBeVisible(100); |
| 49 | + waitFor(element(by.id('info-headerLeft-red'))).toBeVisible(100); |
| 50 | + |
| 51 | + await element(by.id('info-button-toggle-subviews')).tap(); |
| 52 | + waitFor(element(by.id('info-headerRight-green-1'))).toBeVisible(100); |
| 53 | + |
| 54 | + if (device.getPlatform() === 'ios') { |
| 55 | + await element(by.id('BackButton')).tap(); |
| 56 | + } else { |
| 57 | + await device.pressBack(); |
| 58 | + } |
| 59 | + |
| 60 | + await expect(element(by.id('home-headerRight'))).toBeVisible(100); |
| 61 | + }); |
| 62 | + |
| 63 | + it('headerRight element on modal should be fully visible', async () => { |
| 64 | + await element(by.id('home-button-show-settings')).tap(); |
| 65 | + await expect(element(by.id('settings-headerRight'))).toBeVisible(100); |
| 66 | + |
| 67 | + if (device.getPlatform() === 'ios') { |
| 68 | + await element(by.id('settings-text')).swipe('down', 'fast'); |
| 69 | + } else { |
| 70 | + await device.pressBack(); |
| 71 | + } |
| 72 | + await expect(element(by.id('home-headerRight'))).toBeVisible(100); |
| 73 | + }); |
| 74 | +}); |
| 75 | + |
| 76 | +// Detox currently supports orientation only on iOS |
| 77 | +if (device.getPlatform() === 'ios') { |
| 78 | + describe('Test528', () => { |
| 79 | + beforeAll(async () => { |
| 80 | + await device.reloadReactNative(); |
| 81 | + }); |
| 82 | + |
| 83 | + it('Test528 should exist', async () => { |
| 84 | + await waitFor(element(by.id('root-screen-tests-Test528'))) |
| 85 | + .toBeVisible() |
| 86 | + .whileElement(by.id('root-screen-examples-scrollview')) |
| 87 | + .scroll(600, 'down', NaN, 0.85); |
| 88 | + |
| 89 | + await expect(element(by.id('root-screen-tests-Test528'))).toBeVisible(); |
| 90 | + await element(by.id('root-screen-tests-Test528')).tap(); |
| 91 | + }); |
| 92 | + |
| 93 | + it('headerRight button should be visible after orientation change', async () => { |
| 94 | + await expect(element(by.text('Custom Button'))).toBeVisible(100); |
| 95 | + await device.setOrientation('landscape'); |
| 96 | + await expect(element(by.text('Custom Button'))).toBeVisible(100); |
| 97 | + await device.setOrientation('portrait'); |
| 98 | + await expect(element(by.text('Custom Button'))).toBeVisible(100); |
| 99 | + }); |
| 100 | + |
| 101 | + it('headerRight button should be visible after coming back from horizontal screen', async () => { |
| 102 | + await element(by.text('Go to Screen 2')).tap(); |
| 103 | + await device.setOrientation('landscape'); |
| 104 | + await element(by.id('BackButton')).tap(); |
| 105 | + await expect(element(by.text('Custom Button'))).toBeVisible(100); |
| 106 | + await device.setOrientation('portrait'); |
| 107 | + await expect(element(by.text('Custom Button'))).toBeVisible(100); |
| 108 | + }); |
| 109 | + }); |
| 110 | +} |
0 commit comments