diff --git a/RNTester/e2e/__tests__/Alert-test.js b/RNTester/e2e/__tests__/Alert-test.js new file mode 100644 index 00000000000000..b20fb9277ccad3 --- /dev/null +++ b/RNTester/e2e/__tests__/Alert-test.js @@ -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(); + }); +}); diff --git a/RNTester/js/examples/Alert/AlertExample.js b/RNTester/js/examples/Alert/AlertExample.js index 4e362a525f91f9..ea7af27cf7e8bb 100644 --- a/RNTester/js/examples/Alert/AlertExample.js +++ b/RNTester/js/examples/Alert/AlertExample.js @@ -35,6 +35,7 @@ class SimpleAlertExampleBlock extends React.Component { return ( Alert.alert('Alert Title', alertMessage)}> @@ -65,6 +66,7 @@ class SimpleAlertExampleBlock extends React.Component { Alert.alert('Alert Title', null, [