mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
New RNtester e2e tests (#39117)
Summary: The motivation was to create more e2e tests that test other components in the RNTester app. The list of components that have been tested is below: | Component|Test is added|Platform| | :--- | :----: |---: | |DrawerLayoutAndroid|NO|Android| |ActivityIndicator|YES|iOS & Android| |Button|YES|iOS & Android| |FlatList|YES|iOS & Android| |Image|NO|iOS & Android| |JSResponderHandler|YES|iOS & Android| |InputAccessoryView|NO|iOS| |KeyboardAvoidingView|YES|iOS & Android| |Modal|YES|iOS & Android| |New App Screen|YES|iOS & Android| |Pressable|YES|iOS & Android| |RefreshControl|YES|iOS & Android| |ScrollView|NO|iOS & Android| |ScrollViewSimpleExample|YES|iOS & Android| |SafeAreaView|NO|iOS| |ScrollViewAnimated|NO|iOS & Android| |ScrollViewIndicatorInsets|NO|iOS| |SectionList|NO|iOS & Android| |StatusBar|NO|iOS & Android| |SwipeableCard|NO|iOS & Android| |Switch|NO|iOS & Android| |Text|NO|iOS & Android| |TextInput|NO|iOS & Android| |Touchable* and onPress|NO|iOS & Android| |TextInputs with key prop|NO|Android| |TransparentHitTestExample|NO|iOS| |View|NO|iOS & Android| |New Architecture Examples|NO|iOS & Android| |Performance Comparison Examples|NO|iOS & Android| ## Changelog: [General] [Added] - Added next component tests for RNTester Pull Request resolved: https://github.com/facebook/react-native/pull/39117 Test Plan: Follow Readme file. ## Test Result: For iOS platform:<br>  For Android platform:<br>  Reviewed By: yungsters Differential Revision: D48828525 Pulled By: cipolleschi fbshipit-source-id: dfe7cc9871666a6b5c0704a207ca1eeb65f50114
This commit is contained in:
committed by
Facebook GitHub Bot
parent
70fe5fc870
commit
aa2a0c1115
@@ -35,12 +35,54 @@ class Utils {
|
||||
// if something goes wrong, we fallback to ios. But it should never happent, the process will fail way earlier.
|
||||
return platforms[process?.env?.E2E_DEVICE || 'ios'];
|
||||
}
|
||||
|
||||
async scrollToElement(locator: string): Promise<void> {
|
||||
let {width, height} = await driver.getWindowSize();
|
||||
let elementIsFound;
|
||||
try {
|
||||
elementIsFound = await driver.$(locator).isDisplayed();
|
||||
while (!elementIsFound) {
|
||||
driver.touchPerform([
|
||||
{
|
||||
action: 'press',
|
||||
options: {
|
||||
x: width / 2,
|
||||
y: height / 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
action: 'wait',
|
||||
options: {
|
||||
ms: 1000,
|
||||
},
|
||||
},
|
||||
{
|
||||
action: 'moveTo',
|
||||
options: {
|
||||
x: width / 2,
|
||||
y: height / 10,
|
||||
},
|
||||
},
|
||||
{
|
||||
action: 'release',
|
||||
},
|
||||
]);
|
||||
elementIsFound = await driver.$(locator).isDisplayed();
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('Element is not found');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const iOSLabel = (label: string): string => {
|
||||
return `[label="${label}"]`;
|
||||
};
|
||||
|
||||
export const iOSName = (name: string): string => {
|
||||
return `[name="${name}"]`;
|
||||
};
|
||||
|
||||
export const androidWidget = (
|
||||
type: string,
|
||||
selector: string,
|
||||
|
||||
@@ -13,11 +13,54 @@ import {UtilsSingleton as Utils, iOSLabel} from '../helpers/utils';
|
||||
// root level screen in RNTester: Components
|
||||
|
||||
const buttonComponentLabel = 'Button Simple React Native button component.';
|
||||
const activityIndicatorComponentLabel =
|
||||
'ActivityIndicator Animated loading indicators.';
|
||||
const keyboardAvoidingViewComponentLabel =
|
||||
'KeyboardAvoidingView Base component for views that automatically adjust their height or position to move out of the way of the keyboard.';
|
||||
const flatListComponentLabel = 'FlatList Performant, scrollable list of data.';
|
||||
const jsResponderHandlerComponentLabel =
|
||||
'JSResponderHandler Simple example to test JSResponderHandler.';
|
||||
const modalComponentLabel = 'Modal Component for presenting modal views.';
|
||||
const newAppScreenComponentLabel =
|
||||
'New App Screen Displays the content of the new app screen';
|
||||
const pressableComponentLabel =
|
||||
'Pressable Component for making views pressable.';
|
||||
const refreshControlComponentLabel =
|
||||
'RefreshControl Adds pull-to-refresh support to a scrollview.';
|
||||
const scrollViewSimpleExampleComponentLabel =
|
||||
'ScrollViewSimpleExample Component that enables scrolling through child components.';
|
||||
|
||||
type ComponentsScreenType = {
|
||||
buttonComponentLabelElement: string,
|
||||
activityIndicatorComponentLabelElement: string,
|
||||
keyboardAvoidingViewComponentLabelElement: string,
|
||||
flatListComponentLabelElement: string,
|
||||
jsResponderHandlerComponentLabelElement: string,
|
||||
modalComponentLabelElement: string,
|
||||
newAppScreenComponentLabelElement: string,
|
||||
pressableComponentLabelElement: string,
|
||||
refreshControlComponentLabelElement: string,
|
||||
scrollViewSimpleExampleComponentLabelElement: string,
|
||||
checkButtonComponentIsDisplayed: () => Promise<boolean>,
|
||||
checkActivityIndicatorComponentIsDisplayed: () => Promise<boolean>,
|
||||
checkKeyboardAvoidingViewComponentIsDisplayed: () => Promise<boolean>,
|
||||
checkFlatListComponentIsDisplayed: () => Promise<boolean>,
|
||||
checkJSResponderHandlerComponentIsDisplayed: () => Promise<boolean>,
|
||||
checkModalComponentIsDisplayed: () => Promise<boolean>,
|
||||
checkNewAppScreenComponentIsDisplayed: () => Promise<boolean>,
|
||||
checkPressableComponentIsDisplayed: () => Promise<boolean>,
|
||||
checkRefreshControlComponentIsDisplayed: () => Promise<boolean>,
|
||||
checkScrollViewSimpleExampleComponentIsDisplayed: () => Promise<boolean>,
|
||||
clickButtonComponent: () => Promise<void>,
|
||||
clickActivityIndicatorComponent: () => Promise<void>,
|
||||
clickKeyboardAvoidingViewComponent: () => Promise<void>,
|
||||
clickFlatListComponent: () => Promise<void>,
|
||||
clickJSResponderHandlerComponent: () => Promise<void>,
|
||||
clickModalComponent: () => Promise<void>,
|
||||
clickNewAppScreenComponent: () => Promise<void>,
|
||||
clickPressableComponent: () => Promise<void>,
|
||||
clickRefreshControlComponent: () => Promise<void>,
|
||||
clickScrollViewSimpleExampleComponent: () => Promise<void>,
|
||||
};
|
||||
|
||||
export const ComponentsScreen: ComponentsScreenType = {
|
||||
@@ -26,15 +69,157 @@ export const ComponentsScreen: ComponentsScreenType = {
|
||||
ios: iOSLabel(buttonComponentLabel),
|
||||
android: `~${buttonComponentLabel}`,
|
||||
}),
|
||||
activityIndicatorComponentLabelElement: Utils.platformSelect({
|
||||
ios: iOSLabel(activityIndicatorComponentLabel),
|
||||
android: `~${activityIndicatorComponentLabel}`,
|
||||
}),
|
||||
keyboardAvoidingViewComponentLabelElement: Utils.platformSelect({
|
||||
ios: iOSLabel(keyboardAvoidingViewComponentLabel),
|
||||
android: `~${keyboardAvoidingViewComponentLabel}`,
|
||||
}),
|
||||
flatListComponentLabelElement: Utils.platformSelect({
|
||||
ios: iOSLabel(flatListComponentLabel),
|
||||
android: `~${flatListComponentLabel}`,
|
||||
}),
|
||||
jsResponderHandlerComponentLabelElement: Utils.platformSelect({
|
||||
ios: iOSLabel(jsResponderHandlerComponentLabel),
|
||||
android: `~${jsResponderHandlerComponentLabel}`,
|
||||
}),
|
||||
modalComponentLabelElement: Utils.platformSelect({
|
||||
ios: iOSLabel(modalComponentLabel),
|
||||
android: `~${modalComponentLabel}`,
|
||||
}),
|
||||
newAppScreenComponentLabelElement: Utils.platformSelect({
|
||||
ios: iOSLabel(newAppScreenComponentLabel),
|
||||
android: `~${newAppScreenComponentLabel}`,
|
||||
}),
|
||||
pressableComponentLabelElement: Utils.platformSelect({
|
||||
ios: iOSLabel(pressableComponentLabel),
|
||||
android: `~${pressableComponentLabel}`,
|
||||
}),
|
||||
refreshControlComponentLabelElement: Utils.platformSelect({
|
||||
ios: iOSLabel(refreshControlComponentLabel),
|
||||
android: `~${refreshControlComponentLabel}`,
|
||||
}),
|
||||
scrollViewSimpleExampleComponentLabelElement: Utils.platformSelect({
|
||||
ios: iOSLabel(scrollViewSimpleExampleComponentLabel),
|
||||
android: `~${scrollViewSimpleExampleComponentLabel}`,
|
||||
}),
|
||||
// Methods to interact with top level elements in the list
|
||||
checkButtonComponentIsDisplayed: async function (
|
||||
this: ComponentsScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(this.buttonComponentLabelElement);
|
||||
},
|
||||
checkActivityIndicatorComponentIsDisplayed: async function (
|
||||
this: ComponentsScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(
|
||||
this.activityIndicatorComponentLabelElement,
|
||||
);
|
||||
},
|
||||
checkKeyboardAvoidingViewComponentIsDisplayed: async function (
|
||||
this: ComponentsScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(
|
||||
this.keyboardAvoidingViewComponentLabelElement,
|
||||
);
|
||||
},
|
||||
checkFlatListComponentIsDisplayed: async function (
|
||||
this: ComponentsScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(
|
||||
this.flatListComponentLabelElement,
|
||||
);
|
||||
},
|
||||
checkJSResponderHandlerComponentIsDisplayed: async function (
|
||||
this: ComponentsScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(
|
||||
this.jsResponderHandlerComponentLabelElement,
|
||||
);
|
||||
},
|
||||
checkModalComponentIsDisplayed: async function (
|
||||
this: ComponentsScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(this.modalComponentLabelElement);
|
||||
},
|
||||
checkNewAppScreenComponentIsDisplayed: async function (
|
||||
this: ComponentsScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(
|
||||
this.newAppScreenComponentLabelElement,
|
||||
);
|
||||
},
|
||||
checkPressableComponentIsDisplayed: async function (
|
||||
this: ComponentsScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(
|
||||
this.pressableComponentLabelElement,
|
||||
);
|
||||
},
|
||||
checkRefreshControlComponentIsDisplayed: async function (
|
||||
this: ComponentsScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(
|
||||
this.refreshControlComponentLabelElement,
|
||||
);
|
||||
},
|
||||
checkScrollViewSimpleExampleComponentIsDisplayed: async function (
|
||||
this: ComponentsScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(
|
||||
this.scrollViewSimpleExampleComponentLabelElement,
|
||||
);
|
||||
},
|
||||
clickButtonComponent: async function (
|
||||
this: ComponentsScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.buttonComponentLabelElement);
|
||||
},
|
||||
clickActivityIndicatorComponent: async function (
|
||||
this: ComponentsScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.activityIndicatorComponentLabelElement);
|
||||
},
|
||||
clickKeyboardAvoidingViewComponent: async function (
|
||||
this: ComponentsScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.keyboardAvoidingViewComponentLabelElement);
|
||||
},
|
||||
clickFlatListComponent: async function (
|
||||
this: ComponentsScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.flatListComponentLabelElement);
|
||||
},
|
||||
clickJSResponderHandlerComponent: async function (
|
||||
this: ComponentsScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.jsResponderHandlerComponentLabelElement);
|
||||
},
|
||||
clickModalComponent: async function (
|
||||
this: ComponentsScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.modalComponentLabelElement);
|
||||
},
|
||||
clickNewAppScreenComponent: async function (
|
||||
this: ComponentsScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.newAppScreenComponentLabelElement);
|
||||
},
|
||||
clickPressableComponent: async function (
|
||||
this: ComponentsScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.pressableComponentLabelElement);
|
||||
},
|
||||
clickRefreshControlComponent: async function (
|
||||
this: ComponentsScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.refreshControlComponentLabelElement);
|
||||
},
|
||||
clickScrollViewSimpleExampleComponent: async function (
|
||||
this: ComponentsScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.scrollViewSimpleExampleComponentLabelElement);
|
||||
},
|
||||
};
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {
|
||||
UtilsSingleton as Utils,
|
||||
iOSLabel,
|
||||
androidWidget,
|
||||
iOSName,
|
||||
} from '../../helpers/utils';
|
||||
|
||||
type ActivityIndicatorComponentScreenType = {
|
||||
activityIndicatorScreenElement: string,
|
||||
defaultActivityIndicatorScreenElement: string,
|
||||
checkDefaultActivityIndicatorIsDisplayed: () => Promise<boolean>,
|
||||
};
|
||||
|
||||
const defaultActivityIndicatorTextDesc = 'Wait for content to load!';
|
||||
|
||||
export const ActivityIndicatorComponentScreen: ActivityIndicatorComponentScreenType =
|
||||
{
|
||||
// reference in the Components list
|
||||
activityIndicatorScreenElement: Utils.platformSelect({
|
||||
ios: iOSName('ActivityIndicator'),
|
||||
android: androidWidget('TextView', 'text', 'ActivityIndicator'),
|
||||
}),
|
||||
// References to elements within the Activity Indicator Component screen
|
||||
defaultActivityIndicatorScreenElement: Utils.platformSelect({
|
||||
ios: iOSLabel(defaultActivityIndicatorTextDesc),
|
||||
android: androidWidget(
|
||||
'FrameLayout',
|
||||
'content-desc',
|
||||
defaultActivityIndicatorTextDesc,
|
||||
),
|
||||
}),
|
||||
// Methods to interact with the elements
|
||||
checkDefaultActivityIndicatorIsDisplayed: async function (
|
||||
this: ActivityIndicatorComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(
|
||||
this.defaultActivityIndicatorScreenElement,
|
||||
);
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,351 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {
|
||||
UtilsSingleton as Utils,
|
||||
iOSLabel,
|
||||
androidWidget,
|
||||
iOSName,
|
||||
} from '../../helpers/utils';
|
||||
|
||||
type FlatListComponentScreenType = {
|
||||
flatListScreenElement: string,
|
||||
basicScreenElement: string,
|
||||
onStartReachedScreenElement: string,
|
||||
onEndReachedScreenElement: string,
|
||||
contentInsetScreenElement: string,
|
||||
invertedScreenElement: string,
|
||||
onViewableItemsChangedScreenElement: string,
|
||||
flatListWithSeparatorsScreenElement: string,
|
||||
multiColumnScreenElement: string,
|
||||
stickyHeadersScreenElement: string,
|
||||
nestedScreenElement: string,
|
||||
basicSearchBarScreenElement: string,
|
||||
btnCollapseElement: string,
|
||||
btnToggleTrueElement: string,
|
||||
btnToggleFalseElement: string,
|
||||
onStartBtnTestElement: string,
|
||||
stickyPizzaElement: string,
|
||||
pizzaElement: string,
|
||||
iceCreamElement: string,
|
||||
contentInsetMenuElement: string,
|
||||
separatorElement: string,
|
||||
listHeaderTextElement: string,
|
||||
nestedHeaderTextElement: string,
|
||||
checkFlatListBasicScreenIsDisplayed: () => Promise<boolean>,
|
||||
checkFlatListOnStartReachedScreenIsDisplayed: () => Promise<boolean>,
|
||||
checkFlatListOnEndReachedScreenIsDisplayed: () => Promise<boolean>,
|
||||
checkFlatListContentInsetScreenIsDisplayed: () => Promise<boolean>,
|
||||
checkFlatListInvertedScreenIsDisplayed: () => Promise<boolean>,
|
||||
checkFlatListOnViewableItemsChangedScreenIsDisplayed: () => Promise<boolean>,
|
||||
checkFlatListWithSeparatorsScreenIsDisplayed: () => Promise<boolean>,
|
||||
checkFlatListMultiColumnScreenIsDisplayed: () => Promise<boolean>,
|
||||
checkFlatListStickyHeadersScreenIsDisplayed: () => Promise<boolean>,
|
||||
checkFlatListNestedScreenIsDisplayed: () => Promise<boolean>,
|
||||
checkSearchBarIsDisplayed: () => Promise<boolean>,
|
||||
checkCollapseButtonIsDisplayed: () => Promise<boolean>,
|
||||
checkPizzaIsDisplayed: () => Promise<boolean>,
|
||||
checkIceCreamIsDisplayed: () => Promise<boolean>,
|
||||
checkContentInsetMenuIsDisplayed: () => Promise<boolean>,
|
||||
checkInvertedToggleFalseButtonIsDisplayed: () => Promise<boolean>,
|
||||
checkSeparatorIsDisplayed: () => Promise<boolean>,
|
||||
checkListHeaderIsDisplayed: () => Promise<boolean>,
|
||||
checkStickyPizzaIsDisplayed: () => Promise<boolean>,
|
||||
checkNestedHeaderIsDisplayed: () => Promise<boolean>,
|
||||
scrollUntilOnViewableItemsChangedIsDisplayed: () => Promise<void>,
|
||||
scrollUntilNestedIsDisplayed: () => Promise<void>,
|
||||
clickFlatListBasicButton: () => Promise<void>,
|
||||
clickFlatListOnStartButton: () => Promise<void>,
|
||||
clickFlatListOnStartTestButton: () => Promise<void>,
|
||||
clickFlatListOnEndButton: () => Promise<void>,
|
||||
clickFlatListContentInsetButton: () => Promise<void>,
|
||||
clickFlatListInvertedButton: () => Promise<void>,
|
||||
clickFlatListOnViewableItemsChangedButton: () => Promise<void>,
|
||||
clickFlatListWithSeparatorsButton: () => Promise<void>,
|
||||
clickFlatListMultiColumnButton: () => Promise<void>,
|
||||
clickFlatListStickyHeadersButton: () => Promise<void>,
|
||||
clickFlatListNestedButton: () => Promise<void>,
|
||||
clickToggleTrueButton: () => Promise<void>,
|
||||
};
|
||||
const flatListWithSeparatorsText = 'FlatList with Separators';
|
||||
|
||||
export const FlatListComponentScreen: FlatListComponentScreenType = {
|
||||
// reference in the Components list
|
||||
flatListScreenElement: Utils.platformSelect({
|
||||
ios: iOSName('FlatList'),
|
||||
android: androidWidget('TextView', 'text', 'FlatList'),
|
||||
}),
|
||||
// References to elements within the FlatList Component screen
|
||||
basicScreenElement: Utils.platformSelect({
|
||||
ios: iOSName('Basic'),
|
||||
android: androidWidget('TextView', 'text', 'Basic'),
|
||||
}),
|
||||
onStartReachedScreenElement: Utils.platformSelect({
|
||||
ios: iOSName('onStartReached'),
|
||||
android: androidWidget('TextView', 'text', 'onStartReached'),
|
||||
}),
|
||||
onEndReachedScreenElement: Utils.platformSelect({
|
||||
ios: iOSName('onEndReached'),
|
||||
android: androidWidget('TextView', 'text', 'onEndReached'),
|
||||
}),
|
||||
contentInsetScreenElement: Utils.platformSelect({
|
||||
ios: iOSName('Content Inset'),
|
||||
android: androidWidget('TextView', 'text', 'Content Inset'),
|
||||
}),
|
||||
invertedScreenElement: Utils.platformSelect({
|
||||
ios: iOSName('Inverted'),
|
||||
android: androidWidget('TextView', 'text', 'Inverted'),
|
||||
}),
|
||||
onViewableItemsChangedScreenElement: Utils.platformSelect({
|
||||
ios: iOSName('onViewableItemsChanged'),
|
||||
android: androidWidget('TextView', 'text', 'onViewableItemsChanged'),
|
||||
}),
|
||||
flatListWithSeparatorsScreenElement: Utils.platformSelect({
|
||||
ios: iOSName(flatListWithSeparatorsText),
|
||||
android: androidWidget('TextView', 'text', flatListWithSeparatorsText),
|
||||
}),
|
||||
multiColumnScreenElement: Utils.platformSelect({
|
||||
ios: iOSName('MultiColumn'),
|
||||
android: androidWidget('TextView', 'text', 'MultiColumn'),
|
||||
}),
|
||||
stickyHeadersScreenElement: Utils.platformSelect({
|
||||
ios: iOSName('Sticky Headers'),
|
||||
android: androidWidget('TextView', 'text', 'Sticky Headers'),
|
||||
}),
|
||||
nestedScreenElement: Utils.platformSelect({
|
||||
ios: iOSName('Nested'),
|
||||
android: androidWidget('TextView', 'text', 'Nested'),
|
||||
}),
|
||||
btnCollapseElement: Utils.platformSelect({
|
||||
ios: iOSLabel('Collapse'),
|
||||
android: androidWidget('Button', 'content-desc', 'COLLAPSE'),
|
||||
}),
|
||||
btnToggleTrueElement: Utils.platformSelect({
|
||||
ios: iOSLabel('Toggle true'),
|
||||
android: androidWidget('Button', 'content-desc', 'TOGGLE TRUE'),
|
||||
}),
|
||||
btnToggleFalseElement: Utils.platformSelect({
|
||||
ios: iOSLabel('Toggle false'),
|
||||
android: androidWidget('Button', 'content-desc', 'TOGGLE FALSE'),
|
||||
}),
|
||||
basicSearchBarScreenElement: Utils.platformSelect({
|
||||
ios: iOSName('search_bar_flat_list'),
|
||||
android: androidWidget('EditText', 'resource-id', 'search_bar_flat_list'),
|
||||
}),
|
||||
onStartBtnTestElement: Utils.platformSelect({
|
||||
ios: iOSName('start_test'),
|
||||
android: androidWidget('Button', 'resource-id', 'start_test'),
|
||||
}),
|
||||
pizzaElement: Utils.platformSelect({
|
||||
ios: iOSLabel('Pizza'),
|
||||
android: androidWidget('TextView', 'text', 'Pizza'),
|
||||
}),
|
||||
iceCreamElement: Utils.platformSelect({
|
||||
ios: iOSLabel('Ice Cream'),
|
||||
android: androidWidget('TextView', 'text', 'Ice Cream'),
|
||||
}),
|
||||
contentInsetMenuElement: Utils.platformSelect({
|
||||
ios: iOSLabel('Menu'),
|
||||
android: androidWidget('TextView', 'text', 'Menu'),
|
||||
}),
|
||||
separatorElement: Utils.platformSelect({
|
||||
ios: iOSName('flat_list_separator'),
|
||||
android: androidWidget('TextView', 'resource-id', 'flat_list_separator'),
|
||||
}),
|
||||
listHeaderTextElement: Utils.platformSelect({
|
||||
ios: iOSName('LIST HEADER'),
|
||||
android: androidWidget('TextView', 'text', 'LIST HEADER'),
|
||||
}),
|
||||
stickyPizzaElement: Utils.platformSelect({
|
||||
ios: iOSName('Sticky Pizza'),
|
||||
android: androidWidget('TextView', 'text', 'Sticky Pizza'),
|
||||
}),
|
||||
nestedHeaderTextElement: Utils.platformSelect({
|
||||
ios: iOSName('Header'),
|
||||
android: androidWidget('TextView', 'text', 'Header'),
|
||||
}),
|
||||
// Methods to interact with the FlatList elements
|
||||
checkSearchBarIsDisplayed: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(this.basicSearchBarScreenElement);
|
||||
},
|
||||
checkCollapseButtonIsDisplayed: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(this.btnCollapseElement);
|
||||
},
|
||||
checkFlatListBasicScreenIsDisplayed: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(this.basicScreenElement);
|
||||
},
|
||||
checkFlatListOnStartReachedScreenIsDisplayed: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(this.onStartReachedScreenElement);
|
||||
},
|
||||
checkFlatListOnEndReachedScreenIsDisplayed: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(this.onEndReachedScreenElement);
|
||||
},
|
||||
checkPizzaIsDisplayed: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(this.pizzaElement);
|
||||
},
|
||||
checkIceCreamIsDisplayed: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(this.iceCreamElement);
|
||||
},
|
||||
checkFlatListContentInsetScreenIsDisplayed: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(this.contentInsetScreenElement);
|
||||
},
|
||||
checkFlatListInvertedScreenIsDisplayed: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(this.invertedScreenElement);
|
||||
},
|
||||
checkFlatListOnViewableItemsChangedScreenIsDisplayed: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(
|
||||
this.onViewableItemsChangedScreenElement,
|
||||
);
|
||||
},
|
||||
checkFlatListWithSeparatorsScreenIsDisplayed: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(
|
||||
this.flatListWithSeparatorsScreenElement,
|
||||
);
|
||||
},
|
||||
checkFlatListMultiColumnScreenIsDisplayed: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(this.multiColumnScreenElement);
|
||||
},
|
||||
checkFlatListStickyHeadersScreenIsDisplayed: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(this.stickyHeadersScreenElement);
|
||||
},
|
||||
checkFlatListNestedScreenIsDisplayed: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(this.nestedScreenElement);
|
||||
},
|
||||
checkListHeaderIsDisplayed: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(this.listHeaderTextElement);
|
||||
},
|
||||
checkContentInsetMenuIsDisplayed: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(this.contentInsetMenuElement);
|
||||
},
|
||||
checkInvertedToggleFalseButtonIsDisplayed: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(this.btnToggleFalseElement);
|
||||
},
|
||||
checkSeparatorIsDisplayed: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(this.separatorElement);
|
||||
},
|
||||
checkStickyPizzaIsDisplayed: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(this.stickyPizzaElement);
|
||||
},
|
||||
checkNestedHeaderIsDisplayed: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(this.nestedHeaderTextElement);
|
||||
},
|
||||
scrollUntilOnViewableItemsChangedIsDisplayed: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<void> {
|
||||
return await Utils.scrollToElement(
|
||||
this.onViewableItemsChangedScreenElement,
|
||||
);
|
||||
},
|
||||
scrollUntilNestedIsDisplayed: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<void> {
|
||||
return await Utils.scrollToElement(this.nestedScreenElement);
|
||||
},
|
||||
clickFlatListBasicButton: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.basicScreenElement);
|
||||
},
|
||||
clickFlatListOnStartButton: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.onStartReachedScreenElement);
|
||||
},
|
||||
clickFlatListOnStartTestButton: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.onStartBtnTestElement);
|
||||
},
|
||||
clickFlatListOnEndButton: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.onEndReachedScreenElement);
|
||||
},
|
||||
clickFlatListContentInsetButton: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.contentInsetScreenElement);
|
||||
},
|
||||
clickFlatListInvertedButton: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.invertedScreenElement);
|
||||
},
|
||||
clickFlatListOnViewableItemsChangedButton: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.onViewableItemsChangedScreenElement);
|
||||
},
|
||||
clickFlatListWithSeparatorsButton: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.flatListWithSeparatorsScreenElement);
|
||||
},
|
||||
clickFlatListMultiColumnButton: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.multiColumnScreenElement);
|
||||
},
|
||||
clickFlatListStickyHeadersButton: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.stickyHeadersScreenElement);
|
||||
},
|
||||
clickFlatListNestedButton: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.nestedScreenElement);
|
||||
},
|
||||
clickToggleTrueButton: async function (
|
||||
this: FlatListComponentScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.btnToggleTrueElement);
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {
|
||||
UtilsSingleton as Utils,
|
||||
androidWidget,
|
||||
iOSName,
|
||||
} from '../../helpers/utils';
|
||||
|
||||
type JSResponderHandlerComponentScreenType = {
|
||||
jsResponderHandlerScreenElement: string,
|
||||
rowZeroScreenElement: string,
|
||||
scrollUntilJSResponderHandlerComponentIsDisplayed: () => Promise<void>,
|
||||
checkRowZeroLabelIsDisplayed: () => Promise<boolean>,
|
||||
getRowZeroText: () => Promise<string>,
|
||||
};
|
||||
|
||||
export const JSResponderHandlerComponentScreen: JSResponderHandlerComponentScreenType =
|
||||
{
|
||||
// reference in the Components list
|
||||
jsResponderHandlerScreenElement: Utils.platformSelect({
|
||||
ios: iOSName('JSResponderHandler'),
|
||||
android: androidWidget('TextView', 'text', 'JSResponderHandler'),
|
||||
}),
|
||||
// References to elements within the js responder handler Component screen
|
||||
rowZeroScreenElement: Utils.platformSelect({
|
||||
ios: iOSName('row_js_responder_handler'),
|
||||
android: androidWidget(
|
||||
'TextView',
|
||||
'resource-id',
|
||||
'row_js_responder_handler',
|
||||
),
|
||||
}),
|
||||
// Methods to interact with the elements
|
||||
scrollUntilJSResponderHandlerComponentIsDisplayed: async function (
|
||||
this: JSResponderHandlerComponentScreenType,
|
||||
): Promise<void> {
|
||||
return await Utils.scrollToElement(this.jsResponderHandlerScreenElement);
|
||||
},
|
||||
checkRowZeroLabelIsDisplayed: async function (
|
||||
this: JSResponderHandlerComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(this.rowZeroScreenElement);
|
||||
},
|
||||
getRowZeroText: async function (
|
||||
this: JSResponderHandlerComponentScreenType,
|
||||
): Promise<string> {
|
||||
return await Utils.getElementText(this.rowZeroScreenElement);
|
||||
},
|
||||
};
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {
|
||||
UtilsSingleton as Utils,
|
||||
androidWidget,
|
||||
iOSLabel,
|
||||
iOSName,
|
||||
} from '../../helpers/utils';
|
||||
|
||||
type KeyboardAvoidingViewComponentScreenType = {
|
||||
keyboardAvoidingViewScreenElement: string,
|
||||
btnDifferentBehaviorsOpenExampleElement: string,
|
||||
btnRegisterElement: string,
|
||||
registerAlertBoxElement: string,
|
||||
btnOKElement: string,
|
||||
scrollUntilKeyboardAvoidingViewComponentIsDisplayed: () => Promise<void>,
|
||||
checkBtnDifferentBehaviorsOpenExampleIsDisplayed: () => Promise<boolean>,
|
||||
checkBtnRegisterIsDisplayed: () => Promise<boolean>,
|
||||
clickDifferentBehaviorsOpenExampleButton: () => Promise<void>,
|
||||
clickRegisterButton: () => Promise<void>,
|
||||
clickOkButton: () => Promise<void>,
|
||||
getRegisterAlertText: () => Promise<string>,
|
||||
};
|
||||
|
||||
export const KeyboardAvoidingViewComponentScreen: KeyboardAvoidingViewComponentScreenType =
|
||||
{
|
||||
// reference in the Components list
|
||||
keyboardAvoidingViewScreenElement: Utils.platformSelect({
|
||||
ios: iOSName('KeyboardAvoidingView'),
|
||||
android: androidWidget('TextView', 'text', 'KeyboardAvoidingView'),
|
||||
}),
|
||||
// References to elements within the KeyboardAvoidingVIew Component screen
|
||||
btnDifferentBehaviorsOpenExampleElement: Utils.platformSelect({
|
||||
ios: iOSName('keyboard_avoiding_view_behaviors_open'),
|
||||
android: androidWidget(
|
||||
'TextView',
|
||||
'resource-id',
|
||||
'keyboard_avoiding_view_behaviors_open',
|
||||
),
|
||||
}),
|
||||
btnRegisterElement: Utils.platformSelect({
|
||||
ios: iOSName('register_button'),
|
||||
android: androidWidget('Button', 'resource-id', 'register_button'),
|
||||
}),
|
||||
registerAlertBoxElement: Utils.platformSelect({
|
||||
ios: iOSLabel('Successfully Registered!'),
|
||||
android: androidWidget(
|
||||
'TextView',
|
||||
'resource-id',
|
||||
'android:id/alertTitle',
|
||||
),
|
||||
}),
|
||||
btnOKElement: Utils.platformSelect({
|
||||
ios: iOSLabel('OK'),
|
||||
android: androidWidget('Button', 'text', 'OK'),
|
||||
}),
|
||||
// Methods to interact with the elements
|
||||
scrollUntilKeyboardAvoidingViewComponentIsDisplayed: async function (
|
||||
this: KeyboardAvoidingViewComponentScreenType,
|
||||
): Promise<void> {
|
||||
return await Utils.scrollToElement(
|
||||
this.keyboardAvoidingViewScreenElement,
|
||||
);
|
||||
},
|
||||
checkBtnDifferentBehaviorsOpenExampleIsDisplayed: async function (
|
||||
this: KeyboardAvoidingViewComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(
|
||||
this.btnDifferentBehaviorsOpenExampleElement,
|
||||
);
|
||||
},
|
||||
checkBtnRegisterIsDisplayed: async function (
|
||||
this: KeyboardAvoidingViewComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(this.btnRegisterElement);
|
||||
},
|
||||
clickDifferentBehaviorsOpenExampleButton: async function (
|
||||
this: KeyboardAvoidingViewComponentScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.btnDifferentBehaviorsOpenExampleElement);
|
||||
},
|
||||
clickRegisterButton: async function (
|
||||
this: KeyboardAvoidingViewComponentScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.btnRegisterElement);
|
||||
},
|
||||
clickOkButton: async function (
|
||||
this: KeyboardAvoidingViewComponentScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.btnOKElement);
|
||||
},
|
||||
getRegisterAlertText: async function (
|
||||
this: KeyboardAvoidingViewComponentScreenType,
|
||||
): Promise<string> {
|
||||
return await Utils.getElementText(this.registerAlertBoxElement);
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,91 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {
|
||||
UtilsSingleton as Utils,
|
||||
androidWidget,
|
||||
iOSName,
|
||||
} from '../../helpers/utils';
|
||||
|
||||
type ModalComponentScreenType = {
|
||||
modalScreenElement: string,
|
||||
btnShowModalElement: string,
|
||||
modalAnimationTypeTextElement: string,
|
||||
modalModeTextElement: string,
|
||||
btnCloseElement: string,
|
||||
checkShowModalIsDisplayed: () => Promise<boolean>,
|
||||
checkModalAnimationTypeIsDisplayed: () => Promise<boolean>,
|
||||
scrollUntilModalComponentIsDisplayed: () => Promise<void>,
|
||||
clickShowModalButton: () => Promise<void>,
|
||||
clickCloseButton: () => Promise<void>,
|
||||
};
|
||||
|
||||
const showModalBtnText = 'Show Modal';
|
||||
|
||||
export const ModalComponentScreen: ModalComponentScreenType = {
|
||||
// reference in the Components list
|
||||
modalScreenElement: Utils.platformSelect({
|
||||
ios: iOSName('Modal'),
|
||||
android: androidWidget('TextView', 'text', 'Modal'),
|
||||
}),
|
||||
// References to elements within the Modal Component screen
|
||||
btnShowModalElement: Utils.platformSelect({
|
||||
ios: iOSName(showModalBtnText),
|
||||
android: androidWidget('TextView', 'text', showModalBtnText),
|
||||
}),
|
||||
modalAnimationTypeTextElement: Utils.platformSelect({
|
||||
ios: iOSName('modal_animationType_text'),
|
||||
android: androidWidget(
|
||||
'TextView',
|
||||
'resource-id',
|
||||
'modal_animationType_text',
|
||||
),
|
||||
}),
|
||||
modalModeTextElement: Utils.platformSelect({
|
||||
ios: iOSName('modal_animationType_text'),
|
||||
android: androidWidget(
|
||||
'TextView',
|
||||
'resource-id',
|
||||
'row_js_responder_handler',
|
||||
),
|
||||
}),
|
||||
btnCloseElement: Utils.platformSelect({
|
||||
ios: iOSName('Close'),
|
||||
android: androidWidget('TextView', 'text', 'Close'),
|
||||
}),
|
||||
// Methods to interact with the elements
|
||||
checkShowModalIsDisplayed: async function (
|
||||
this: ModalComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(this.btnShowModalElement);
|
||||
},
|
||||
checkModalAnimationTypeIsDisplayed: async function (
|
||||
this: ModalComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(
|
||||
this.modalAnimationTypeTextElement,
|
||||
);
|
||||
},
|
||||
scrollUntilModalComponentIsDisplayed: async function (
|
||||
this: ModalComponentScreenType,
|
||||
): Promise<void> {
|
||||
return await Utils.scrollToElement(this.modalScreenElement);
|
||||
},
|
||||
clickShowModalButton: async function (
|
||||
this: ModalComponentScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.btnShowModalElement);
|
||||
},
|
||||
clickCloseButton: async function (
|
||||
this: ModalComponentScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.btnCloseElement);
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {
|
||||
UtilsSingleton as Utils,
|
||||
androidWidget,
|
||||
iOSName,
|
||||
} from '../../helpers/utils';
|
||||
|
||||
type NewAppComponentScreenType = {
|
||||
newAppScreenElement: string,
|
||||
newAppHeaderScreenElement: string,
|
||||
scrollUntilNewAppHeaderComponentIsDisplayed: () => Promise<void>,
|
||||
checkNewAppHeaderIsDisplayed: () => Promise<boolean>,
|
||||
};
|
||||
|
||||
const newAppScreenText = 'New App Screen';
|
||||
const newAppScreenHeaderText = 'New App Screen Header';
|
||||
|
||||
export const NewAppComponentScreen: NewAppComponentScreenType = {
|
||||
// reference in the Components list
|
||||
newAppScreenElement: Utils.platformSelect({
|
||||
ios: iOSName(newAppScreenText),
|
||||
android: androidWidget('TextView', 'text', newAppScreenText),
|
||||
}),
|
||||
// References to elements within the New App Component screenS
|
||||
newAppHeaderScreenElement: Utils.platformSelect({
|
||||
ios: iOSName(newAppScreenHeaderText),
|
||||
android: androidWidget('TextView', 'text', newAppScreenHeaderText),
|
||||
}),
|
||||
// Methods to interact with the elements
|
||||
scrollUntilNewAppHeaderComponentIsDisplayed: async function (
|
||||
this: NewAppComponentScreenType,
|
||||
): Promise<void> {
|
||||
return await Utils.scrollToElement(this.newAppScreenElement);
|
||||
},
|
||||
checkNewAppHeaderIsDisplayed: async function (
|
||||
this: NewAppComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(this.newAppHeaderScreenElement);
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {
|
||||
UtilsSingleton as Utils,
|
||||
androidWidget,
|
||||
iOSName,
|
||||
} from '../../helpers/utils';
|
||||
|
||||
type PressableComponentScreenType = {
|
||||
pressableScreenElement: string,
|
||||
pressMeHeaderElement: string,
|
||||
btnPressMeElement: string,
|
||||
onPressText: string,
|
||||
checkPressMeHeaderIsDisplayed: () => Promise<boolean>,
|
||||
checkOnPressIsDisplayed: () => Promise<boolean>,
|
||||
scrollUntilPressableComponentIsDisplayed: () => Promise<void>,
|
||||
clickPressMeButton: () => Promise<void>,
|
||||
getOnPressText: () => Promise<string>,
|
||||
};
|
||||
|
||||
const pressMeHeaderText = 'Change content based on Press';
|
||||
|
||||
export const PressableComponentScreen: PressableComponentScreenType = {
|
||||
// reference in the Components list
|
||||
pressableScreenElement: Utils.platformSelect({
|
||||
ios: iOSName('Pressable'),
|
||||
android: androidWidget('TextView', 'text', 'Pressable'),
|
||||
}),
|
||||
// References to elements within the Pressable Component screen
|
||||
pressMeHeaderElement: Utils.platformSelect({
|
||||
ios: iOSName(pressMeHeaderText),
|
||||
android: androidWidget('TextView', 'text', pressMeHeaderText),
|
||||
}),
|
||||
btnPressMeElement: Utils.platformSelect({
|
||||
ios: iOSName('one_press_me_button'),
|
||||
android: androidWidget('TextView', 'resource-id', 'one_press_me_button'),
|
||||
}),
|
||||
onPressText: Utils.platformSelect({
|
||||
ios: iOSName('pressable_press_console'),
|
||||
android: androidWidget(
|
||||
'TextView',
|
||||
'resource-id',
|
||||
'pressable_press_console',
|
||||
),
|
||||
}),
|
||||
// Methods to interact with the elements
|
||||
checkPressMeHeaderIsDisplayed: async function (
|
||||
this: PressableComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(this.pressMeHeaderElement);
|
||||
},
|
||||
checkOnPressIsDisplayed: async function (
|
||||
this: PressableComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(this.onPressText);
|
||||
},
|
||||
scrollUntilPressableComponentIsDisplayed: async function (
|
||||
this: PressableComponentScreenType,
|
||||
): Promise<void> {
|
||||
return await Utils.scrollToElement(this.pressableScreenElement);
|
||||
},
|
||||
clickPressMeButton: async function (
|
||||
this: PressableComponentScreenType,
|
||||
): Promise<void> {
|
||||
await Utils.clickElement(this.btnPressMeElement);
|
||||
},
|
||||
getOnPressText: async function (
|
||||
this: PressableComponentScreenType,
|
||||
): Promise<string> {
|
||||
return await Utils.getElementText(this.onPressText);
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {
|
||||
UtilsSingleton as Utils,
|
||||
androidWidget,
|
||||
iOSName,
|
||||
} from '../../helpers/utils';
|
||||
|
||||
type RefreshControlComponentScreenType = {
|
||||
refreshControlScreenElement: string,
|
||||
initialRowScreenElement: string,
|
||||
checkInitialRowIsDisplayed: () => Promise<boolean>,
|
||||
scrollUntilRefreshControlComponentIsDisplayed: () => Promise<void>,
|
||||
};
|
||||
|
||||
export const RefreshControlComponentScreen: RefreshControlComponentScreenType =
|
||||
{
|
||||
// reference in the Components list
|
||||
refreshControlScreenElement: Utils.platformSelect({
|
||||
ios: iOSName('RefreshControl'),
|
||||
android: androidWidget('TextView', 'text', 'RefreshControl'),
|
||||
}),
|
||||
// References to elements within the RefreshControl Component screen
|
||||
initialRowScreenElement: Utils.platformSelect({
|
||||
ios: iOSName('refresh_control_row'),
|
||||
android: androidWidget('TextView', 'resource-id', 'refresh_control_row'),
|
||||
}),
|
||||
// Methods to interact with the elements
|
||||
checkInitialRowIsDisplayed: async function (
|
||||
this: RefreshControlComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(this.initialRowScreenElement);
|
||||
},
|
||||
scrollUntilRefreshControlComponentIsDisplayed: async function (
|
||||
this: RefreshControlComponentScreenType,
|
||||
): Promise<void> {
|
||||
return await Utils.scrollToElement(this.refreshControlScreenElement);
|
||||
},
|
||||
};
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {
|
||||
UtilsSingleton as Utils,
|
||||
androidWidget,
|
||||
iOSName,
|
||||
} from '../../helpers/utils';
|
||||
|
||||
type ScrollViewSimpleExampleComponentScreenType = {
|
||||
scrollViewSimpleExampleScreenElement: string,
|
||||
scrollViewItemScreenElement: string,
|
||||
checkScrollViewItemsDisplayed: () => Promise<boolean>,
|
||||
scrollUntilScrollViewSimpleExampleComponentIsDisplayed: () => Promise<void>,
|
||||
};
|
||||
|
||||
export const ScrollViewSimpleExampleComponentScreen: ScrollViewSimpleExampleComponentScreenType =
|
||||
{
|
||||
// reference in the Components list
|
||||
scrollViewSimpleExampleScreenElement: Utils.platformSelect({
|
||||
ios: iOSName('ScrollViewSimpleExample'),
|
||||
android: androidWidget('TextView', 'text', 'ScrollViewSimpleExample'),
|
||||
}),
|
||||
// References to elements within the ScrollViewSimpleExample Component screen
|
||||
scrollViewItemScreenElement: Utils.platformSelect({
|
||||
ios: iOSName('scroll_view_item'),
|
||||
android: androidWidget('TextView', 'resource-id', 'scroll_view_item'),
|
||||
}),
|
||||
// Methods to interact with the elements
|
||||
checkScrollViewItemsDisplayed: async function (
|
||||
this: ScrollViewSimpleExampleComponentScreenType,
|
||||
): Promise<boolean> {
|
||||
return await Utils.checkElementExistence(
|
||||
this.scrollViewItemScreenElement,
|
||||
);
|
||||
},
|
||||
scrollUntilScrollViewSimpleExampleComponentIsDisplayed: async function (
|
||||
this: ScrollViewSimpleExampleComponentScreenType,
|
||||
): Promise<void> {
|
||||
return await Utils.scrollToElement(
|
||||
this.scrollViewSimpleExampleScreenElement,
|
||||
);
|
||||
},
|
||||
};
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
* @format
|
||||
*/
|
||||
|
||||
const {ComponentsScreen} = require('../../screens/components.screen.js');
|
||||
const {
|
||||
ActivityIndicatorComponentScreen,
|
||||
} = require('../../screens/components/activityIndicatorComponent.screen.js');
|
||||
|
||||
describe('Test is checking default activity indicator component', () => {
|
||||
test('Should view properly default progress bar', async () => {
|
||||
expect(
|
||||
await ComponentsScreen.checkActivityIndicatorComponentIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await ComponentsScreen.clickActivityIndicatorComponent();
|
||||
expect(
|
||||
await ActivityIndicatorComponentScreen.checkDefaultActivityIndicatorIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,187 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
* @format
|
||||
*/
|
||||
|
||||
const {ComponentsScreen} = require('../../screens/components.screen.js');
|
||||
const {
|
||||
FlatListComponentScreen,
|
||||
} = require('../../screens/components/flatListComponent.screen.js');
|
||||
|
||||
describe('Test is checking basic flat list', () => {
|
||||
test('Should view properly search bar of basic flat list', async () => {
|
||||
expect(
|
||||
await ComponentsScreen.checkFlatListComponentIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await ComponentsScreen.clickFlatListComponent();
|
||||
expect(
|
||||
await FlatListComponentScreen.checkFlatListBasicScreenIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await FlatListComponentScreen.clickFlatListBasicButton();
|
||||
expect(
|
||||
await FlatListComponentScreen.checkSearchBarIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Test is checking onStartReached flat list', () => {
|
||||
test('Should view properly first element', async () => {
|
||||
expect(
|
||||
await ComponentsScreen.checkFlatListComponentIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await ComponentsScreen.clickFlatListComponent();
|
||||
expect(
|
||||
await FlatListComponentScreen.checkFlatListOnStartReachedScreenIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await FlatListComponentScreen.clickFlatListOnStartButton();
|
||||
expect(
|
||||
await FlatListComponentScreen.checkCollapseButtonIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await FlatListComponentScreen.clickFlatListOnStartTestButton();
|
||||
expect(await FlatListComponentScreen.checkPizzaIsDisplayed()).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Test is checking onEndReached flat list', () => {
|
||||
test('Should view properly the last element', async () => {
|
||||
expect(
|
||||
await ComponentsScreen.checkFlatListComponentIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await ComponentsScreen.clickFlatListComponent();
|
||||
expect(
|
||||
await FlatListComponentScreen.checkFlatListOnEndReachedScreenIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await FlatListComponentScreen.clickFlatListOnEndButton();
|
||||
expect(
|
||||
await FlatListComponentScreen.checkCollapseButtonIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await FlatListComponentScreen.clickFlatListOnStartTestButton();
|
||||
expect(
|
||||
await FlatListComponentScreen.checkIceCreamIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Test is checking content inset flat list', () => {
|
||||
test('Should view properly the menu element', async () => {
|
||||
expect(
|
||||
await ComponentsScreen.checkFlatListComponentIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await ComponentsScreen.clickFlatListComponent();
|
||||
expect(
|
||||
await FlatListComponentScreen.checkFlatListContentInsetScreenIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await FlatListComponentScreen.clickFlatListContentInsetButton();
|
||||
expect(
|
||||
await FlatListComponentScreen.checkCollapseButtonIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
expect(
|
||||
await FlatListComponentScreen.checkContentInsetMenuIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Test is checking inverted flat list', () => {
|
||||
test('Should view properly the menu element', async () => {
|
||||
expect(
|
||||
await ComponentsScreen.checkFlatListComponentIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await ComponentsScreen.clickFlatListComponent();
|
||||
await FlatListComponentScreen.scrollUntilOnViewableItemsChangedIsDisplayed();
|
||||
expect(
|
||||
await FlatListComponentScreen.checkFlatListInvertedScreenIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await FlatListComponentScreen.clickFlatListInvertedButton();
|
||||
expect(await FlatListComponentScreen.checkPizzaIsDisplayed()).toBeTruthy();
|
||||
await FlatListComponentScreen.clickToggleTrueButton();
|
||||
expect(await FlatListComponentScreen.checkPizzaIsDisplayed()).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Test is checking onViewableItemsChanges component', () => {
|
||||
test('Should view properly the pizza element', async () => {
|
||||
expect(
|
||||
await ComponentsScreen.checkFlatListComponentIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await ComponentsScreen.clickFlatListComponent();
|
||||
await FlatListComponentScreen.scrollUntilOnViewableItemsChangedIsDisplayed();
|
||||
expect(
|
||||
await FlatListComponentScreen.checkFlatListOnViewableItemsChangedScreenIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await FlatListComponentScreen.clickFlatListOnViewableItemsChangedButton();
|
||||
expect(await FlatListComponentScreen.checkPizzaIsDisplayed()).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Test is checking FlatList with Separators component', () => {
|
||||
test('Should view properly the separator element', async () => {
|
||||
expect(
|
||||
await ComponentsScreen.checkFlatListComponentIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await ComponentsScreen.clickFlatListComponent();
|
||||
await FlatListComponentScreen.scrollUntilNestedIsDisplayed();
|
||||
expect(
|
||||
await FlatListComponentScreen.checkFlatListWithSeparatorsScreenIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await FlatListComponentScreen.clickFlatListWithSeparatorsButton();
|
||||
expect(
|
||||
await FlatListComponentScreen.checkSeparatorIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Test is checking multicolumn component', () => {
|
||||
test('Should view properly the list header element', async () => {
|
||||
expect(
|
||||
await ComponentsScreen.checkFlatListComponentIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await ComponentsScreen.clickFlatListComponent();
|
||||
await FlatListComponentScreen.scrollUntilNestedIsDisplayed();
|
||||
expect(
|
||||
await FlatListComponentScreen.checkFlatListMultiColumnScreenIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await FlatListComponentScreen.clickFlatListMultiColumnButton();
|
||||
expect(
|
||||
await FlatListComponentScreen.checkListHeaderIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Test is checking sticky headers component', () => {
|
||||
test('Should view properly the sticky pizza element', async () => {
|
||||
expect(
|
||||
await ComponentsScreen.checkFlatListComponentIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await ComponentsScreen.clickFlatListComponent();
|
||||
await FlatListComponentScreen.scrollUntilNestedIsDisplayed();
|
||||
expect(
|
||||
await FlatListComponentScreen.checkFlatListStickyHeadersScreenIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await FlatListComponentScreen.clickFlatListStickyHeadersButton();
|
||||
expect(
|
||||
await FlatListComponentScreen.checkStickyPizzaIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Test is checking nested component', () => {
|
||||
test('Should view properly the nested header element', async () => {
|
||||
expect(
|
||||
await ComponentsScreen.checkFlatListComponentIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await ComponentsScreen.clickFlatListComponent();
|
||||
await FlatListComponentScreen.scrollUntilNestedIsDisplayed();
|
||||
expect(
|
||||
await FlatListComponentScreen.checkFlatListNestedScreenIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await FlatListComponentScreen.clickFlatListNestedButton();
|
||||
expect(
|
||||
await FlatListComponentScreen.checkNestedHeaderIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
* @format
|
||||
*/
|
||||
|
||||
const {ComponentsScreen} = require('../../screens/components.screen.js');
|
||||
const {
|
||||
JSResponderHandlerComponentScreen,
|
||||
} = require('../../screens/components/jsResponderHandlerComponent.screen.js');
|
||||
|
||||
// fixed variables
|
||||
const roweZeroText = 'I am row 0';
|
||||
|
||||
describe('Test is checking row zero JSResponderHandler component', () => {
|
||||
test('Should view properly row zero element', async () => {
|
||||
await JSResponderHandlerComponentScreen.scrollUntilJSResponderHandlerComponentIsDisplayed();
|
||||
expect(
|
||||
await ComponentsScreen.checkJSResponderHandlerComponentIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await ComponentsScreen.clickJSResponderHandlerComponent();
|
||||
expect(
|
||||
await JSResponderHandlerComponentScreen.checkRowZeroLabelIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
expect(await JSResponderHandlerComponentScreen.getRowZeroText()).toContain(
|
||||
roweZeroText,
|
||||
);
|
||||
});
|
||||
});
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
* @format
|
||||
*/
|
||||
|
||||
const {ComponentsScreen} = require('../../screens/components.screen.js');
|
||||
const {
|
||||
KeyboardAvoidingViewComponentScreen,
|
||||
} = require('../../screens/components/keyboardAvoidingViewComponent.screen.js');
|
||||
|
||||
// fixed variables
|
||||
const registerText = 'Successfully Registered!';
|
||||
|
||||
describe('Test is checking keyboardAvoidingView component', () => {
|
||||
test('Should view properly successfully registered text', async () => {
|
||||
await KeyboardAvoidingViewComponentScreen.scrollUntilKeyboardAvoidingViewComponentIsDisplayed();
|
||||
expect(
|
||||
await ComponentsScreen.checkKeyboardAvoidingViewComponentIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await ComponentsScreen.clickKeyboardAvoidingViewComponent();
|
||||
expect(
|
||||
await KeyboardAvoidingViewComponentScreen.checkBtnDifferentBehaviorsOpenExampleIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await KeyboardAvoidingViewComponentScreen.clickDifferentBehaviorsOpenExampleButton();
|
||||
expect(
|
||||
await KeyboardAvoidingViewComponentScreen.checkBtnRegisterIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await KeyboardAvoidingViewComponentScreen.clickRegisterButton();
|
||||
expect(
|
||||
await KeyboardAvoidingViewComponentScreen.getRegisterAlertText(),
|
||||
).toContain(registerText);
|
||||
await KeyboardAvoidingViewComponentScreen.clickOkButton();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
* @format
|
||||
*/
|
||||
|
||||
const {ComponentsScreen} = require('../../screens/components.screen.js');
|
||||
const {
|
||||
ModalComponentScreen,
|
||||
} = require('../../screens/components/modalComponent.screen.js');
|
||||
|
||||
describe('Test is checking modal component', () => {
|
||||
test('Should view show modal element', async () => {
|
||||
await ModalComponentScreen.scrollUntilModalComponentIsDisplayed();
|
||||
expect(
|
||||
await ComponentsScreen.checkModalComponentIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await ComponentsScreen.clickModalComponent();
|
||||
expect(await ModalComponentScreen.checkShowModalIsDisplayed()).toBeTruthy();
|
||||
await ModalComponentScreen.clickShowModalButton();
|
||||
expect(
|
||||
await ModalComponentScreen.checkModalAnimationTypeIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await ModalComponentScreen.clickCloseButton();
|
||||
expect(await ModalComponentScreen.checkShowModalIsDisplayed()).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
* @format
|
||||
*/
|
||||
|
||||
const {ComponentsScreen} = require('../../screens/components.screen.js');
|
||||
const {
|
||||
NewAppComponentScreen,
|
||||
} = require('../../screens/components/newAppComponent.screen.js');
|
||||
|
||||
describe('Test is checking new app screen component', () => {
|
||||
test('Should view new app header element', async () => {
|
||||
await NewAppComponentScreen.scrollUntilNewAppHeaderComponentIsDisplayed();
|
||||
expect(
|
||||
await ComponentsScreen.checkNewAppScreenComponentIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await ComponentsScreen.clickNewAppScreenComponent();
|
||||
expect(
|
||||
await NewAppComponentScreen.checkNewAppHeaderIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
* @format
|
||||
*/
|
||||
|
||||
const {ComponentsScreen} = require('../../screens/components.screen.js');
|
||||
const {
|
||||
PressableComponentScreen,
|
||||
} = require('../../screens/components/pressableComponent.screen.js');
|
||||
|
||||
// fixed variables
|
||||
const onPressText = 'onPress';
|
||||
|
||||
describe('Test is checking pressable component', () => {
|
||||
test('Should view onPress text', async () => {
|
||||
await PressableComponentScreen.scrollUntilPressableComponentIsDisplayed();
|
||||
expect(
|
||||
await ComponentsScreen.checkPressableComponentIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await ComponentsScreen.clickPressableComponent();
|
||||
expect(
|
||||
await PressableComponentScreen.checkPressMeHeaderIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await PressableComponentScreen.clickPressMeButton();
|
||||
expect(
|
||||
await PressableComponentScreen.checkOnPressIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
expect(await PressableComponentScreen.getOnPressText()).toContain(
|
||||
onPressText,
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
* @format
|
||||
*/
|
||||
|
||||
const {ComponentsScreen} = require('../../screens/components.screen.js');
|
||||
const {
|
||||
RefreshControlComponentScreen,
|
||||
} = require('../../screens/components/refreshControlComponent.screen.js');
|
||||
|
||||
describe('Test is checking RefreshControl component', () => {
|
||||
test('Should view initial row element', async () => {
|
||||
await RefreshControlComponentScreen.scrollUntilRefreshControlComponentIsDisplayed();
|
||||
expect(
|
||||
await ComponentsScreen.checkRefreshControlComponentIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await ComponentsScreen.clickRefreshControlComponent();
|
||||
expect(
|
||||
await RefreshControlComponentScreen.checkInitialRowIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
* @format
|
||||
*/
|
||||
|
||||
const {ComponentsScreen} = require('../../screens/components.screen.js');
|
||||
const {
|
||||
ScrollViewSimpleExampleComponentScreen,
|
||||
} = require('../../screens/components/scrollViewSimpleExampleComponent.screen.js');
|
||||
|
||||
describe('Test is checking ScrollVIewSimpleExample component', () => {
|
||||
test('Should view scroll view item element', async () => {
|
||||
await ScrollViewSimpleExampleComponentScreen.scrollUntilScrollViewSimpleExampleComponentIsDisplayed();
|
||||
expect(
|
||||
await ComponentsScreen.checkScrollViewSimpleExampleComponentIsDisplayed(),
|
||||
).toBeTruthy();
|
||||
await ComponentsScreen.clickScrollViewSimpleExampleComponent();
|
||||
expect(
|
||||
await ScrollViewSimpleExampleComponentScreen.checkScrollViewItemsDisplayed(),
|
||||
).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -73,6 +73,8 @@ exports.examples = [
|
||||
<ActivityIndicator
|
||||
style={[styles.centering, styles.gray]}
|
||||
color="white"
|
||||
testID="default_activity_indicator"
|
||||
accessibilityLabel="Wait for content to load!"
|
||||
/>
|
||||
);
|
||||
},
|
||||
|
||||
@@ -158,6 +158,7 @@ class FlatListExample extends React.PureComponent<Props, State> {
|
||||
<View style={styles.searchRow}>
|
||||
<View style={styles.options}>
|
||||
<PlainInput
|
||||
testID="search_bar_flat_list"
|
||||
onChangeText={this._onChangeFilterText}
|
||||
placeholder="Search..."
|
||||
value={this.state.filterText}
|
||||
|
||||
@@ -33,7 +33,9 @@ const Separator =
|
||||
styles.separator,
|
||||
{backgroundColor: highlighted ? highlightColor : defaultColor},
|
||||
]}>
|
||||
<Text style={styles.separatorText}>{text}</Text>
|
||||
<Text testID="flat_list_separator" style={styles.separatorText}>
|
||||
{text}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ exports.examples = [
|
||||
views[i] = (
|
||||
<View key={i} style={styles.row} collapsable={false}>
|
||||
<View style={styles.touchable_area} collapsable={false}>
|
||||
<Text>I am row {i}</Text>
|
||||
<Text testID="row_js_responder_handler">I am row {i}</Text>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
|
||||
@@ -37,7 +37,11 @@ const TextInputForm = () => {
|
||||
<TextInput placeholder="Username" style={styles.textInput} />
|
||||
<TextInput placeholder="Password" style={styles.textInput} />
|
||||
<TextInput placeholder="Confirm Password" style={styles.textInput} />
|
||||
<Button title="Register" onPress={onButtonPress} />
|
||||
<Button
|
||||
testID="register_button"
|
||||
title="Register"
|
||||
onPress={onButtonPress}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
@@ -114,7 +118,9 @@ const KeyboardAvoidingViewBehaviour = () => {
|
||||
</Modal>
|
||||
<View>
|
||||
<Pressable onPress={() => setModalOpen(true)}>
|
||||
<Text>Open Example</Text>
|
||||
<Text testID="keyboard_avoiding_view_behaviors_open">
|
||||
Open Example
|
||||
</Text>
|
||||
</Pressable>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -224,7 +224,7 @@ function ModalPresentation() {
|
||||
onOrientationChange={onOrientationChange}>
|
||||
<View style={styles.modalContainer}>
|
||||
<View style={styles.modalInnerContainer}>
|
||||
<Text>
|
||||
<Text testID="modal_animationType_text">
|
||||
This modal was presented with animationType: '
|
||||
{props.animationType}'
|
||||
</Text>
|
||||
|
||||
@@ -48,7 +48,9 @@ function ContentPress() {
|
||||
setTimesPressed(current => current + 1);
|
||||
}}>
|
||||
{({pressed}) => (
|
||||
<Text style={styles.text}>{pressed ? 'Pressed!' : 'Press Me'}</Text>
|
||||
<Text testID="one_press_me_button" style={styles.text}>
|
||||
{pressed ? 'Pressed!' : 'Press Me'}
|
||||
</Text>
|
||||
)}
|
||||
</Pressable>
|
||||
</View>
|
||||
|
||||
@@ -45,7 +45,7 @@ class Row extends React.Component {
|
||||
return (
|
||||
<TouchableWithoutFeedback onPress={this._onClick}>
|
||||
<View style={styles.row}>
|
||||
<Text style={styles.text}>
|
||||
<Text testID="refresh_control_row" style={styles.text}>
|
||||
{this.props.data.text + ' (' + this.props.data.clicks + ' clicks)'}
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
@@ -30,7 +30,7 @@ class ScrollViewSimpleExample extends React.Component<{...}> {
|
||||
for (let i = 0; i < nItems; i++) {
|
||||
items[i] = (
|
||||
<TouchableOpacity key={i} style={styles}>
|
||||
<Text>{'Item ' + i}</Text>
|
||||
<Text testID="scroll_view_item">{'Item ' + i}</Text>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user