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

initial maestro setup #49861

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
34 changes: 34 additions & 0 deletions maestro-tests/native/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
appId: ${APP_ID}
name: Default native test flow
onFlowStart:
- startRecording: recording
onFlowComplete:
- stopRecording
---
- launchApp
- extendedWaitUntil:
visible:
id: "floatingActionButton"
timeout: 30000
- tapOn:
id: "floatingActionButton"
- assertVisible: 'Start chat'
- assertVisible: 'Track expense'
- assertVisible: 'Submit expense'
- tapOn: 'Start chat'
- assertVisible: 'Name, email, or phone number'
- inputText: 'juliankobrynski@gmail'
- assertVisible: '[email protected]'
- tapOn: '[email protected]'
- assertVisible: 'Write something...'
- assertVisible:
id: "composer"
- tapOn:
id: "composer"
- inputText: 'Hello from Maestro!'
- assertVisible: 'Hello from Maestro!'
- assertVisible:
id: "sendButton"
- tapOn:
id: "sendButton"
- killApp
18 changes: 18 additions & 0 deletions maestro-tests/web/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
appId: "https://dev.new.expensify.com:8082"
# appId: ${APP_ID}
---
- launchApp
- assertVisible: 'Phone or email'
- tapOn: 'Continue'
- assertVisible: 'Please enter an email or phone number'
- tapOn: 'Phone or email'
- inputText: 'juliankobrynski@gmail'
- tapOn: 'Continue'
- assertVisible: 'The email entered is invalid. Please fix the format and try again.'
- tapOn: 'juliankobrynski@gmail'
- inputText: '.com'
- tapOn: 'Continue'
- assertVisible: 'Please enter the magic code sent to [email protected]. It should arrive within a minute or two.'
- inputText: '123456'
- assertVisible: 'Incorrect magic code. Please try again or request a new code.'
- killApp
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 17 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@
"react-compiler-healthcheck": "react-compiler-healthcheck --verbose",
"react-compiler-healthcheck-test": "react-compiler-healthcheck --verbose &> react-compiler-output.txt",
"generate-search-parser": "peggy --format es -o src/libs/SearchParser/searchParser.js src/libs/SearchParser/searchParser.peggy ",
"web:prod": "http-server ./dist --cors"
"web:prod": "http-server ./dist --cors",
"test:e2e:android": "bash ./scripts/run-maestro-tests.sh android",
"test:e2e:ios": "bash ./scripts/run-maestro-tests.sh ios",
"test:e2e:web": "bash ./scripts/run-maestro-tests.sh web"
},
"dependencies": {
"@dotlottie/react-player": "^1.6.3",
Expand Down Expand Up @@ -181,15 +184,6 @@
"react-window": "^1.8.9"
},
"devDependencies": {
"@fullstory/babel-plugin-react-native": "^1.2.1",
"@kie/act-js": "^2.6.2",
"@kie/mock-github": "2.0.1",
"@vue/preload-webpack-plugin": "^2.0.0",
"jest-expo": "51.0.4",
"jest-when": "^3.5.2",
"react-compiler-runtime": "file:./lib/react-compiler-runtime",
"semver": "7.5.2",
"xlsx": "file:vendor/xlsx-0.20.3.tgz",
"@actions/core": "1.10.0",
"@actions/github": "5.1.1",
"@babel/core": "^7.20.0",
Expand All @@ -198,6 +192,7 @@
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
"@babel/plugin-proposal-private-methods": "^7.18.6",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@babel/plugin-transform-class-properties": "^7.25.4",
"@babel/preset-env": "^7.20.0",
"@babel/preset-flow": "^7.12.13",
"@babel/preset-react": "^7.10.4",
Expand All @@ -209,7 +204,10 @@
"@dword-design/eslint-plugin-import-alias": "^5.0.0",
"@electron/notarize": "^2.1.0",
"@fullstory/babel-plugin-annotate-react": "^2.3.0",
"@fullstory/babel-plugin-react-native": "^1.2.1",
"@jest/globals": "^29.5.0",
"@kie/act-js": "^2.6.2",
"@kie/mock-github": "2.0.1",
"@ngneat/falso": "^7.1.1",
"@octokit/core": "4.0.4",
"@octokit/plugin-paginate-rest": "3.1.0",
Expand Down Expand Up @@ -258,14 +256,14 @@
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/parser": "^7.13.1",
"@vercel/ncc": "0.38.1",
"@vue/preload-webpack-plugin": "^2.0.0",
"@welldone-software/why-did-you-render": "7.0.1",
"ajv-cli": "^5.0.0",
"babel-jest": "29.4.1",
"babel-loader": "^9.1.3",
"babel-plugin-module-resolver": "^5.0.0",
"babel-plugin-react-compiler": "0.0.0-experimental-334f00b-20240725",
"babel-plugin-react-native-web": "^0.18.7",
"@babel/plugin-transform-class-properties": "^7.25.4",
"babel-plugin-transform-remove-console": "^6.9.4",
"clean-webpack-plugin": "^4.0.0",
"concurrently": "^8.2.2",
Expand All @@ -283,19 +281,22 @@
"eslint-plugin-deprecation": "^3.0.0",
"eslint-plugin-jest": "^28.6.0",
"eslint-plugin-jsdoc": "^46.2.6",
"eslint-plugin-lodash": "^7.4.0",
"eslint-plugin-react-compiler": "0.0.0-experimental-9ed098e-20240725",
"eslint-plugin-react-native-a11y": "^3.3.0",
"eslint-plugin-storybook": "^0.8.0",
"eslint-plugin-testing-library": "^6.2.2",
"eslint-plugin-you-dont-need-lodash-underscore": "^6.14.0",
"eslint-plugin-lodash": "^7.4.0",
"html-webpack-plugin": "^5.5.0",
"http-server": "^14.1.1",
"husky": "^9.1.6",
"jest": "29.4.1",
"jest-circus": "29.4.1",
"jest-cli": "29.4.1",
"jest-environment-jsdom": "^29.4.1",
"jest-expo": "51.0.4",
"jest-transformer-svg": "^2.0.1",
"jest-when": "^3.5.2",
"link": "^2.1.1",
"memfs": "^4.6.0",
"onchange": "^7.1.0",
Expand All @@ -306,10 +307,12 @@
"prettier": "^2.8.8",
"pusher-js-mock": "^0.3.3",
"react-compiler-healthcheck": "^0.0.0-experimental-ab3118d-20240725",
"react-compiler-runtime": "file:./lib/react-compiler-runtime",
"react-is": "^18.3.1",
"react-native-clean-project": "^4.0.0-alpha4.0",
"react-test-renderer": "18.3.1",
"reassure": "^1.0.0-rc.4",
"semver": "7.5.2",
"setimmediate": "^1.0.5",
"shellcheck": "^1.1.0",
"source-map": "^0.7.4",
Expand All @@ -326,7 +329,8 @@
"webpack-bundle-analyzer": "^4.5.0",
"webpack-cli": "^5.0.4",
"webpack-dev-server": "^5.0.4",
"webpack-merge": "^5.8.0"
"webpack-merge": "^5.8.0",
"xlsx": "file:vendor/xlsx-0.20.3.tgz"
},
"overrides": {
"react-native": "0.75.2",
Expand Down
Binary file added recording.mp4
Copy link

Choose a reason for hiding this comment

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

:)

Binary file not shown.
58 changes: 58 additions & 0 deletions scripts/run-maestro-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash

trap 'exit' INT

PLATFORM=${1:-}

# Validate passed platform
case $PLATFORM in
ios | android | web )
;;

*)
echo "Error! You must pass either 'android', 'ios', or 'web'"
echo ""
exit 1
;;
esac

if [ "$PLATFORM" == "ios" ]; then
APPID="com.expensify.chat.dev"
# allTestFiles=$(ls maestro-tests/*.yaml maestro-tests/basic_example/native.yaml)
allTestFiles=$(ls maestro-tests/native/*.yaml)
elif [ "$PLATFORM" == "android" ]; then
APPID="com.expensify.chat.dev"
# allTestFiles=$(ls maestro-tests/native/*.yaml)
allTestFiles=$(ls maestro-tests/native/test.yaml)
else
APPID="https://dev.new.expensify.com:8082"
# APPID="https://127.0.0.1:8082"
allTestFiles=$(ls maestro-tests/web/*.yaml)
fi

failedTests=()
for file in $allTestFiles
do
if ! maestro test "$file" -e APP_ID="$APPID";
then
echo "Test ${file} failed. Retrying in 30 seconds..."
sleep 30
if ! maestro test "$file" -e APP_ID="$APPID";
then
echo "Test ${file} failed again. Retrying for the last time in 120 seconds..."
sleep 120
if ! maestro test "$file" -e APP_ID="$APPID";
then
failedTests+=("$file")
fi
fi
fi
done

if [ ${#failedTests[@]} -eq 0 ]; then
exit 0
else
echo "These tests failed:"
printf '%s\n' "${failedTests[@]}"
exit 1
fi
4 changes: 4 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ LogBox.ignoreLogs([
// We silence this warning for now and will address all the places where it happens separately.
// Then we can remove this line so the problem does not occur in the future.
'[Reanimated] Tried to modify key `current`',
'Function components cannot be given refs',
'TRenderEngineProvider',
'Require cycle:',
'No native ExponentConstants',
]);

const fill = {flex: 1};
Expand Down
7 changes: 6 additions & 1 deletion src/components/FloatingActionButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ type FloatingActionButtonProps = {

/* An accessibility role for the button */
role: Role;

testID?: string;
Copy link

Choose a reason for hiding this comment

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

Suggested change
testID?: string;
testID?: ViewProps["testID"];

};

function FloatingActionButton({onPress, isActive, accessibilityLabel, role}: FloatingActionButtonProps, ref: ForwardedRef<HTMLDivElement | View | Text>) {
function FloatingActionButton({onPress, isActive, accessibilityLabel, role, testID}: FloatingActionButtonProps, ref: ForwardedRef<HTMLDivElement | View | Text>) {
const {success, buttonDefaultBG, textLight, textDark} = useTheme();
const styles = useThemeStyles();
const borderRadius = styles.floatingActionButton.borderRadius;
Expand Down Expand Up @@ -113,6 +115,9 @@ function FloatingActionButton({onPress, isActive, accessibilityLabel, role}: Flo
onLongPress={() => {}}
role={role}
shouldUseHapticsOnLongPress={false}
testID={testID}
id={testID}
accessible
>
<Animated.View style={[styles.floatingActionButton, animatedStyle]}>
<Svg
Expand Down
2 changes: 2 additions & 0 deletions src/components/Pressable/PressableWithFeedback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ type PressableWithFeedbackProps = PressableProps & {

/** The color of the underlay that will show through when the Pressable is active. */
underlayColor?: Color;

testID?: string;
};

function PressableWithFeedback(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,8 @@ function ComposerWithSuggestions(
<View style={[StyleUtils.getContainerComposeStyles(), styles.textInputComposeBorder]}>
<Composer
checkComposerVisibility={checkComposerVisibility}
autoFocus={!!shouldAutoFocus}
// autoFocus={!!shouldAutoFocus}
autoFocus
multiline
ref={setTextInputRef}
placeholder={inputPlaceholder}
Expand Down
2 changes: 2 additions & 0 deletions src/pages/home/report/ReportActionCompose/SendButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ function SendButton({isDisabled: isDisabledProp, handleSendMessage}: SendButtonP
]}
role={CONST.ROLE.BUTTON}
accessibilityLabel={translate('common.send')}
accessible
testID="sendButton"
>
{({pressed}) => (
<Icon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ function FloatingActionButtonAndPopover(
isActive={isCreateMenuActive}
ref={fabRef}
onPress={toggleCreateMenu}
testID="floatingActionButton"
/>
</View>
);
Expand Down
Loading