|
| 1 | +const FlexnRunner = require('@flexn/graybox').default; |
| 2 | + |
| 3 | +describe('Test App Harness', () => { |
| 4 | + before(() => { |
| 5 | + FlexnRunner.launchApp(); |
| 6 | + }); |
| 7 | + |
| 8 | + it('--> Hermes Support ', async () => { |
| 9 | + if (process.env.PLATFORM === 'ios') { |
| 10 | + await FlexnRunner.waitForDisplayedByText('Allow'); |
| 11 | + await FlexnRunner.clickByText('Allow'); |
| 12 | + } |
| 13 | + await FlexnRunner.waitForDisplayedById('app-harness-home-renative-image'); |
| 14 | + if (process.env.PLATFORM === 'web') { |
| 15 | + await FlexnRunner.expectToHaveTextById('app-harness-home-hermes-support-text', 'hermes: no'); |
| 16 | + } else { |
| 17 | + await FlexnRunner.expectToHaveTextById('app-harness-home-hermes-support-text', 'hermes: yes'); |
| 18 | + } |
| 19 | + }); |
| 20 | + |
| 21 | + it('--> Native Call', async () => { |
| 22 | + await FlexnRunner.clickById('app-harness-home-native-call-button'); |
| 23 | + await FlexnRunner.pressButtonSelect(1); |
| 24 | + if (process.env.PLATFORM === 'web') { |
| 25 | + await FlexnRunner.expectToHaveTextById( |
| 26 | + 'app-harness-home-logs-text-2', |
| 27 | + 'NativeModules not supported in web' |
| 28 | + ); |
| 29 | + } else if (process.env.PLATFORM === 'android') { |
| 30 | + await FlexnRunner.expectToHaveTextById( |
| 31 | + 'app-harness-home-logs-text-3', |
| 32 | + 'Event called with name: testName and location: testLocation' |
| 33 | + ); |
| 34 | + } else if (process.env.PLATFORM === 'ios') { |
| 35 | + await FlexnRunner.expectToHaveTextById( |
| 36 | + 'app-harness-home-logs-text-3', |
| 37 | + 'NativeModules not supported for this platform' |
| 38 | + ); |
| 39 | + } else if (process.env.PLATFORM === 'androidtv') { |
| 40 | + await FlexnRunner.expectToHaveTextById( |
| 41 | + 'app-harness-home-logs-text-1', |
| 42 | + 'NativeModules not supported for this platform' |
| 43 | + ); |
| 44 | + } else if (process.env.PLATFORM === 'tvos') { |
| 45 | + await FlexnRunner.expectToHaveTextById( |
| 46 | + 'app-harness-home-logs-text-2', |
| 47 | + 'NativeModules not supported for this platform' |
| 48 | + ); |
| 49 | + } |
| 50 | + }); |
| 51 | + |
| 52 | + it('--> Orientation support ', async () => { |
| 53 | + await FlexnRunner.clickById('app-harness-home-toggle-video-button'); |
| 54 | + await FlexnRunner.pressButtonDown(1); |
| 55 | + await FlexnRunner.pressButtonSelect(1); |
| 56 | + if (process.env.PLATFORM === 'ios' || process.env.PLATFORM === 'android') { |
| 57 | + await FlexnRunner.scrollById( |
| 58 | + 'app-harness-home-landscape-video-text', |
| 59 | + 'down', |
| 60 | + 'app-harness-home-hermes-support-text' |
| 61 | + ); |
| 62 | + } |
| 63 | + await FlexnRunner.expectToBeDisplayedById('app-harness-home-landscape-video-text'); |
| 64 | + await FlexnRunner.clickById('app-harness-home-toggle-video-button'); |
| 65 | + await FlexnRunner.pressButtonSelect(1); |
| 66 | + }); |
| 67 | + |
| 68 | + it('--> Image Support ', async () => { |
| 69 | + await FlexnRunner.pressButtonDown(2); |
| 70 | + await FlexnRunner.expectToBeDisplayedById('app-harness-home-image-support-image'); |
| 71 | + }); |
| 72 | + |
| 73 | + it('--> Cast Support ', async () => { |
| 74 | + if (process.env.PLATFORM === 'android') { |
| 75 | + await FlexnRunner.clickById('app-harness-home-cast-support-button'); |
| 76 | + await FlexnRunner.expectToBeDisplayedByText('Cast to'); |
| 77 | + await FlexnRunner.waitForDisplayedByText('OK'); |
| 78 | + await FlexnRunner.expectToBeDisplayedByText('OK'); |
| 79 | + } else if (process.env.PLATFORM === 'ios') { |
| 80 | + await FlexnRunner.clickById('app-harness-home-cast-support-button'); |
| 81 | + await FlexnRunner.expectToBeDisplayedByText('No devices available'); |
| 82 | + } else { |
| 83 | + await FlexnRunner.expectToHaveTextById('app-harness-home-cast-support-text', 'Not supported'); |
| 84 | + } |
| 85 | + }); |
| 86 | +}); |
0 commit comments