mirror of
https://github.com/status-im/react-native.git
synced 2025-02-24 15:18:10 +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
59 lines
1.8 KiB
JavaScript
59 lines
1.8 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('Button', () => {
|
|
beforeAll(async () => {
|
|
await device.reloadReactNative();
|
|
await openComponentWithLabel(
|
|
'<Button>',
|
|
'<Button> Simple React Native button component.',
|
|
);
|
|
});
|
|
|
|
it('Simple button should be tappable', async () => {
|
|
await openExampleWithTitle('Simple Button');
|
|
await element(by.id('simple_button')).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 openExampleWithTitle('Adjusted color');
|
|
await element(by.id('purple_button')).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 openExampleWithTitle('Fit to text layout');
|
|
await element(by.id('left_button')).tap();
|
|
await expect(element(by.text('Left has been pressed!'))).toBeVisible();
|
|
await element(by.text('OK')).tap();
|
|
|
|
await element(by.id('right_button')).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 openExampleWithTitle('Disabled Button');
|
|
await element(by.id('disabled_button')).tap();
|
|
await expect(
|
|
element(by.text('Disabled has been pressed!')),
|
|
).toBeNotVisible();
|
|
});
|
|
});
|