Manual Integration Test: Currency and unit amount in two fields
DESCRIPTION
Test for showing and entering unit or currency amounts in two fields based on the
sap.ui.model.odata.type.Unit or sap.ui.model.odata.type.Currency.
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.
You can start the Two Fields for Unit and Currency application with the following URL
(adjust host and port if necessary)
http://localhost:8080/test-resources/sap/ui/core/internal/samples/odata/twoFields/index.html?sap-ui-language=EN.
Note: Each test has a specific initial state corresponding to parameters for the application
URL; you find the corresponding application URL with the respective test.
REALIZE and CHECK
1) Entry of amount (step 1) and currency (step 2) in previously empty input fields
(success case)
Start
http://localhost:8080/test-resources/sap/ui/core/internal/samples/odata/twoFields/index.html?unit=&sap-ui-language=EN.
- Check: Value field is empty.
- Check: Value field has no error.
- Check: Unit field is empty.
- Check: Unit field has no error.
- Check: Model contents is "value=null, unit=null".
Enter value "100" and press return.
- Check: Value field shows "100".
- Check: Value field has no error.
- Check: Unit field is empty.
- Check: Unit field has no error.
- Check: Model contents is "value=100, unit=null".
Enter unit "DEG" and press return.
- Check: Value field shows "100.0".
- Check: Value field has no error.
- Check: Unit field shows "DEG".
- Check: Unit field has no error.
- Check: Model contents is "value=100, unit=DEG".
Start
http://localhost:8080/test-resources/sap/ui/core/internal/samples/odata/twoFields/index.html?currency=&sap-ui-language=EN.
- Check: Value field is empty.
- Check: Value field has no error.
- Check: Currency field is empty.
- Check: Currency field has no error.
- Check: Model contents is "value=null, unit=null".
Enter value "100" and press return.
- Check: Value field shows "100.00".
- Check: Value field has no error.
- Check: Currency field is empty.
- Check: Currency field has no error.
- Check: Model contents is "value=100, unit=null".
Enter currency "JPY" and press return.
- Check: Value field shows "100".
- Check: Value field has no error.
- Check: Currency field shows "JPY".
- Check: Currency field has no error.
- Check: Model contents is "value=100, unit=JPY".
Enter currency "USDN" and press return.
- Check: Value field shows "100.00000".
- Check: Value field has no error.
- Check: Currency field shows "USDN".
- Check: Currency field has no error.
- Check: Model contents is "value=100, unit=USDN".
2) Entry of amount (step 1) and currency (step 2) in previously empty input fields
(error case)
Start
http://localhost:8080/test-resources/sap/ui/core/internal/samples/odata/twoFields/index.html?currency=&sap-ui-language=EN.
- Check: Value field is empty.
- Check: Value field has no error.
- Check: Currency field is empty.
- Check: Currency field has no error.
- Check: Model contents is "value=null, unit=null".
Enter value "100.1" and press return.
- Check: Value field shows "100.10".
- Check: Value field has no error.
- Check: Currency field is empty.
- Check: Currency field has no error.
- Check: Model contents is "value=100.1, unit=null".
Enter currency "JPY" and press return.
- Check: Value field shows "100.1".
- Check: Value field shows error "Enter a number without decimals.".
- Check: Currency field shows "JPY".
- Check: Currency field shows error
"Enter a currency allowing at least 1 decimals".
- Check: Model contents is "value=100.1, unit=null".
3) Currency is already available, the user enters an invalid amount.
Start
http://localhost:8080/test-resources/sap/ui/core/internal/samples/odata/twoFields/index.html?currency=JPY&sap-ui-language=EN.
- Check: Value field is empty.
- Check: Value field has no error.
- Check: Currency field shows "JPY".
- Check: Currency field has no error.
- Check: Model contents is "value=null, unit=JPY".
Enter value "100.1" and press return.
- Check: Value field shows "100.1".
- Check: Value field shows error "Enter a number without decimals.".
- Check: Currency field shows "JPY".
- Check: Currency field shows error
"Enter a currency allowing at least 1 decimals".
- Check: Model contents is "value=null, unit=JPY".
4) Currency is already available, the user enters a valid amount.
Start
http://localhost:8080/test-resources/sap/ui/core/internal/samples/odata/twoFields/index.html?currency=JPY&sap-ui-language=EN.
- Check: Value field is empty.
- Check: Value field has no error.
- Check: Currency field shows "JPY".
- Check: Currency field has no error.
- Check: Model contents is "value=null, unit=JPY".
Enter value "100" and press return.
- Check: Value field shows "100".
- Check: Value field has no error.".
- Check: Currency field shows "JPY".
- Check: Currency field has no error.
- Check: Model contents is "value=100, unit=JPY".
5) Currency is available, the field is not editable or enabled. The user enters an
invalid amount.
For testing with a not editable field, start
http://localhost:8080/test-resources/sap/ui/core/internal/samples/odata/twoFields/index.html?currency=JPY~readonly&sap-ui-language=EN.
- Check: Value field is empty.
- Check: Value field has no error.
- Check: Currency field shows "JPY".
- Check: Currency field has no error.
- Check: Model contents is "value=null, unit=JPY".
Enter value "100.1" and press return.
- Check: Value field shows "100.1".
- Check: Value field shows error "Enter a number without decimals.".
- Check: Currency field shows "JPY".
- Check: Currency field has no error.
- Check: Model contents is "value=null, unit=JPY".
Repeat this test with a disabled field, start
http://localhost:8080/test-resources/sap/ui/core/internal/samples/odata/twoFields/index.html?currency=JPY~disabled&sap-ui-language=EN.
6) Amount is in a not editable or enabled field, currency is changed so that the
amount has too many decimal places.
For testing with a not editable field, start
http://localhost:8080/test-resources/sap/ui/core/internal/samples/odata/twoFields/index.html?currency=EUR&value=100.1~readonly&sap-ui-language=EN.
- Check: Value field shows "100.10".
- Check: Value field has no error.
- Check: Currency field shows "EUR".
- Check: Currency field has no error.
- Check: Model contents is "value=100.1, unit=EUR".
Enter currency "JPY" and press return.
- Check: Value field shows "100.1".
- Check: Value field has no error.
- Check: Currency field shows "JPY".
- Check: Currency field shows error
"Enter a currency allowing at least 1 decimals".
- Check: Model contents is "value=100.1, unit=EUR".
Repeat this test with a disabled field, start
http://localhost:8080/test-resources/sap/ui/core/internal/samples/odata/twoFields/index.html?currency=EUR&value=100.1~disabled&sap-ui-language=EN.
7) Entry of amount (step 1) and new currency (step 2) with previously available currency
(success case)
Start
http://localhost:8080/test-resources/sap/ui/core/internal/samples/odata/twoFields/index.html?currency=EUR&sap-ui-language=EN.
- Check: Value field is empty.
- Check: Value field has no error.
- Check: Currency field shows "EUR".
- Check: Currency field has no error.
- Check: Model contents is "value=null, unit=EUR".
Enter value "100" and press return.
- Check: Value field shows "100.00".
- Check: Value field has no error.
- Check: Currency field shows "EUR".
- Check: Currency field has no error.
- Check: Model contents is "value=100, unit=EUR".
Enter currency "JPY" and press return.
- Check: Value field shows "100".
- Check: Value field has no error.
- Check: Currency field shows "JPY".
- Check: Currency field has no error.
- Check: Model contents is "value=100, unit=JPY".
8) Entry of amount (step 1) and new currency (step 2) with previously available currency
(error case)
Start
http://localhost:8080/test-resources/sap/ui/core/internal/samples/odata/twoFields/index.html?currency=EUR&sap-ui-language=EN.
- Check: Value field is empty.
- Check: Value field has no error.
- Check: Currency field shows "EUR".
- Check: Currency field has no error.
- Check: Model contents is "value=null, unit=EUR".
Enter value "100.1" and press return.
- Check: Value field shows "100.10".
- Check: Value field has no error.
- Check: Currency field shows "EUR".
- Check: Currency field has no error.
- Check: Model contents is "value=100.1, unit=EUR".
Enter currency "JPY" and press return.
- Check: Value field shows "100.1".
- Check: Value field shows error "Enter a number without decimals.".
- Check: Currency field shows "JPY".
- Check: Currency field shows error
"Enter a currency allowing at least 1 decimals".
- Check: Model contents is "value=100.1, unit=EUR".
9) The backend sends an invalid quantity: No error is shown
Start
http://localhost:8080/test-resources/sap/ui/core/internal/samples/odata/twoFields/index.html?unit=KG&value=1.54&sap-ui-language=EN.
- Check: Value field shows "1.54".
- Check: Value field has no error.
- Check: Unit field shows "KG".
- Check: Unit field has no error.
- Check: Model contents is "value=1.54, unit=KG".
10) Entry of an invalid unit
Start
http://localhost:8080/test-resources/sap/ui/core/internal/samples/odata/twoFields/index.html?currency=EUR&value=1.23&sap-ui-language=EN.
- Check: Value field shows "1.23".
- Check: Value field has no error.
- Check: Currency field shows "EUR".
- Check: Currency field has no error.
- Check: Model contents is "value=1.23, unit=EUR".
Enter currency "WRONG" and press return.
- Check: Value field shows "1.23".
- Check: Value field has no error.
- Check: Currency field shows "WRONG".
- Check: Currency field shows error "Enter a valid currency".
- Check: Model contents is "value=1.23, unit=EUR".
11) Invalid currency amount can be fixed by changing to a valid matching currency
Start
http://localhost:8080/test-resources/sap/ui/core/internal/samples/odata/twoFields/index.html?currency=JPY&value=1&sap-ui-language=EN.
- Check: Value field shows "1".
- Check: Value field has no error.
- Check: Currency field shows "JPY".
- Check: Currency field has no error.
- Check: Model contents is "value=1, unit=JPY".
Enter value "2.34" and press return.
- Check: Value field shows "2.34".
- Check: Value field shows error "Enter a number without decimals.".
- Check: Currency field shows "JPY".
- Check: Currency field shows error
"Enter a currency allowing at least 2 decimals".
- Check: Model contents is "value=1, unit=JPY".
Enter currency "EUR" and press return.
- Check: Value field shows "2.34".
- Check: Value field has no error.
- Check: Currency field shows "EUR".
- Check: Currency field has no error.
- Check: Model contents is "value=2.34, unit=EUR".
12) Invalid value at one part only shown at that part
Start
http://localhost:8080/test-resources/sap/ui/core/internal/samples/odata/twoFields/index.html?currency=EUR&sap-ui-language=EN.
- Check: Value field is empty.
- Check: Value field has no error.
- Check: Currency field shows "EUR".
- Check: Currency field has no error.
- Check: Model contents is "value=null, unit=EUR".
Enter value "-1" and press return.
- Check: Value field shows "-1".
- Check: Value field shows error
"Enter a number with a minimum value of 0".
- Check: Currency field shows "EUR".
- Check: Currency field has no error.
- Check: Model contents is "value=null, unit=EUR".
Enter value "5" and press return.
- Check: Value field shows "5.00".
- Check: Value field has no error.
- Check: Currency field shows "EUR".
- Check: Currency field has no error.
- Check: Model contents is "value=5, unit=EUR".
13) Changing a non parsable value to a value that leads to a ValidateException on both
parts leads to both parts highlighted
Start
http://localhost:8080/test-resources/sap/ui/core/internal/samples/odata/twoFields/index.html?unit=M%2FL&value=2.1&sap-ui-language=EN.
- Check: Value field shows "2.100".
- Check: Value field has no error.
- Check: Unit field shows "M/L".
- Check: Unit field has no error.
- Check: Model contents is "value=2.1, unit=M/L".
Enter unit "XYZ" and press return.
- Check: Value field shows "2.1".
- Check: Value field has no error.
- Check: Unit field shows "XYZ".
- Check: Unit field shows error "Enter a valid unit".
- Check: Model contents is "value=2.1, unit=M/L".
Enter unit "KG" and press return.
- Check: Value field shows "2.1".
- Check: Value field shows error "Enter a number without decimals.".
- Check: Unit field shows "KG".
- Check: Unit field shows error "Enter a unit allowing at least 1 decimals".
- Check: Model contents is "value=2.1, unit=M/L".
Enter value "2" and press return.
- Check: Value field shows "2".
- Check: Value field has no error.
- Check: Unit field shows "KG".
- Check: Unit field has no error.
- Check: Model contents is "value=2, unit=KG".
14) Changing to a different valid value after entering a non-parsable unit must keep the
illegal unit. Correction to the unit writes both value and unit to the model. The same
applies when changing roles of value and unit.
Start
http://localhost:8080/test-resources/sap/ui/core/internal/samples/odata/twoFields/index.html?unit=KG&value=2&sap-ui-language=EN.
- Check: Value field shows "2".
- Check: Value field has no error.
- Check: Unit field shows "KG".
- Check: Unit field has no error.
- Check: Model contents is "value=2, unit=KG".
Enter unit "XYZ" and press return.
- Check: Value field shows "2".
- Check: Value field has no error.
- Check: Unit field shows "XYZ".
- Check: Unit field shows error "Enter a valid unit".
- Check: Model contents is "value=2, unit=KG".
Enter value "3" and press return.
- Check: Value field shows "3".
- Check: Value field shows error "Enter a valid unit to change the number".
- Check: Unit field shows "XYZ".
- Check: Unit field shows error "Enter a valid unit".
- Check: Model contents is "value=2, unit=KG".
Enter unit "DEG" and press return.
- Check: Value field shows "3.0".
- Check: Value field has no error.
- Check: Unit field shows "DEG".
- Check: Unit field has no error.
- Check: Model contents is "value=3, unit=DEG".
Enter value "ABC" and press return.
- Check: Value field shows "ABC".
- Check: Value field shows error "Enter a number".
- Check: Unit field shows "DEG".
- Check: Unit field has no error.
- Check: Model contents is "value=3, unit=DEG".
Enter unit "M/L" and press return.
- Check: Value field shows "ABC".
- Check: Value field shows error "Enter a number".
- Check: Unit field shows "M/L".
- Check: Unit field shows error "Enter a valid number to change the unit".
- Check: Model contents is "value=3, unit=DEG".
Enter value "4.1" and press return.
- Check: Value field shows "4.100".
- Check: Value field has no error.
- Check: Unit field shows "M/L".
- Check: Unit field has no error.
- Check: Model contents is "value=4.1, unit=M/L".