Commit 699be790 authored by Quentin Defenouillere's avatar Quentin Defenouillere Committed by ntome

[cragr/regions] Handle third coming line configuration

Some connections have two coming lines plus an information line, in
these cases we must seleft the last coming line while ignoring the
information line at the end.
When there is no information line, we must take the last coming line
otherwise we are skipping the latest coming transactions.

Closes: 11993@zendesk, 12060@zendesk
parent b1f6a031
......@@ -490,13 +490,18 @@ class MultipleCardsPage(CardsPage):
def get_transactions_link(self, raw_number):
# We cannot use Link() because the @href attribute contains line breaks and spaces.
# Always take the <tr> before the last to include the latest transactions,
# except if there is only one line of coming (then take the last).
if len(self.doc.xpath('//table[@class="ca-table"][caption[span[text()="%s"]]]//tr' % raw_number)) == 1:
# There is only one coming line (no card information link)
return CleanText('//table[@class="ca-table"][caption[span[text()="%s"]]]//tr[position()=last()]/th/a/@href'
% raw_number, replace=[(' ', '')])(self.doc)
elif self.doc.xpath('//table[@class="ca-table"][caption[span[text()="%s"]]]//tr//a[contains(text(), "Infos carte")]' % raw_number):
# There is a card information line, select the <tr> before the last
return CleanText('//table[@class="ca-table"][caption[span[text()="%s"]]]//tr[position()=last()-1]/th/a/@href'
% raw_number, replace=[(' ', '')])(self.doc)
else:
# There is no information line, return the last <tr>
return CleanText('//table[@class="ca-table"][caption[span[text()="%s"]]]//tr[position()=last()]/th/a/@href'
% raw_number, replace=[(' ', '')])(self.doc)
return CleanText('//table[@class="ca-table"][caption[span[text()="%s"]]]//tr[position()=last()-1]/th/a/@href'
% raw_number, replace=[(' ', '')])(self.doc)
class WealthPage(LoggedPage, CragrPage):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment