There is similar question, but without answer Customize 'at' with extra parameters for the closure?
I want to reuse my page objects in different scenarios with different input and expected data. and since "at" method doesn't give me a way to extract expected data from other source like csv file i wonder what is the best practices to do it?
For example i have a scenario
def "Equity mew order creation scenario"() {
given:
to PortalPage
when:
navigateTo 'Equity Syndicate'
then:
at DealCalendarPage
and in DealCalendarPage
static at = {
$('div', id: 'rightPane').find('tr').text() == 'Equity Syndicate'
}
now if i want to reuse DealCalendarPage for another scenario i.e for structured products
def "SP mew order creation scenario"() {
given:
to PortalPage
when:
navigateTo 'Structured Products'
then:
at DealCalendarPage
i want to have
static at = {
$('div', id: 'rightPane').find('tr').text() == 'Structured products'
}
in DealCalendarPage
but i cannot parametrize my Page Object's "at" method
Or page object's 'at' method is not a good place to do such validation, and i have to do it explicitly in scenario?