# Manual Integration Test: Message Handling

## DESCRIPTION

Test message handling with the Sales Orders application.

## PREPARATION

To check console errors open the developer tools before starting the application and check with each step, that there are no errors and warnings.

### Testing with mock data

Start the Sales Orders application with following URL (adjust host and port if necessary):

- local: http://localhost:8080/test-resources/sap/ui/core/demokit/sample/common/index.html?component=odata.v4.SalesOrders

## REALIZE and CHECK

### Bound messages in Sales Orders application

1. Check: On the `Show messages` button the number of messages is `2`.
2. Check: The `Note` field of the sales order with the ID `0500000001` has a colored border indicating a warning.
3. Check: The row of the sales order with the ID `0500000001` is highlighted as a warning.
4. Check: When clicking into the `Note` field of the sales order with the ID `0500000001` the warning "Enter customer reference if available" is displayed.
5. Enter the value "HEADER_MESSAGE" in the `Note` input field for the sales order with the ID `0500000000`.
6. Press the `Save sales orders` button in the `New Sales Orders`
7. Check: The `Note` field is highlighted as a success.
8. Click on the `Show Messages` button.
9. Check: A popover is displayed containing 4 messages: an information message with the text "Example for an unbound message", a warning message with the text "Enter customer reference if available", an error message with the text "Minimum order quantity is 2", and a success message with the text "This is your requested bound header message".
10. Check:A message strip is displayed above the table indicating that there are warnings for the table.
11. Click on the message "Example for an unbound message" to get to the message details.
12. Check: There is a link with text "Technical Details".
13. Click the link.
14. Check: A popover opens with the technical details as JSON.
15. Close the technical details popover.
16. Check: The content of the message details is "Details for "Enter customer reference if available" (relative longtext URL).".
17. Go back to the messages overview.
18. Click on the message "Enter customer reference if available" to get to the message details.
19. Check: The content of the message details is: `Details for "Enter customer reference if available" (relative longtext URL).`
20. Check: There is a link with text "Technical Details".
21. Click the link.
22. Check: A popover opens with the technical details as JSON.
23. Close the technical details popover.
24. Go back to the messages overview.
25. Click on the message title "Enter customer reference if available"
26. Check: The `Note` field of the sales order with the ID `0500000001` gets focused and the same message is highlighted below/beside the input field.
27. Close the message popover.
28. Check: On the `Show messages` button, the number of messages is now `1`. When clicking into the `Note` field of the sales order with the ID `0500000001`, the "Enter customer reference if available" warning is still displayed.
29. Check: The `Note` field of the sales order with the ID `0500000001` still has a colored border.
30. Click on the `Show Messages` button.
31. Check: A popover is diplayed containing 1 messages.
32. Close the message popover.
33. In the `New Sales Orders` table select the sales order with the ID `0500000001`.
34. Check: On the `Show messages` button the number of messages is `2`.
35. Check: The `Note` field of the sales order with the ID `0500000001` has a colored border indicating a warning.
36. Check: When clicking into the `Note` field of the sales order with the ID `0500000001` the warning "Enter customer reference if available" is displayed.
37. Check: The `Note` field in the `Sales Order Details` section has a colored border indicating a warning.
38. Check: When clicking into the `Note` field in the `Sales Order Details` section the warning "Enter customer reference if available" is displayed.
39. Check: The `Quantity` field of the sales order line item with the item position `0000000020` has a colored border indicating an error.
40. Check: When clicking into the `Quantity` field of the sales order line item with the item position `0000000020` the error "Minimum order quantity is 2" is displayed.
41. Click on the `Show Messages` button.
42. Check: A popover is displayed containing 2 messages: a warning message with the text "Enter customer reference if available" and an error message with the text "Minimum order quantity is 2".
43. Check:A message strip is displayed above the table indicating that there are issues for the table.
44. Check: The row of the sales order with the ID `0500000001` is highlighted as an error.
45. Click on the message "Minimum order quantity is 2" to get to the message details.
46. Check: The content of the message details is: `Details for "Minimum order quantity is 2" (absolute longtext URL).`
47. Go back to the messages overview.
48. Close the message popover.
49. Check: On the `Show messages` button the number of messages is `2`.
50. Check: The `Note` field of the sales order with the ID `0500000001` still has a colored border.
51. Check: The `Note` field in the `Sales Order Details` section still has a colored border.
52. Check: The `Quantity` field of the sales order line item with the item position `0000000020` still has a colored border indicating an error.
53. In the `New Sales Orders` table select the sales order with the ID `0500000000`.
54. Check: There is no input field with a colored border in the `Sales Order Line Items` table.
55. Check: On the `Show messages` button the number of messages is still `2`.
56. In the `New Sales Orders` table select again the sales order with the ID `0500000001`.
57. Check: The `Quantity` field of the sales order line item with the item position `0000000020` again has a colored border indicating an error.
58. Check: On the `Show messages` button the number of messages is `2`.
59. Click on the `Show Messages` button.
60. Check: A popover is diplayed containing 2 messages: a warning message with the text "Enter customer reference if available" and an error message with the text "Minimum order quantity is 2".
61. Close the message popover.

### Error messages in Sales Orders application

#### PATCH scenario

1. In the `New Sales Orders` table, in the row for sales order ID `0500000003`, enter the value `modified Note` in the `Note` input field.
2. In the row for sales order ID `0500000004`, enter the value `RAISE_ERROR` in the `Note` input field.
3. Press the `Save sales orders` button in the `New Sales Orders` table
4. Check: The message popover is opened and you got an error regarding the invalid `Note` value.
5. Click on the message "Property `Note` value `RAISE_ERROR` not allowed!" to get to the message details.
6. Check: There is a link with text "Technical Details".
7. Click the link.
8. Check: A popover opens with the technical details as JSON.
9. Close the technical details popover.
10. Check: The `Note` field of the sales order with the ID `0500000004` has a colored border indicating the error.
11. Check: When clicking into the `Note` field of the sales order with the ID `0500000004` the same error is highlighted below/beside the input field.
12. Close the message popover.
13. Check: The `Note` error state indicator is gone.
14. Enter a different value in the `Note` input field for sales order ID `0500000004`.
15. Press the `Save sales orders` button in the `New Sales Orders`
16. Check: The error is no longer raised.

#### POST scenario

1. Select sales order with number "0500000004".
2. Press the `Create sales order line item` button in the `Sales Order Line Items` table.
3. Check: The new sales order line item is at the end of the list.
4. In the `Quantity` input field for the newly created sales order line item enter value `0.000`.
5. Press the `Save sales order` button in the `Sales Order Details` section.
6. Check: The message popover is opened and you get an error regarding invalid `Quantity` value.
7. Check: The `Quantity` field of the new sales order line item has a colored border indicating an error.
8. Check: When clicking into the `Quantity` the same error is highlighted below/beside the input field.
9. Close the message popover.
10. Check: The `Note` error state indicator is gone.
11. Enter a value greater then 0 in the `Quantity` input field.
12. Press the `Save sales order` button in the `Sales Order Details` section.
13. Confirm the success popup.
14. Check: No error is shown (and the items gets again it's initial values, because of the refreshSingle() triggered by the `Save sales order` in the `Sales Order Details` section).

#### Function scenario

1. Select sales order with number "0500000002".
2. Press the `Simulate discount for selected sales order` button in the `New Sales Orders` table.
3. Check: A `Simulate Discount` dialog is opened.
4. Check: The content for the `Sales Order:` text field is "0500000002".
5. Check: The content for the `Gross Amount:` text field is "250.73".
6. Check: The `Calculated Gross Amount:` text field is empty.
7. Enter a discount of "25" into the `Reduction in %:` step input control.
8. Press the `Execute discount simulation` button in the dialog.
9. Check: The `Calculated Gross Amount:` text field is "188.05".
10. Enter a discount of "75" into the `Reduction in %:` step input control.
11. Press the `Execute discount simulation` button in the dialog.
12. Check: The error messages popover has opened and you got an error "User John Doe is not authorized to approve more than 50% discount w/o approver".
13. Check: The step input control has a red border. If you click into the step input control you see the same error "User John Doe is not authorized to approve more than 50% discount w/o approver" beside the step input control.
14. Check: The approver input control has a red border. If you click into the approver input control you see the same error "User John Doe is not authorized to approve more than 50% discount w/o approver" beside the input control.
15. Close the message popover.

#### MessageStrip, highlight and filter entities by messages scenario

- Check: On the `Show messages` button the number of messages is `2`.
- Check: A message strip is displayed above the `New Sales Orders` table indicating that there are issues for the table.
- Check: The row of the sales order with the ID `0500000001` is highlighted as an error.
- Press the 'More' button of the `New Sales Orders` table.
- Check: On the `Show messages` button the number of messages now is `4`.
- Check: The row of the sales order with the ID `0500000006` is highlighted as an error.
- Click on the `Show Messages` button.
- Check: A popover is displayed containing 4 messages:

- a warning message with the text "Enter customer reference if available"
- an error message with the text "Minimum order quantity is 2"
- a warning "Enter a Note" and
- another error message with the text "Minimum order quantity is 2".

- Close the message popover.
- In the `New Sales Orders` table select the sales order with the ID `0500000006`.
- Check: On the `Show messages` button the number of messages is still `4`.
- In the `New Sales Orders` table select the sales order with the ID `0500000006`.
- Check: A message strip is displayed above the `Sales Order Line Items` table indicating that there are issues.
- In the `New Sales Orders` table select the sales order with the ID `0500000005` which has no issues.
- Check: The `Sales Order Line Items` table shows no issues: There is no message strip above the table.
- In the `New Sales Orders` table select the sales order with the ID `0500000006` again.
- Check: A message strip is displayed above the `Sales Order Line Items` table indicating that there are issues.
- Check: There are 8 line items, one is highlighted as an error and has a quantity field with value state error "Enter a minimum value of 2"
- Press the `Create sales order line item` button in the `Sales Order Line Items` table.
- Check: The new sales order line item is at the end of the list.
- Change the `Filter` value in the `Sales Order Line Items` table from `Show All` to `With Error Messages`.
  Check: Only the item with the error and the new item at the end are displayed.
- Check: On the `Show messages` button the number of messages is still `4`.
- Change the `Filter` value in the `Sales Order Line Items` table from `With Error Messages` to `Show All`.
  Check: All 9 line items are displayed and the new sales order line item is still at the end of the list.
- Check: On the `Show messages` button the number of messages is still `4`.
- Click on `Cancel sales order changes` button in the `Sales Orders Details`.
- Check: The new sales order item is gone.
- Click on the `Delete` button in the `Sales Orders` table.
- Check: On the `Show messages` button the number of messages is `2`.
- Click on the `Cancel sales order list changes` button in the `Sales Orders` table.
- Check: On the `Show messages` button the number of messages is `4`.
- In the `New Sales Orders` table select the sales order with the ID `0500000006` again.
- Enter any text in the note input field of the first sales order item.
- Enter a quantity higher than 1 in the quantity input field of the second sales order item.
- Press the `Save sales order` button in the `Sales Order Details` section.
- Check: The row of the sales order with the ID `0500000006` is no longer highlighted.
- Check: On the `Show messages` button the number of messages is `2`.
- Click on the `Show Messages` button.
- Check: The warning "Enter a Note" and one error "Minimum order quantity is 2" now are gone.
- Close the message popover.

#### Strict handling scenario

- In the `New Sales Orders` table select the sales order with the ID `0500000000`.
- Click on `Confirm selected sales order` in the `New Sales Orders` table.
- Check: That you got a dialog showing a warning and an error and asking you whether to continue or not.
- Click on `No`/li>
- Check: The dialog was closed and the Sales Order is not yet confirmed.
- Click again on `Confirm selected sales order` in the `New Sales Orders` table.
- Check: That you got again a dialog showing a warning and an error and asking you whether to continue or not.
- Click on `Yes`
- Check: The sales order is confirmed and is filtered out from the `New Sales Orders` table.