parameterized moduleList usage for multiple parameters

65 views
Skip to first unread message

Pooja Kurbetti

unread,
Feb 21, 2017, 1:59:13 AM2/21/17
to Geb Development Mailing List
Hello, 
Just wanted to check the way i am call the module is correct or incorrect

If below is the code snippet
class ParameterizedCartRow extends Module {
    def nameIndex
    def quantityIndex
    def priceIndex

    static content = {
        cell { $("td", it) }
        productName { cell(nameIndex).text() }
        quantity { cell(quantityIndex).text().toInteger() }
        price { cell(priceIndex).text().toBigDecimal() }
    }
}

class CheckoutPageWithParametrizedCart extends Page {
    static content = {
        cartItems {
            $("table tr").tail().moduleList {
                new ParameterizedCartRow(nameIndex: it, quantityIndex: it+1, priceIndex: it+2)
            }
        }
    }
}
Can i call this as
cartItems[0].productName.displayed
When i tried to call the parameterized moduleList
I got an error stating :
Condition not satisfied:
null+1 

Marcin Erdmann

unread,
Feb 21, 2017, 5:27:37 AM2/21/17
to geb...@googlegroups.com, Geb User Mailing List
Hi Pooja,

Why do you need to make your row module parameterized? Aren't indexes fixed in it anyway? Isn't the name column always the first column, quantity the second and price third? Am I missing something here?

What are you expecting (and why?) to be passed as `it` to your closure that you use with `moduleList()`? That method doesn't pass anything to your closure.

Marcin

P.s. Please ask similar questions on the user mailing list (CCed) in the future as this list is about development of Geb and not its use.

--
You received this message because you are subscribed to the Google Groups "Geb Development Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geb-dev+u...@googlegroups.com.
To post to this group, send email to geb...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-dev/0c41a5d9-8ced-4a1e-a30d-4d711d5dfd0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages