Commit 1e18d013 authored by Sylvie Ye's avatar Sylvie Ye Committed by Romain Bignon

[axabanque] handle new recipient error message

users without checking accounts can't add new recipient
parent bdf368c8
......@@ -451,6 +451,9 @@ class AXABanque(AXABrowser, StatesMixin):
# Confirm that user want to add recipient
self.page.continue_new_recipient()
if self.recipient_confirmation_page.is_here():
self.page.check_errors()
assert self.add_recipient.is_here()
self.page.set_new_recipient_iban(recipient.iban)
rcpt = self.copy_recipient_obj(recipient)
......
......@@ -148,6 +148,17 @@ class RecipientConfirmationPage(LoggedPage, HTMLPage):
def is_add_recipient_confirmation(self):
return self.doc.xpath('//table[@id="idConfirmation"]//p[contains(., "Votre bénéficiaire est en cours de création automatique")]')
def check_errors(self):
# check if user can add new recipient
errors_id = ('popinClientNonEligible', 'popinClientNonEligibleBis')
for error_id in errors_id:
if self.doc.xpath('//script[contains(text(), "showDivJQInfo(\'%s\')")]' % error_id):
msg = CleanText('//div[@id="%s"]//p' % error_id)(self.doc)
# get the first sentence of information message
# beacause the message is too long and contains unnecessary recommendations
raise AddRecipientBankError(message=msg.split('.')[0])
class AddRecipientPage(LoggedPage, HTMLPage):
is_here = '//table[@id="tab_SaisieBenef"]'
......
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