mirror of
https://github.com/status-im/react-native.git
synced 2025-02-23 22:58:19 +00:00
Summary: Reorganized some of the switch examples to be more testable: Before:  After:  Tests pass! ``` yarn build-ios-e2e && yarn test-ios-e2e ``` <img width="711" alt="screen shot 2018-12-01 at 2 20 33 am" src="https://user-images.githubusercontent.com/249164/49327070-c64cbd80-f510-11e8-8cad-84c3fe42941e.png"> Changelog: ---------- Help reviewers and the release process by writing your own changelog entry. When the change doesn't impact React Native developers, it may be ommitted from the changelog for brevity. See below for an example. [Internal] [Added] - Detox tests for Switch Pull Request resolved: https://github.com/facebook/react-native/pull/22470 Reviewed By: RSNara Differential Revision: D13290329 Pulled By: TheSavior fbshipit-source-id: 91c1b895dd5e1acc4330618e6d3165c7f9215997
55 lines
1.7 KiB
JavaScript
55 lines
1.7 KiB
JavaScript
/**
|
|
* 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 element, by, expect */
|
|
|
|
describe('Button', () => {
|
|
beforeAll(async () => {
|
|
await element(by.id('explorer_search')).replaceText('<Button>');
|
|
await element(
|
|
by.label('<Button> Simple React Native button component.'),
|
|
).tap();
|
|
});
|
|
|
|
afterAll(async () => {
|
|
//TODO - remove app state persistency, till then, we must go back to main screen,
|
|
await element(by.label('Back')).tap();
|
|
});
|
|
|
|
it('Simple button should be tappable', async () => {
|
|
await element(by.label('Press Me')).tap();
|
|
await expect(element(by.text('Simple has been pressed!'))).toBeVisible();
|
|
await element(by.text('OK')).tap();
|
|
});
|
|
|
|
it('Adjusted color button should be tappable', async () => {
|
|
await element(by.label('Press Purple')).tap();
|
|
await expect(element(by.text('Purple has been pressed!'))).toBeVisible();
|
|
await element(by.text('OK')).tap();
|
|
});
|
|
|
|
it("Two buttons with JustifyContent:'space-between' should be tappable", async () => {
|
|
await element(by.label('This looks great!')).tap();
|
|
await expect(element(by.text('Left has been pressed!'))).toBeVisible();
|
|
await element(by.text('OK')).tap();
|
|
|
|
await element(by.label('Ok!')).tap();
|
|
await expect(element(by.text('Right has been pressed!'))).toBeVisible();
|
|
await element(by.text('OK')).tap();
|
|
});
|
|
|
|
it('Disabled button should not interact', async () => {
|
|
await element(by.label('I Am Disabled')).tap();
|
|
await expect(
|
|
element(by.text('Disabled has been pressed!')),
|
|
).toBeNotVisible();
|
|
});
|
|
});
|