mirror of
https://github.com/status-im/react-native.git
synced 2025-02-23 06:38:13 +00:00
Summary: This PR adds filtering for e2e test examples using the new examples filter introduced in https://github.com/facebook/react-native/pull/22777 To do that we: - Add a `testID` to `RNTesterExampleFilter` to select an example - Refactor a few examples to export multiple examples for filtering - Update all tests to filter by example title Pull Request resolved: https://github.com/facebook/react-native/pull/22828 Reviewed By: TheSavior Differential Revision: D13562664 Pulled By: rickhanlonii fbshipit-source-id: efb0ca8050c1ca5c10d96bd77d35dd1143c3a3b3
78 lines
2.3 KiB
JavaScript
78 lines
2.3 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 device, element, by, expect */
|
|
const {
|
|
openComponentWithLabel,
|
|
openExampleWithTitle,
|
|
} = require('../e2e-helpers');
|
|
|
|
describe('Touchable', () => {
|
|
beforeAll(async () => {
|
|
await device.reloadReactNative();
|
|
await openComponentWithLabel(
|
|
'<Touchable*',
|
|
'<Touchable*> and onPress Touchable and onPress examples.',
|
|
);
|
|
});
|
|
|
|
it('Touchable Highlight should be tappable', async () => {
|
|
await openExampleWithTitle('<TouchableHighlight>');
|
|
const buttonID = 'touchable_highlight_image_button';
|
|
const button2ID = 'touchable_highlight_text_button';
|
|
const consoleID = 'touchable_highlight_console';
|
|
|
|
await element(by.id(buttonID)).tap();
|
|
await expect(element(by.id(consoleID))).toHaveText(
|
|
'TouchableHighlight onPress',
|
|
);
|
|
|
|
await element(by.id(buttonID)).tap();
|
|
await expect(element(by.id(consoleID))).toHaveText(
|
|
'2x TouchableHighlight onPress',
|
|
);
|
|
|
|
await element(by.id(button2ID)).tap();
|
|
await expect(element(by.id(consoleID))).toHaveText(
|
|
'3x TouchableHighlight onPress',
|
|
);
|
|
});
|
|
|
|
it('Touchable Without Feedback should be tappable', async () => {
|
|
await openExampleWithTitle('<TouchableWithoutFeedback>');
|
|
|
|
const buttonID = 'touchable_without_feedback_button';
|
|
const consoleID = 'touchable_without_feedback_console';
|
|
|
|
await element(by.id(buttonID)).tap();
|
|
await expect(element(by.id(consoleID))).toHaveText(
|
|
'TouchableWithoutFeedback onPress',
|
|
);
|
|
|
|
await element(by.id(buttonID)).tap();
|
|
await expect(element(by.id(consoleID))).toHaveText(
|
|
'2x TouchableWithoutFeedback onPress',
|
|
);
|
|
});
|
|
|
|
it('Text should be tappable', async () => {
|
|
await openExampleWithTitle('<Text onPress={fn}> with highlight');
|
|
|
|
const buttonID = 'tappable_text';
|
|
const consoleID = 'tappable_text_console';
|
|
|
|
await element(by.id(buttonID)).tap();
|
|
await expect(element(by.id(consoleID))).toHaveText('text onPress');
|
|
|
|
await element(by.id(buttonID)).tap();
|
|
await expect(element(by.id(consoleID))).toHaveText('2x text onPress');
|
|
});
|
|
});
|