Commit 7175b1c2 authored by Sylvie Ye's avatar Sylvie Ye Committed by Romain Bignon

[lcl] change xpath for transfer label

On transfer validation page, get reason with cut 'Motif : ' and skip html comment.
Get reason to check label error with 'transfer_check_label' instead of assert without message.

remove unused parameter on handle response:
- amount
- reason
- exec_date

Closes: 14399@sibi 8735@sibi 4979@sibi
parent 2aed8a52
......@@ -456,7 +456,7 @@ class LCLBrowser(LoginBrowser, StatesMixin):
self.page.transfer(amount, reason)
else:
self.page.deferred_transfer(amount, reason, exec_date)
return self.page.handle_response(account, recipient, amount, reason, exec_date)
return self.page.handle_response(account, recipient)
@need_login
def execute_transfer(self, transfer):
......
......@@ -142,6 +142,10 @@ class LCLModule(Module, CapBankWealth, CapBankTransferAddRecipient, CapContact,
def execute_transfer(self, transfer, **params):
return self.browser.execute_transfer(transfer)
def transfer_check_label(self, old, new):
old = re.sub(r'/', '', old).strip()
return super(LCLModule, self).transfer_check_label(old, new)
@only_for_websites('par')
def iter_contacts(self):
return self.browser.get_advisor()
......
......@@ -969,7 +969,7 @@ class TransferPage(LoggedPage, HTMLPage):
return acc_ids[0]
return acc_ids[1]
def handle_response(self, account, recipient, amount, reason, exec_date):
def handle_response(self, account, recipient):
transfer = Transfer()
transfer._account = account
......@@ -997,8 +997,9 @@ class TransferPage(LoggedPage, HTMLPage):
Regexp(CleanText('//div[@class="topBox"]/div[@class="date"]'), r'(\d{2}\/\d{2}\/\d{4})'),
dayfirst=True
)(self.doc)
transfer.label = reason
assert reason in CleanText('//div[@class="motif"]')(self.doc)
# skip html comment with filtering on text() content
transfer.label = CleanText('//div[@class="motif"]/text()[contains(., "Motif : ")]',
replace=[('Motif : ','')])(self.doc)
return transfer
......
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