Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions RNTester/e2e/__tests__/InputAccessoryView-test.js
Original file line number Diff line number Diff line change
@@ -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(
'<InputAccessoryView>',
'<InputAccessoryView> 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();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@ class TextInputBar extends React.PureComponent<TextInputProps, TextInputState> {
}}
value={this.state.text}
placeholder={'Type a message...'}
testID="input-accessory-text-input"
/>
<Button
onPress={() => {
Alert.alert('You tapped the button!');
}}
testID="input-accessory-send-button"
title="Send"
/>
</View>
Expand Down