From 1e18d0138872ed14aba5a9157f601e4ee688664e Mon Sep 17 00:00:00 2001 From: Sylvie Ye Date: Fri, 29 Mar 2019 18:16:51 +0100 Subject: [PATCH] [axabanque] handle new recipient error message users without checking accounts can't add new recipient --- modules/axabanque/browser.py | 3 +++ modules/axabanque/pages/transfer.py | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/modules/axabanque/browser.py b/modules/axabanque/browser.py index b1efe82ce5..0bd8ad196a 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 64dbff5ce3..c140781e04 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"]' -- GitLab