Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e: added money request flow e2e test #52751

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3af050b
e2e: added money request flow e2e test
kirillzyusko Nov 12, 2024
c55d0de
fix: nativeID -> testID
kirillzyusko Nov 19, 2024
0994d6f
refactor: removed unused code
kirillzyusko Nov 19, 2024
513340f
fix: flat test structure
kirillzyusko Nov 19, 2024
f3ed8a1
fix: clear previous field to make sure you always can type a new one
kirillzyusko Nov 19, 2024
2123207
fix: remove hardcoded intervals from the test
kirillzyusko Nov 19, 2024
4913fdc
fix: TS types
kirillzyusko Nov 19, 2024
606ac25
fix: ci
kirillzyusko Nov 19, 2024
3b54445
fix: speed up clear command
kirillzyusko Nov 21, 2024
e8ceb29
Merge branch 'main' of https://github.com/Expensify/App into e2e/mone…
perunt Dec 17, 2024
7e14df1
update BaseTextInput
perunt Dec 17, 2024
128b4e7
clean duplications
perunt Dec 18, 2024
a41b9bb
fix: duplicated identifiers
kirillzyusko Dec 18, 2024
335eb12
fix: move OPEN_SUBMIT_EXPENSE_CONTACT start to app code
kirillzyusko Dec 18, 2024
04cade1
fix: move OPEN_SUBMIT_EXPENSE_APPROVE start to app code
kirillzyusko Dec 18, 2024
ab157c0
fix: no external navigation dispatches
kirillzyusko Dec 18, 2024
c2f9221
Merge branch 'main' into e2e/money-request-flow
kirillzyusko Dec 18, 2024
545e896
fix: ci
kirillzyusko Dec 19, 2024
9d39e16
docs: update documentation
kirillzyusko Dec 19, 2024
951543c
Merge branch 'main' into e2e/money-request-flow
kirillzyusko Dec 20, 2024
1b5e9d7
fix: post merge fixes
kirillzyusko Dec 20, 2024
9e660ba
fix: new eslint rules
kirillzyusko Dec 20, 2024
e4c77b7
fix: new eslint rules
kirillzyusko Dec 20, 2024
ef04655
fix: new eslint rules
kirillzyusko Dec 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1304,6 +1304,9 @@ const CONST = {
SIDEBAR_LOADED: 'sidebar_loaded',
LOAD_SEARCH_OPTIONS: 'load_search_options',
SEND_MESSAGE: 'send_message',
OPEN_SUBMIT_EXPENSE: 'open_submit_expense',
OPEN_SUBMIT_EXPENSE_CONTACT: 'open_submit_expense_contact',
OPEN_SUBMIT_EXPENSE_APPROVE: 'open_submit_expense_approve',
Comment on lines +1324 to +1326
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adhorodyski any feedback here on the event names?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking into it

COLD: 'cold',
WARM: 'warm',
REPORT_ACTION_ITEM_LAYOUT_DEBOUNCE_TIME: 1500,
Expand Down
1 change: 1 addition & 0 deletions src/components/BigNumberPad.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ function BigNumberPad({numberPressed, longPressHandlerStateChanged = () => {}, i
e.preventDefault();
}}
isLongPressDisabled={isLongPressDisabled}
testID={`button_${column}`}
/>
);
})}
Expand Down
5 changes: 5 additions & 0 deletions src/components/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ type ButtonProps = Partial<ChildrenProps> & {

/** Whether the Enter keyboard listening is active whether or not the screen that contains the button is focused */
isPressOnEnterActive?: boolean;

/** The testID of the button. Used to locate this view in end-to-end tests. */
testID?: string;
};

type KeyboardShortcutComponentProps = Pick<ButtonProps, 'isDisabled' | 'isLoading' | 'onPress' | 'pressOnEnter' | 'allowBubble' | 'enterKeyEventListenerPriority' | 'isPressOnEnterActive'>;
Expand Down Expand Up @@ -242,6 +245,7 @@ function Button(
link = false,
isContentCentered = false,
isPressOnEnterActive,
testID,
...rest
}: ButtonProps,
ref: ForwardedRef<View>,
Expand Down Expand Up @@ -410,6 +414,7 @@ function Button(
hoverDimmingValue={1}
onHoverIn={() => setIsHovered(true)}
onHoverOut={() => setIsHovered(false)}
testID={testID}
>
{renderContent()}
{isLoading && (
Expand Down
5 changes: 5 additions & 0 deletions src/components/MoneyRequestAmountInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ type MoneyRequestAmountInputProps = {

/** The width of inner content */
contentWidth?: number;

/** The testID of the input. Used to locate this view in end-to-end tests. */
testID?: string;
};

type Selection = {
Expand Down Expand Up @@ -127,6 +130,7 @@ function MoneyRequestAmountInput(
shouldKeepUserInput = false,
autoGrow = true,
contentWidth,
testID,
...props
}: MoneyRequestAmountInputProps,
forwardedRef: ForwardedRef<BaseTextInputRef>,
Expand Down Expand Up @@ -337,6 +341,7 @@ function MoneyRequestAmountInput(
onMouseDown={handleMouseDown}
onMouseUp={handleMouseUp}
contentWidth={contentWidth}
testID={testID}
/>
);
}
Expand Down
15 changes: 9 additions & 6 deletions src/components/Pressable/GenericPressable/index.e2e.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
import React, {forwardRef, useEffect} from 'react';
import {DeviceEventEmitter} from 'react-native';
import GenericPressable from './implementation';
import type {PressableRef} from './types';
import type PressableProps from './types';

const pressableRegistry = new Map<string, PressableProps>();

function getPressableProps(nativeID: string): PressableProps | undefined {
return pressableRegistry.get(nativeID);
function getPressableProps(testId: string): PressableProps | undefined {
return pressableRegistry.get(testId);
}

function E2EGenericPressableWrapper(props: PressableProps, ref: PressableRef) {
useEffect(() => {
const nativeId = props.nativeID;
if (!nativeId) {
const testId = props.testID;
if (!testId) {
return;
}
console.debug(`[E2E] E2EGenericPressableWrapper: Registering pressable with nativeID: ${nativeId}`);
pressableRegistry.set(nativeId, props);
console.debug(`[E2E] E2EGenericPressableWrapper: Registering pressable with testID: ${testId}`);
pressableRegistry.set(testId, props);

DeviceEventEmitter.emit('onBecameVisible', testId);
}, [props]);

return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/Search/SearchRouter/SearchButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function SearchButton({style}: SearchButtonProps) {
return (
<Tooltip text={translate('common.search')}>
<PressableWithoutFeedback
nativeID="searchButton"
testID="searchButton"
accessibilityLabel={translate('common.search')}
style={[styles.flexRow, styles.touchableButtonImage, style]}
onPress={Session.checkIfActionIsAllowed(() => {
Expand Down
2 changes: 2 additions & 0 deletions src/components/SelectionList/BaseListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function BaseListItem<TItem extends ListItem>({
onFocus = () => {},
hoverStyle,
onLongPressRow,
testID,
}: BaseListItemProps<TItem>) {
const theme = useTheme();
const styles = useThemeStyles();
Expand Down Expand Up @@ -106,6 +107,7 @@ function BaseListItem<TItem extends ListItem>({
onMouseLeave={handleMouseLeave}
tabIndex={item.tabIndex}
wrapperStyle={pressableWrapperStyle}
testID={testID}
>
<View
style={[
Expand Down
1 change: 1 addition & 0 deletions src/components/SelectionList/InviteMemberListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ function InviteMemberListItem<TItem extends ListItem>({
onFocus={onFocus}
shouldSyncFocus={shouldSyncFocus}
shouldDisplayRBR={!shouldShowCheckBox}
testID={item.text}
>
{(hovered?: boolean) => (
<>
Expand Down
2 changes: 2 additions & 0 deletions src/components/SelectionList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ type BaseListItemProps<TItem extends ListItem> = CommonListItemProps<TItem> & {
hoverStyle?: StyleProp<ViewStyle>;
/** Errors that this user may contain */
shouldDisplayRBR?: boolean;
/** Test ID of the component. Used to locate this view in end-to-end tests. */
testID?: string;
};

type UserListItemProps<TItem extends ListItem> = ListItemProps<TItem> & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import RNMarkdownTextInput from '@components/RNMarkdownTextInput';
import type {AnimatedTextInputRef} from '@components/RNTextInput';
import RNTextInput from '@components/RNTextInput';
import Text from '@components/Text';
import type {BaseTextInputProps, BaseTextInputRef} from '@components/TextInput/BaseTextInput/types';
import * as styleConst from '@components/TextInput/styleConst';
import TextInputClearButton from '@components/TextInput/TextInputClearButton';
import TextInputLabel from '@components/TextInput/TextInputLabel';
Expand All @@ -26,7 +27,6 @@ import isInputAutoFilled from '@libs/isInputAutoFilled';
import useNativeDriver from '@libs/useNativeDriver';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import type {BaseTextInputProps, BaseTextInputRef} from './types';

function BaseTextInput(
{
Expand Down
Loading
Loading