diff --git a/modules/axabanque/browser.py b/modules/axabanque/browser.py index b1efe82ce5bb96e503001a773dcaba18c53797fe..0bd8ad196a9a42482ba04f548ca15beef21017ae 100644 --- a/modules/axabanque/browser.py +++ b/modules/axabanque/browser.py @@ -451,6 +451,9 @@ def new_recipient(self, recipient, **params): # 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) diff --git a/modules/axabanque/pages/transfer.py b/modules/axabanque/pages/transfer.py index 64dbff5ce3613f325acdf54f981bb1e3120e2e00..c140781e042c15d0312dc35b0085c81953c992f7 100644 --- a/modules/axabanque/pages/transfer.py +++ b/modules/axabanque/pages/transfer.py @@ -148,6 +148,17 @@ def send_code(self, code): 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"]'