react-native/RNTester/e2e/e2e-helpers.js
Rick Hanlon 34ee8250b5 Add filtering to e2e tests (#22828)
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
2018-12-31 04:33:49 -08:00

25 lines
753 B
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 */
// Will open a component example from the root list
// by filtering by component and then tapping on the label
exports.openComponentWithLabel = async (component, label) => {
await element(by.id('explorer_search')).replaceText(component);
await element(by.label(label)).tap();
};
// Will open an individual example for a component
// by filtering on the example title
exports.openExampleWithTitle = async title => {
await element(by.id('example_search')).replaceText(title);
};