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

Modify dialogue error messages when editing a catalogue item that has child elements #1136 #1165

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

rowan04
Copy link
Member

@rowan04 rowan04 commented Dec 17, 2024

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.
imscatalogueitemediterrormessage

Testing instructions

Add a set up instructions describing how the reviewer should test the code

  • Review code
  • Check Actions build
  • Review changes to test coverage
  • {more steps here}

Agile board tracking

Resolves #1136

…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
Copy link

codecov bot commented Dec 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.16%. Comparing base (718d659) to head (80c4670).
Report is 3 commits behind head on develop.

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.
📢 Have feedback on the report? Share it here.

Comment on lines +394 to +398
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)
)
Copy link
Collaborator

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.

Comment on lines +1111 to +1115
screen.getByText(
'Catalogue item has child elements, so you cannot update the properties, '
+ 'and the manufacturer cannot be changed'
)
).toBeInTheDocument();
Copy link
Collaborator

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

Comment on lines +588 to +594
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')
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here

Copy link
Contributor

@asuresh-code asuresh-code left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Modify catalogue item edit dialogue error messages when has children
3 participants