diff --git a/RNTester/e2e/__tests__/InputAccessoryView-test.js b/RNTester/e2e/__tests__/InputAccessoryView-test.js new file mode 100644 index 00000000000000..767575a6a2a2bd --- /dev/null +++ b/RNTester/e2e/__tests__/InputAccessoryView-test.js @@ -0,0 +1,42 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @emails oncall+react_native + * @format + */ + +/* global device, element, by, expect */ +const {openComponentWithLabel} = require('../e2e-helpers'); + +describe('InputAccessoryView', () => { + beforeAll(async () => { + await device.reloadReactNative(); + await openComponentWithLabel( + '', + ' Example showing how to use an InputAccessoryView to build an iMessage-like sticky text input', + ); + }); + + it('should be visiible on load', async () => { + await expect( + element(by.text('Simple view with sticky input')), + ).toBeVisible(); + }); + it('should be visible after keyboard opens', async () => { + const textInputID = 'input-accessory-text-input'; + await element(by.id(textInputID)).typeText('Test'); + await expect( + element(by.text('Simple view with sticky input')), + ).toBeVisible(); + }); + it('should be visible after send button press', async () => { + await element(by.id('input-accessory-send-button')).tap(); + await element(by.text('OK')).tap(); + await expect( + element(by.text('Simple view with sticky input')), + ).toBeVisible(); + }); +}); diff --git a/RNTester/js/examples/InputAccessoryView/InputAccessoryViewExample.js b/RNTester/js/examples/InputAccessoryView/InputAccessoryViewExample.js index 80bddeb91735e5..b5c4f177669cda 100644 --- a/RNTester/js/examples/InputAccessoryView/InputAccessoryViewExample.js +++ b/RNTester/js/examples/InputAccessoryView/InputAccessoryViewExample.js @@ -48,11 +48,13 @@ class TextInputBar extends React.PureComponent { }} value={this.state.text} placeholder={'Type a message...'} + testID="input-accessory-text-input" />