diff --git a/e2e/Keyboard.test.js b/e2e/Keyboard.test.js new file mode 100644 index 00000000000..18420fc46ab --- /dev/null +++ b/e2e/Keyboard.test.js @@ -0,0 +1,28 @@ +import { default as TestIDs, default as testIDs } from '../playground/src/testIDs'; +import Android from './AndroidUtils'; +import Utils from './Utils'; + +const { elementByLabel, elementById } = Utils; + +describe('Keyboard', () => { + beforeEach(async () => { + await device.launchApp({ newInstance: true }); + await elementById(TestIDs.KEYBOARD_SCREEN_BTN).tap(); + }); + + it('Push - should close keyboard when Back clicked', async () => { + await elementById(TestIDs.TEXT_INPUT1).tap(); + await expect(elementByLabel("Keyboard Demo")).not.toBeVisible(); + await elementById(TestIDs.BACK_BUTTON).tap(); + await expect(elementById(testIDs.MAIN_BOTTOM_TABS)).toBeVisible(); + }); + + it('Modal - should close keyboard when close clicked', async () => { + await elementById(TestIDs.MODAL_BTN).tap(); + await elementById(TestIDs.TEXT_INPUT1).tap(); + await expect(elementByLabel("Keyboard Demo")).not.toBeVisible(); + await elementById(TestIDs.DISMISS_MODAL_TOPBAR_BTN).tap(); + await expect(elementById(testIDs.MAIN_BOTTOM_TABS)).toBeVisible(); + }); + +}); diff --git a/playground/src/app.ts b/playground/src/app.ts index 7713962f2bc..e00ec855bd5 100644 --- a/playground/src/app.ts +++ b/playground/src/app.ts @@ -31,6 +31,11 @@ function setRoot() { Navigation.setRoot({ root: { bottomTabs: { + options: { + bottomTabs: { + testID: testIDs.MAIN_BOTTOM_TABS, + }, + }, children: [ { stack: { diff --git a/playground/src/screens/KeyboardScreen.tsx b/playground/src/screens/KeyboardScreen.tsx index 820570dd3e7..165f20e3568 100644 --- a/playground/src/screens/KeyboardScreen.tsx +++ b/playground/src/screens/KeyboardScreen.tsx @@ -1,10 +1,21 @@ import React from 'react'; -import { View, ScrollView, Dimensions, StyleSheet, Image, Text, TextInput } from 'react-native'; -import { Navigation, NavigationComponentProps } from 'react-native-navigation'; - +import { View, ScrollView, Dimensions, StyleSheet, Image, TextInput, Text } from 'react-native'; +import { + NavigationComponentProps, + NavigationComponent, + ComponentDidAppearEvent, +} from 'react-native-navigation'; +import Navigation from '../services/Navigation'; +import Button from '../components/Button'; +import Screens from './Screens'; +import testIDs from '../testIDs'; +import { stack } from '../commons/Layouts'; const screenWidth = Dimensions.get('window').width; - -export default class KeyboardScreen extends React.Component { +const KEYBOARD_LABEL = 'Keyboard Demo'; +interface Props extends NavigationComponentProps { + title?: string; +} +export default class KeyboardScreen extends NavigationComponent { static options() { return { bottomTabs: { @@ -14,24 +25,94 @@ export default class KeyboardScreen extends React.Component - Keyboard e2e - - - {/* {LOREM_IPSUM} */} + +