From 8721ef0916f3e75c30000180fac6a86178802b9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ramos?= Date: Mon, 4 Mar 2019 18:35:45 -0800 Subject: [PATCH] Kill Switch tests (#23753) Summary: This component is being extracted. These are flaky and constantly fail on Circle. [General] [Removed] - Removed Detox e2e Switch tests Pull Request resolved: https://github.com/facebook/react-native/pull/23753 Differential Revision: D14319130 Pulled By: cpojer fbshipit-source-id: d0ea276440e034afbb11aa31762922532ad06402 --- RNTester/e2e/__tests__/Switch-test.js | 85 --------------------------- 1 file changed, 85 deletions(-) delete mode 100644 RNTester/e2e/__tests__/Switch-test.js diff --git a/RNTester/e2e/__tests__/Switch-test.js b/RNTester/e2e/__tests__/Switch-test.js deleted file mode 100644 index 783685d724a..00000000000 --- a/RNTester/e2e/__tests__/Switch-test.js +++ /dev/null @@ -1,85 +0,0 @@ -/** - * 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 jestExpect = require('expect'); -const { - openComponentWithLabel, - openExampleWithTitle, -} = require('../e2e-helpers'); - -describe('Switch', () => { - beforeAll(async () => { - await device.reloadReactNative(); - await openComponentWithLabel('', ' Native boolean input'); - }); - - describe('Switches can be set to true or false', () => { - beforeAll(async () => { - await openExampleWithTitle('Switches can be set to true or false'); - }); - - it('Switch that starts off should switch', async () => { - const testID = 'on-off-initial-off'; - const indicatorID = 'on-off-initial-off-indicator'; - - await expect(element(by.id(testID))).toHaveValue('0'); - await expect(element(by.id(indicatorID))).toHaveText('Off'); - await element(by.id(testID)).tap(); - await expect(element(by.id(testID))).toHaveValue('1'); - await expect(element(by.id(indicatorID))).toHaveText('On'); - }); - }); - - describe('Switches can be disabled', () => { - beforeAll(async () => { - await openExampleWithTitle('Switches can be disabled'); - }); - - it('disabled switch should not toggle', async () => { - const onTestID = 'disabled-initial-on'; - const offTestID = 'disabled-initial-off'; - const onIndicatorID = 'disabled-initial-on-indicator'; - const offIndicatorID = 'disabled-initial-off-indicator'; - - await expect(element(by.id(onTestID))).toHaveValue('1'); - await expect(element(by.id(onIndicatorID))).toHaveText('On'); - - try { - await element(by.id(onTestID)).tap(); - throw new Error('Does not match'); - } catch (err) { - jestExpect(err.message.message).toEqual( - jestExpect.stringContaining( - 'Cannot perform action due to constraint(s) failure', - ), - ); - } - await expect(element(by.id(onTestID))).toHaveValue('1'); - await expect(element(by.id(onIndicatorID))).toHaveText('On'); - - await expect(element(by.id(offTestID))).toHaveValue('0'); - await expect(element(by.id(offIndicatorID))).toHaveText('Off'); - try { - await element(by.id(offTestID)).tap(); - throw new Error('Does not match'); - } catch (err) { - jestExpect(err.message.message).toEqual( - jestExpect.stringContaining( - 'Cannot perform action due to constraint(s) failure', - ), - ); - } - await expect(element(by.id(offTestID))).toHaveValue('0'); - await expect(element(by.id(offIndicatorID))).toHaveText('Off'); - }); - }); -});