-
-
Notifications
You must be signed in to change notification settings - Fork 354
(2.4) feat(feedback-ui): Add screenshots #4338
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
Merged
antonis
merged 122 commits into
feedback-ui
from
antonis/3959-captureFeedback-attachements
Jan 16, 2025
Merged
Changes from all commits
Commits
Show all changes
122 commits
Select commit
Hold shift + click to select a range
817eac8
Update the client implementation to use the new capture feedback js api
antonis 5370a99
Updates SDK API
antonis 42e2fa1
Adds new feedback button in the sample
antonis 514b102
Adds changelog
antonis 0935bbd
Removes unused mock
antonis 9ea5496
Update CHANGELOG.md
antonis da0d4ac
Directly use captureFeedback from sentry/core
antonis 3e36c6d
Use import from core
antonis 5f3df64
Fixes imports order lint issue
antonis 71b28e8
Fixes build issue
antonis f9d2b59
Adds captureFeedback tests from sentry-javascript
antonis d05d531
Update CHANGELOG.md
krystofwoldrich 2bb104b
Only deprecate client captureUserFeedback
antonis 4339274
Add simple form UI
antonis 6ce799b
Adds basic form functionality
antonis f2cefc6
Update imports
antonis 694ee33
Update imports
antonis 18b1c33
Merge branch 'main' into antonis/3859-newCaptureFeedbackAPI-Form
antonis 034efde
Remove useState hook to avoid multiple react instances issues
antonis 67a492d
Move types and styles in different files
antonis 8eaa61d
Removes attachment button to be added back separately along with the …
antonis 0b88cc5
Add basic field validation
antonis ae11b8d
Adds changelog
antonis 7f2ca06
Updates changelog
antonis 064b6c4
Updates changelog
antonis e2add4a
Merge branch 'main' into antonis/3859-newCaptureFeedbackAPI-Form
antonis e21718a
Trim whitespaces from the submitted feedback
antonis 407f179
Adds tests
antonis 14ac005
Merge branch 'main' into antonis/3859-newCaptureFeedbackAPI-Form
antonis 4e13866
Adds attachment button UI
antonis 3373b9b
Adds changelog
antonis eabacb4
Add attachment handling based on the client implementation
antonis 26b4da0
Reduce render method complexity
antonis 21f537d
Adds test for attachment button visibility
antonis 645d932
Format code
antonis 34bf6a8
Pick image with react-native-image-picker
antonis 0cd3982
Convert base64 string to Uint8Array before sending
antonis e8aa30b
Updates changelog
antonis ddade00
Renames FeedbackFormScreen to FeedbackForm
antonis 1bc1e4c
Add beta label
antonis 7934756
Extract default text to constants
antonis 95e1e0f
Merge branch 'main' into antonis/3859-newCaptureFeedbackAPI-Form
antonis a169362
Moves constant to a separate file and aligns naming with JS
antonis 4b5df7a
Adds input text labels
antonis 4fa81ce
Close screen before sending the feedback to minimise wait time
antonis 4fff82f
Rename file for consistency
antonis 0258bf2
Flatten configuration hierarchy and clean up
antonis 458ebc2
Align required values with JS
antonis f0e1bef
Use Sentry user email and name when set
antonis b9235f2
Simplifies email validation
antonis 6717a84
Merge branch 'main' into antonis/3859-newCaptureFeedbackAPI-Form
antonis 39a67bd
Show success alert message
antonis 501a134
Aligns naming with JS and unmounts the form by default
antonis 4b290a2
Use the minimum config without props in the changelog
antonis 7109deb
Adds development not for unimplemented function
antonis c80c5cb
Show email and name conditionally
antonis 8c56753
Adds sentry branding (png logo)
antonis d6e9229
Adds sentry logo resource
antonis 5292475
Add assets in module exports
antonis efd809f
Revert "Add assets in module exports"
antonis bc7ae65
Revert "Adds sentry logo resource"
antonis 79ee5ba
Revert "Adds sentry branding (png logo)"
antonis ba13320
Add last event id
antonis 1f5fb56
Mock lastEventId
antonis 5bb03f7
Merge branch 'antonis/3859-newCaptureFeedbackAPI-Form' into antonis/3…
antonis 1c5b87e
Remove changelog
antonis c837f8e
Reverse unrelated change
antonis 439367a
Merge branch 'main' into antonis/3859-newCaptureFeedbackAPI-Form
antonis 9831482
Adds beta note in the changelog
antonis 08a5805
Merge branch 'antonis/3859-newCaptureFeedbackAPI-Form' into antonis/3…
antonis 4097347
Updates changelog
antonis f8a82fd
Merge branch 'main' into antonis/3859-newCaptureFeedbackAPI-Form
antonis 30a7b10
Align colors with JS
antonis 3eccf25
Update CHANGELOG.md
antonis bc96fce
Update CHANGELOG.md
antonis 995a9ca
Update CHANGELOG.md
antonis 3aacaf7
Use regular fonts for both buttons
antonis 20e3a6c
Merge branch 'antonis/3859-newCaptureFeedbackAPI-Form' of https://git…
antonis 78e412c
Handle keyboard properly
antonis c45a5e6
Adds an option on whether the email should be validated
antonis 6e39119
Merge properties only once
antonis 57d99e9
Loads current user data on form construction
antonis 6fb8ab4
Remove unneeded extra padding
antonis fd2e317
Fix background color issue
antonis 03215dd
Merge branch 'antonis/3859-newCaptureFeedbackAPI-Form' into antonis/3…
antonis b793937
Fixes changelog typo
antonis b209ad6
Merge branch 'main' into antonis/3859-newCaptureFeedbackAPI-Form
antonis a40fde6
Merge branch 'main' into antonis/3859-newCaptureFeedbackAPI-Form
antonis 2a8f13f
Updates styles background color
antonis 0f3a244
Merge branch 'main' into antonis/3859-newCaptureFeedbackAPI-Form
antonis 9a96e74
Use defaultProps
antonis 10c1c0e
Merge branch 'main' into antonis/3859-newCaptureFeedbackAPI-Form
antonis 2be08a6
Correct defaultProps
antonis 0588552
Adds test to verify when getUser is called
antonis 85e3484
Merge branch 'antonis/3859-newCaptureFeedbackAPI-Form' into antonis/3…
antonis d316adf
Add default value in doc comment
antonis 614514e
Add a more clear doc comment
antonis e0ec92d
Merge branch 'main' into antonis/3859-newCaptureFeedbackAPI-Form
antonis 2900dec
Merge branch 'antonis/3859-newCaptureFeedbackAPI-Form' into antonis/3…
antonis 265e629
(2.2) feat: Add Feedback Form UI Branding logo (#4357)
antonis da0e3ea
Autoinject feedback form (#4370)
antonis a931ba9
Merge branch 'main' into antonis/3859-newCaptureFeedbackAPI-Form
antonis 37ad066
Merge branch 'antonis/3859-newCaptureFeedbackAPI-Form' into antonis/3…
antonis 5f9dec6
Align changelog entry
antonis 8359696
Merge branch 'main' into antonis/3859-newCaptureFeedbackAPI-Form
antonis 76518cc
Merge branch 'main' into antonis/3859-newCaptureFeedbackAPI-Form
antonis c472348
Merge branch 'antonis/3859-newCaptureFeedbackAPI-Form' into antonis/3…
antonis b0384ed
Merge branch 'main' into antonis/3859-newCaptureFeedbackAPI-Form
antonis 61886c2
Merge branch 'main' into antonis/3859-newCaptureFeedbackAPI-Form
antonis 9853630
Update changelog
antonis 38812a7
Merge branch 'antonis/3859-newCaptureFeedbackAPI-Form' into antonis/3…
antonis fe23346
Merge branch 'feedback-ui' into antonis/3959-captureFeedback-attachem…
antonis a1cb828
Use AddScreenshot naming
antonis 0a4b12d
Allow only Uint8Array for screenshots
antonis 239c64c
Rename callback parameter
antonis 7bc1d0d
Merge branch 'feedback-ui' into antonis/3959-captureFeedback-attachem…
antonis fc0040c
Merge branch 'feedback-ui' into antonis/3959-captureFeedback-attachem…
antonis a107436
Adds snapshot tests for screenshot button
antonis cb2559e
Merge branch 'feedback-ui' into antonis/3959-captureFeedback-attachem…
antonis 4b8f1d8
Merge branch 'feedback-ui' into antonis/3959-captureFeedback-attachem…
antonis 91a4b8a
Rename screenshot button for clarity
antonis c25996e
Use a library to get the Uint8Array
antonis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ import { FeedbackForm } from '../../src/js/feedback/FeedbackForm'; | |
| import type { FeedbackFormProps, FeedbackFormStyles } from '../../src/js/feedback/FeedbackForm.types'; | ||
|
|
||
| const mockOnFormClose = jest.fn(); | ||
| const mockOnAddScreenshot = jest.fn(); | ||
| const mockOnSubmitSuccess = jest.fn(); | ||
| const mockOnFormSubmitted = jest.fn(); | ||
| const mockOnSubmitError = jest.fn(); | ||
|
|
@@ -28,9 +29,11 @@ jest.mock('@sentry/core', () => ({ | |
|
|
||
| const defaultProps: FeedbackFormProps = { | ||
| onFormClose: mockOnFormClose, | ||
| onAddScreenshot: mockOnAddScreenshot, | ||
| onSubmitSuccess: mockOnSubmitSuccess, | ||
| onFormSubmitted: mockOnFormSubmitted, | ||
| onSubmitError: mockOnSubmitError, | ||
| addScreenshotButtonLabel: 'Add Screenshot', | ||
| formTitle: 'Feedback Form', | ||
| nameLabel: 'Name Label', | ||
| namePlaceholder: 'Name Placeholder', | ||
|
|
@@ -84,6 +87,13 @@ const customStyles: FeedbackFormStyles = { | |
| color: '#ff0000', | ||
| fontSize: 10, | ||
| }, | ||
| screenshotButton: { | ||
| backgroundColor: '#00ff00', | ||
| }, | ||
| screenshotText: { | ||
| color: '#0000ff', | ||
| fontSize: 13, | ||
| }, | ||
| }; | ||
|
|
||
| describe('FeedbackForm', () => { | ||
|
|
@@ -107,8 +117,24 @@ describe('FeedbackForm', () => { | |
| expect(toJSON()).toMatchSnapshot(); | ||
| }); | ||
|
|
||
| it('matches the snapshot with default configuration and screenshot button', () => { | ||
| const { toJSON } = render(<FeedbackForm enableScreenshot={true}/>); | ||
| expect(toJSON()).toMatchSnapshot(); | ||
| }); | ||
|
|
||
| it('matches the snapshot with custom texts and screenshot button', () => { | ||
| const { toJSON } = render(<FeedbackForm {...defaultProps} enableScreenshot={true}/>); | ||
| expect(toJSON()).toMatchSnapshot(); | ||
| }); | ||
|
|
||
| it('matches the snapshot with custom styles and screenshot button', () => { | ||
| const customStyleProps = {styles: customStyles}; | ||
| const { toJSON } = render(<FeedbackForm {...customStyleProps} enableScreenshot={true}/>); | ||
| expect(toJSON()).toMatchSnapshot(); | ||
| }); | ||
|
|
||
| it('renders correctly', () => { | ||
| const { getByPlaceholderText, getByText, getByTestId } = render(<FeedbackForm {...defaultProps} />); | ||
| const { getByPlaceholderText, getByText, getByTestId, queryByText } = render(<FeedbackForm {...defaultProps} />); | ||
|
|
||
| expect(getByText(defaultProps.formTitle)).toBeTruthy(); | ||
| expect(getByTestId('sentry-logo')).toBeTruthy(); // default showBranding is true | ||
|
|
@@ -118,10 +144,17 @@ describe('FeedbackForm', () => { | |
| expect(getByPlaceholderText(defaultProps.emailPlaceholder)).toBeTruthy(); | ||
| expect(getByText(`${defaultProps.messageLabel } ${ defaultProps.isRequiredLabel}`)).toBeTruthy(); | ||
| expect(getByPlaceholderText(defaultProps.messagePlaceholder)).toBeTruthy(); | ||
| expect(queryByText(defaultProps.addScreenshotButtonLabel)).toBeNull(); // default false | ||
| expect(getByText(defaultProps.submitButtonLabel)).toBeTruthy(); | ||
| expect(getByText(defaultProps.cancelButtonLabel)).toBeTruthy(); | ||
| }); | ||
|
|
||
| it('renders attachment button when the enableScreenshot is true', () => { | ||
| const { getByText } = render(<FeedbackForm {...defaultProps} enableScreenshot={true} />); | ||
|
|
||
| expect(getByText(defaultProps.addScreenshotButtonLabel)).toBeTruthy(); | ||
| }); | ||
|
|
||
| it('does not render the sentry logo when showBranding is false', () => { | ||
| const { queryByTestId } = render(<FeedbackForm {...defaultProps} showBranding={false} />); | ||
|
|
||
|
|
@@ -188,7 +221,7 @@ describe('FeedbackForm', () => { | |
| message: 'This is a feedback message.', | ||
| name: 'John Doe', | ||
| email: '[email protected]', | ||
| }); | ||
| }, undefined); | ||
| }); | ||
| }); | ||
|
|
||
|
|
@@ -270,6 +303,16 @@ describe('FeedbackForm', () => { | |
| }); | ||
| }); | ||
|
|
||
| it('calls onAddScreenshot when the screenshot button is pressed', async () => { | ||
| const { getByText } = render(<FeedbackForm {...defaultProps} enableScreenshot={true} />); | ||
|
|
||
| fireEvent.press(getByText(defaultProps.addScreenshotButtonLabel)); | ||
|
|
||
| await waitFor(() => { | ||
| expect(mockOnAddScreenshot).toHaveBeenCalled(); | ||
| }); | ||
| }); | ||
|
|
||
| it('calls onFormClose when the cancel button is pressed', () => { | ||
| const { getByText } = render(<FeedbackForm {...defaultProps} />); | ||
|
|
||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.