diff --git a/dev-packages/e2e-tests/maestro/feedback.yml b/dev-packages/e2e-tests/maestro/feedback.yml new file mode 100644 index 0000000000..ce7d79b89d --- /dev/null +++ b/dev-packages/e2e-tests/maestro/feedback.yml @@ -0,0 +1,19 @@ +appId: ${APP_ID} +jsEngine: graaljs +--- +- runFlow: utils/launchTestAppClear.yml + + +# The following tests are happy path tests for the feedback widget on both iOS and Android. +# They verify that the feedback form can be opened, filled out, and submitted successfully. +# The tests are separate because iOS tests work better with `testID` and Android tests work better with `text`. + +- runFlow: + file: feedback/happyFlow-ios.yml + when: + platform: iOS + +- runFlow: + file: feedback/happyFlow-android.yml + when: + platform: Android diff --git a/dev-packages/e2e-tests/maestro/feedback/happyFlow-android.yml b/dev-packages/e2e-tests/maestro/feedback/happyFlow-android.yml new file mode 100644 index 0000000000..221b0cbf84 --- /dev/null +++ b/dev-packages/e2e-tests/maestro/feedback/happyFlow-android.yml @@ -0,0 +1,39 @@ +# This is a happy path test for the feedback widget on Android. +# It verifies that the feedback form can be opened, filled out, and submitted successfully +appId: ${APP_ID} +jsEngine: graaljs +--- + +# Show feedback button +- tapOn: 'Feedback' + +# Open feedback widget +- tapOn: 'Report a Bug' + +# Assert that the feedback form is visible +- extendedWaitUntil: + visible: 'Report a Bug' + timeout: 5_000 + +# Fill out name field +- tapOn: 'Your Name' +- inputText: 'John Doe' + +# Fill out email field +- tapOn: 'your.email@example.org' +- inputText: 'test@email.com' + +# Fill out message field +- tapOn: "What's the bug? What did you expect?" +- inputText: 'This is a test feedback message from CI e2e tests' + +# Submit feedback +- scrollUntilVisible: + element: + text: 'Send Bug Report' +- tapOn: 'Send Bug Report' +- assertVisible: 'Thank you for your report!' +- tapOn: 'OK' + +# Verify feedback form is closed and the home screen is visible +- assertVisible: 'Welcome to React Native' diff --git a/dev-packages/e2e-tests/maestro/feedback/happyFlow-ios.yml b/dev-packages/e2e-tests/maestro/feedback/happyFlow-ios.yml new file mode 100644 index 0000000000..7f8c3340b1 --- /dev/null +++ b/dev-packages/e2e-tests/maestro/feedback/happyFlow-ios.yml @@ -0,0 +1,45 @@ +# This is a happy path test for the feedback widget on iOS. +# It verifies that the feedback form can be opened, filled out, and submitted successfully +appId: ${APP_ID} +jsEngine: graaljs +--- + +# Show feedback button +- tapOn: 'Feedback' + +# Open feedback widget +- tapOn: + id: 'sentry-feedback-button' + +# Assert that the feedback form is visible +- extendedWaitUntil: + visible: + id: 'sentry-feedback-form-title' + timeout: 5_000 + +# Fill out name field +- tapOn: + id: 'sentry-feedback-name-input' +- inputText: 'John Doe' + +# Fill out email field +- tapOn: + id: 'sentry-feedback-email-input' +- inputText: 'test@email.com' + +# Fill out message field +- tapOn: + id: 'sentry-feedback-message-input' +- inputText: 'This is a test feedback message from CI e2e tests' + +# Submit feedback +- scrollUntilVisible: + element: + id: 'sentry-feedback-submit-button' +- tapOn: + id: 'sentry-feedback-submit-button' +- assertVisible: 'Thank you for your report!' +- tapOn: 'OK' + +# Verify feedback form is closed and the home screen is visible +- assertVisible: 'Welcome to React Native' diff --git a/dev-packages/e2e-tests/patch-scripts/rn.patch.app.js b/dev-packages/e2e-tests/patch-scripts/rn.patch.app.js index cc0f8ce66e..48660f1a56 100755 --- a/dev-packages/e2e-tests/patch-scripts/rn.patch.app.js +++ b/dev-packages/e2e-tests/patch-scripts/rn.patch.app.js @@ -39,6 +39,7 @@ const e2eComponentPatch = ''; const lastImportRex = /^([^]*)(import\s+[^;]*?;$)/m; const patchRex = '@sentry/react-native'; const headerComponentRex = / m + initPatch) - .replace(headerComponentRex, m => e2eComponentPatch + m); + .replace(headerComponentRex, m => e2eComponentPatch + m) + .replace(exportDefaultRex, 'export default Sentry.wrap(App);'); fs.writeFileSync(appPath, patched); logger.info('Patched RN App.(js|tsx) successfully!'); diff --git a/dev-packages/e2e-tests/src/EndToEndTests.tsx b/dev-packages/e2e-tests/src/EndToEndTests.tsx index 173286e57b..d84108116c 100644 --- a/dev-packages/e2e-tests/src/EndToEndTests.tsx +++ b/dev-packages/e2e-tests/src/EndToEndTests.tsx @@ -62,6 +62,11 @@ const EndToEndTestsScreen = (): JSX.Element => { name: 'Unhandled Promise Rejection', action: async () => await Promise.reject(new Error('Unhandled Promise Rejection')), }, + { + id: 'feedback', + name: 'Feedback', + action: () => Sentry.showFeedbackButton(), + }, { id: 'close', name: 'Close', diff --git a/packages/core/src/js/feedback/FeedbackButton.tsx b/packages/core/src/js/feedback/FeedbackButton.tsx index da27da8344..fbb546db8d 100644 --- a/packages/core/src/js/feedback/FeedbackButton.tsx +++ b/packages/core/src/js/feedback/FeedbackButton.tsx @@ -59,7 +59,7 @@ export class FeedbackButton extends React.Component { accessibilityLabel={text.triggerAriaLabel} > - {text.triggerLabel} + {text.triggerLabel} ); } diff --git a/packages/core/src/js/feedback/FeedbackWidget.tsx b/packages/core/src/js/feedback/FeedbackWidget.tsx index fa4c906408..277d172290 100644 --- a/packages/core/src/js/feedback/FeedbackWidget.tsx +++ b/packages/core/src/js/feedback/FeedbackWidget.tsx @@ -273,7 +273,7 @@ export class FeedbackWidget extends React.Component - {text.formTitle} + {text.formTitle} {config.showBranding && ( this.setState({ name: value })} @@ -306,6 +307,7 @@ export class FeedbackWidget extends React.Component this.setState({ description: value })} @@ -352,7 +355,7 @@ export class FeedbackWidget extends React.Component )} - {text.submitButtonLabel} + {text.submitButtonLabel} diff --git a/packages/core/test/feedback/__snapshots__/FeedbackButton.test.tsx.snap b/packages/core/test/feedback/__snapshots__/FeedbackButton.test.tsx.snap index 5b1ab60eb4..3115f5ccd9 100644 --- a/packages/core/test/feedback/__snapshots__/FeedbackButton.test.tsx.snap +++ b/packages/core/test/feedback/__snapshots__/FeedbackButton.test.tsx.snap @@ -78,6 +78,7 @@ exports[`FeedbackButton matches the snapshot with custom styles 1`] = ` "fontSize": 18, } } + testID="sentry-feedback-button" > Report a Bug @@ -162,6 +163,7 @@ exports[`FeedbackButton matches the snapshot with custom texts 1`] = ` "fontSize": 18, } } + testID="sentry-feedback-button" > Give Feedback @@ -246,6 +248,7 @@ exports[`FeedbackButton matches the snapshot with default configuration 1`] = ` "fontSize": 18, } } + testID="sentry-feedback-button" > Report a Bug diff --git a/packages/core/test/feedback/__snapshots__/FeedbackWidget.test.tsx.snap b/packages/core/test/feedback/__snapshots__/FeedbackWidget.test.tsx.snap index 737269302c..a3841f1597 100644 --- a/packages/core/test/feedback/__snapshots__/FeedbackWidget.test.tsx.snap +++ b/packages/core/test/feedback/__snapshots__/FeedbackWidget.test.tsx.snap @@ -42,6 +42,7 @@ exports[`FeedbackWidget matches the snapshot with custom styles 1`] = ` "fontSize": 20, } } + testID="sentry-feedback-form-title" > Report a Bug @@ -82,6 +83,7 @@ exports[`FeedbackWidget matches the snapshot with custom styles 1`] = ` "height": 50, } } + testID="sentry-feedback-name-input" value="Test User" /> Send Bug Report @@ -276,6 +281,7 @@ exports[`FeedbackWidget matches the snapshot with custom styles and screenshot b "fontSize": 20, } } + testID="sentry-feedback-form-title" > Report a Bug @@ -316,6 +322,7 @@ exports[`FeedbackWidget matches the snapshot with custom styles and screenshot b "height": 50, } } + testID="sentry-feedback-name-input" value="Test User" /> Send Bug Report @@ -573,6 +583,7 @@ exports[`FeedbackWidget matches the snapshot with custom texts 1`] = ` "textAlign": "left", } } + testID="sentry-feedback-form-title" > Feedback Form @@ -618,6 +629,7 @@ exports[`FeedbackWidget matches the snapshot with custom texts 1`] = ` "paddingHorizontal": 10, } } + testID="sentry-feedback-name-input" value="Test User" /> Submit Button Label @@ -838,6 +853,7 @@ exports[`FeedbackWidget matches the snapshot with custom texts and screenshot bu "textAlign": "left", } } + testID="sentry-feedback-form-title" > Feedback Form @@ -883,6 +899,7 @@ exports[`FeedbackWidget matches the snapshot with custom texts and screenshot bu "paddingHorizontal": 10, } } + testID="sentry-feedback-name-input" value="Test User" /> Submit Button Label @@ -1166,6 +1186,7 @@ exports[`FeedbackWidget matches the snapshot with default configuration 1`] = ` "textAlign": "left", } } + testID="sentry-feedback-form-title" > Report a Bug @@ -1211,6 +1232,7 @@ exports[`FeedbackWidget matches the snapshot with default configuration 1`] = ` "paddingHorizontal": 10, } } + testID="sentry-feedback-name-input" value="Test User" /> Send Bug Report @@ -1431,6 +1456,7 @@ exports[`FeedbackWidget matches the snapshot with default configuration and scre "textAlign": "left", } } + testID="sentry-feedback-form-title" > Report a Bug @@ -1476,6 +1502,7 @@ exports[`FeedbackWidget matches the snapshot with default configuration and scre "paddingHorizontal": 10, } } + testID="sentry-feedback-name-input" value="Test User" /> Send Bug Report diff --git a/packages/core/test/feedback/__snapshots__/FeedbackWidgetManager.test.tsx.snap b/packages/core/test/feedback/__snapshots__/FeedbackWidgetManager.test.tsx.snap index 763e9a296d..521573f3ad 100644 --- a/packages/core/test/feedback/__snapshots__/FeedbackWidgetManager.test.tsx.snap +++ b/packages/core/test/feedback/__snapshots__/FeedbackWidgetManager.test.tsx.snap @@ -82,6 +82,7 @@ exports[`FeedbackButtonManager the Feedback Button matches the snapshot with cus "fontSize": 18, } } + testID="sentry-feedback-button" > Report a Bug @@ -171,6 +172,7 @@ exports[`FeedbackButtonManager the Feedback Button matches the snapshot with cus "fontSize": 18, } } + testID="sentry-feedback-button" > Report a Bug @@ -260,6 +262,7 @@ exports[`FeedbackButtonManager the Feedback Button matches the snapshot with def "fontSize": 18, } } + testID="sentry-feedback-button" > Report a Bug @@ -349,6 +352,7 @@ exports[`FeedbackButtonManager the Feedback Button matches the snapshot with def "fontSize": 18, } } + testID="sentry-feedback-button" > Report a Bug @@ -438,6 +442,7 @@ exports[`FeedbackButtonManager the Feedback Button matches the snapshot with def "fontSize": 18, } } + testID="sentry-feedback-button" > Report a Bug @@ -527,6 +532,7 @@ exports[`FeedbackButtonManager the Feedback Button matches the snapshot with sys "fontSize": 18, } } + testID="sentry-feedback-button" > Report a Bug @@ -616,6 +622,7 @@ exports[`FeedbackButtonManager the Feedback Button matches the snapshot with sys "fontSize": 18, } } + testID="sentry-feedback-button" > Report a Bug @@ -748,6 +755,7 @@ exports[`FeedbackButtonManager the Feedback Widget matches the snapshot with cus "textAlign": "left", } } + testID="sentry-feedback-form-title" > Report a Bug @@ -793,6 +801,7 @@ exports[`FeedbackButtonManager the Feedback Widget matches the snapshot with cus "paddingHorizontal": 10, } } + testID="sentry-feedback-name-input" value="" /> Send Bug Report @@ -1096,6 +1108,7 @@ exports[`FeedbackButtonManager the Feedback Widget matches the snapshot with cus "textAlign": "left", } } + testID="sentry-feedback-form-title" > Report a Bug @@ -1141,6 +1154,7 @@ exports[`FeedbackButtonManager the Feedback Widget matches the snapshot with cus "paddingHorizontal": 10, } } + testID="sentry-feedback-name-input" value="" /> Send Bug Report @@ -1444,6 +1461,7 @@ exports[`FeedbackButtonManager the Feedback Widget matches the snapshot with def "textAlign": "left", } } + testID="sentry-feedback-form-title" > Report a Bug @@ -1489,6 +1507,7 @@ exports[`FeedbackButtonManager the Feedback Widget matches the snapshot with def "paddingHorizontal": 10, } } + testID="sentry-feedback-name-input" value="" /> Send Bug Report @@ -1792,6 +1814,7 @@ exports[`FeedbackButtonManager the Feedback Widget matches the snapshot with def "textAlign": "left", } } + testID="sentry-feedback-form-title" > Report a Bug @@ -1837,6 +1860,7 @@ exports[`FeedbackButtonManager the Feedback Widget matches the snapshot with def "paddingHorizontal": 10, } } + testID="sentry-feedback-name-input" value="" /> Send Bug Report @@ -2140,6 +2167,7 @@ exports[`FeedbackButtonManager the Feedback Widget matches the snapshot with def "textAlign": "left", } } + testID="sentry-feedback-form-title" > Report a Bug @@ -2185,6 +2213,7 @@ exports[`FeedbackButtonManager the Feedback Widget matches the snapshot with def "paddingHorizontal": 10, } } + testID="sentry-feedback-name-input" value="" /> Send Bug Report @@ -2488,6 +2520,7 @@ exports[`FeedbackButtonManager the Feedback Widget matches the snapshot with sys "textAlign": "left", } } + testID="sentry-feedback-form-title" > Report a Bug @@ -2533,6 +2566,7 @@ exports[`FeedbackButtonManager the Feedback Widget matches the snapshot with sys "paddingHorizontal": 10, } } + testID="sentry-feedback-name-input" value="" /> Send Bug Report @@ -2836,6 +2873,7 @@ exports[`FeedbackButtonManager the Feedback Widget matches the snapshot with sys "textAlign": "left", } } + testID="sentry-feedback-form-title" > Report a Bug @@ -2881,6 +2919,7 @@ exports[`FeedbackButtonManager the Feedback Widget matches the snapshot with sys "paddingHorizontal": 10, } } + testID="sentry-feedback-name-input" value="" /> Send Bug Report