Related to issue 0033836: wrong "net unit price" with tax include taxes and price precision 6
authorMiguel de Juana <miguel.dejuana@openbravo.com>
Thu, 22 Sep 2016 12:15:32 +0200
changeset 5844 ac890f93aaed
parent 5843 ddf5d9469812
child 5845 2ffc0fe74dd3
Related to issue 0033836: wrong "net unit price" with tax include taxes and price precision 6

- Allow to check invoice with more than one line
- Add the test
src-test/org/openbravo/test/mobile/common/selenium/database/WebPOSDatabaseHelper.java
--- a/src-test/org/openbravo/test/mobile/common/selenium/database/WebPOSDatabaseHelper.java	Thu Sep 22 12:14:58 2016 +0200
+++ b/src-test/org/openbravo/test/mobile/common/selenium/database/WebPOSDatabaseHelper.java	Thu Sep 22 12:15:32 2016 +0200
@@ -481,20 +481,28 @@
   }
 
   public static void verifyInvoice(final String documentNo, final OBNumber gross) {
+    verifyInvoiceRecords(documentNo, gross, 1);
+  }
+
+  public static void verifyInvoiceRecords(final String documentNo, final OBNumber gross,
+      final int expectedRecords) {
+
     final ArrayList<InvoiceLinesOfDocumentnoRow> ils = WebPOSDatabaseHelper.getInvoiceLinesOf(
-        documentNo, 1);
-    final InvoiceLinesOfDocumentnoRow row1 = ils.get(0);
-    assertThat(row1.c_order_documentno, equalTo(documentNo));
-    assertThat(row1.c_invoice_paymentcomplete, equalTo(true));
-    assertThat(row1.fin_payment_schedule_expectedamount, equalTo(gross));
-    assertThat(row1.fin_payment_schedule_receivedamount, equalTo(gross));
-    assertThat(row1.c_invoice_grandtotal, equalTo(gross));
-    assertThat(row1.c_invoice_totalpaid, equalTo(gross));
-    assertThat(row1.c_invoice_outstandingamt, equalTo(OBNumber.ZERO));
-    assertThat(row1.c_invoice_finalsettlement, not(nullValue()));
-    assertThat(row1.fin_payment_schedule_id, not(nullValue()));
-    assertThat(row1.c_invoice_grandtotal,
-        equalTo(row1.c_invoice_totallines.add(row1.c_invoice_totaltaxamount)));
+        documentNo, expectedRecords);
+    for (final InvoiceLinesOfDocumentnoRow row1 : ils) {
+      assertThat(row1.c_order_documentno, equalTo(documentNo));
+      assertThat(row1.c_invoice_paymentcomplete, equalTo(true));
+      assertThat(row1.fin_payment_schedule_expectedamount, equalTo(gross));
+      assertThat(row1.fin_payment_schedule_receivedamount, equalTo(gross));
+      assertThat(row1.c_invoice_grandtotal, equalTo(gross));
+      assertThat(row1.c_invoice_totalpaid, equalTo(gross));
+      assertThat(row1.c_invoice_outstandingamt, equalTo(OBNumber.ZERO));
+      assertThat(row1.c_invoice_finalsettlement, not(nullValue()));
+      assertThat(row1.fin_payment_schedule_id, not(nullValue()));
+      assertThat(row1.c_invoice_grandtotal,
+          equalTo(row1.c_invoice_totallines.add(row1.c_invoice_totaltaxamount)));
+    }
+
   }
 
   public static void verifyInvoicePaidWithCredit(final String documentNo, final OBNumber gross,