Skip to content
Closed
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
43 changes: 43 additions & 0 deletions RNTester/e2e/__tests__/Alert-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* 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.
*
* @format
*/

/* global device, element, by, expect, waitFor */
const {openExampleWithTitle} = require('../e2e-helpers');

describe('Alert', () => {
beforeAll(async () => {
await element(by.id('explorer_search')).replaceText('Alert');
await element(by.label('Alert')).tap();
});

afterAll(async () => {
await element(by.label('Back')).tap();
});

it('should show alert dialog with message and default button', async () => {
const alertMessage =
'Credibly reintermediate next-generation potentialities after goal-oriented ' +
'catalysts for change. Dynamically revolutionize.';

await openExampleWithTitle('Alerts');
await element(by.id('alert-with-message-and-default-button')).tap();
await expect(element(by.text(alertMessage))).toBeVisible();
await element(by.text('OK')).tap();
});

it('should show alert dialog with three buttons', async () => {
await openExampleWithTitle('Alerts');
await element(by.id('alert-with-three-buttons')).tap();
await expect(element(by.text('Alert Title'))).toBeVisible();
await expect(element(by.text('Foo'))).toBeVisible();
await expect(element(by.text('Bar'))).toBeVisible();
await expect(element(by.text('Baz'))).toBeVisible();
await element(by.text('Foo')).tap();
});
});
2 changes: 2 additions & 0 deletions RNTester/js/examples/Alert/AlertExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class SimpleAlertExampleBlock extends React.Component<Props> {
return (
<View>
<TouchableHighlight
testID="alert-with-message-and-default-button"
style={styles.wrapper}
onPress={() => Alert.alert('Alert Title', alertMessage)}>
<View style={styles.button}>
Expand Down Expand Up @@ -65,6 +66,7 @@ class SimpleAlertExampleBlock extends React.Component<Props> {
</View>
</TouchableHighlight>
<TouchableHighlight
testID="alert-with-three-buttons"
style={styles.wrapper}
onPress={() =>
Alert.alert('Alert Title', null, [
Expand Down