-
Notifications
You must be signed in to change notification settings - Fork 0
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
Modify dialogue error messages when editing a catalogue item that has child elements #1136 #1165
base: develop
Are you sure you want to change the base?
Modify dialogue error messages when editing a catalogue item that has child elements #1136 #1165
Conversation
…item has children - more user friendly - maunfacturer_id replaced by the actual manufacturer
- fixes failing linting test - fixes mistakes in cypress test - adds manufacturerList to dependency array - adds helpful comments
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #1165 +/- ##
===========================================
- Coverage 99.23% 99.16% -0.08%
===========================================
Files 88 88
Lines 17876 17941 +65
Branches 2123 2949 +826
===========================================
+ Hits 17740 17791 +51
- Misses 135 149 +14
Partials 1 1 ☔ View full report in Codecov by Sentry. |
const message = response.detail.replace( | ||
"so the following fields cannot be updated: manufacturer_id, properties", | ||
("so you cannot update the properties, and the manufacturer cannot be changed from " | ||
+ manufacturerName?.name) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of replacing the text directly in the backend response, consider moving this string transformation entirely to the frontend. This approach will ensure consistency in the response formatting, prevent future inconsistencies, and make it easier to manage localization or text changes.
screen.getByText( | ||
'Catalogue item has child elements, so you cannot update the properties, ' | ||
+ 'and the manufacturer cannot be changed' | ||
) | ||
).toBeInTheDocument(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message is missing the name of the manufacturer
cy.findByRole('button', { name: 'Finish'}).click(); | ||
cy.findByRole('dialog') | ||
.should('be.visible') | ||
.within(() => { | ||
cy.contains('Catalogue item has child elements, so you cannot update the properties, ' | ||
+ 'and the manufacturer cannot be changed') | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case of catalogue items, I think the only child elements are items themselves? If that's the case I think it's more user friendly to say it has items, rather than child elements.
Description
Modifies the error message to be more user friendly. Includes displaying the actual manufacturer name.
Adds cypress tests and add/modifies unit tests.
As seen here.
Testing instructions
Add a set up instructions describing how the reviewer should test the code
Agile board tracking
Resolves #1136