[test-owner-report] properly test link amounts

Previous test wasn't comprehensive; due to variable row lengths,
the (td 11) wouldn't consistently select the link amount. using
(td -1) will select the last <td> element in the row.

Moreover also test the class-name to target the link amounts otherwise
other elements (eg the aging-list) will also be returned.
This commit is contained in:
Christopher Lam 2019-12-14 12:24:32 +08:00
parent b372f28829
commit cbb0c36ad4

View File

@ -327,6 +327,7 @@
sxml)))
(test-end "customer-report")
(display "new-owner-report tests:\n")
(test-begin "new-customer-report")
(let* ((options (default-testing-options 'customer-new
owner-1 (get-acct "AR-USD")))
@ -351,9 +352,18 @@
"$228.00" "$28.00" "$34.75" "$31.75")
((sxpath `(// (table 3) // tr (td 8) // *text*))
sxml))
(test-equal "link-amounts"
'("$1.50" "$11.50" "$11.50" "$200.00" "$200.00")
((sxpath `(// (table 3) // tr (td 11) // *text*))
(test-equal "positive-link-amounts"
'("$1.50" "$2.00" "$8.00" "$7.50" "$8.50" "$11.50" "$11.50"
"$4.00" "$200.00" "$200.00" "$6.75")
((sxpath `(// (table 3) // tr
(td -1 (@ (equal? (class "number-cell")))) //
*text*))
sxml))
(test-equal "negative-link-amounts"
'("-$3.00")
((sxpath `(// (table 3) // tr
(td -1 (@ (equal? (class "number-cell neg")))) //
*text*))
sxml))
;; from the report, find the 3rd table, last row, find embedded
;; table, retrieve tr contents