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
This commit is contained in:
Родитель
dc893756b8
Коммит
8721ef0916
|
@ -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('<Switch>', '<Switch> 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');
|
||||
});
|
||||
});
|
||||
});
|
Загрузка…
Ссылка в новой задаче