Commit 55ab039b authored by Damien Mat's avatar Damien Mat Committed by Vincent A

[bred] handle unavailable page

We can end up on that page after a redirection,
so BrowserUnavailable is raised inside on_load.
parent d978b119
......@@ -50,6 +50,7 @@
TokenPage, MoveUniversePage, SwitchPage,
LoansPage, AccountsPage, IbanPage, LifeInsurancesPage,
SearchPage, ProfilePage, ErrorPage, ErrorCodePage, LinebourseLoginPage,
from .transfer_pages import (
RecipientListPage, EmittersListPage, ListAuthentPage,
......@@ -84,6 +85,7 @@ class BredBrowser(TwoFactorBrowser):
search = URL(r'/transactionnel/services/applications/operations/getSearch/', SearchPage)
profile = URL(r'/transactionnel/services/rest/User/user', ProfilePage)
error_code = URL(r'/.*\?errorCode=.*', ErrorCodePage)
unavailable_page = URL(r'/ERREUR/', UnavailablePage)
accounts_twofa = URL(r'/transactionnel/v2/services/rest/Account/accounts', AccountsTwoFAPage)
list_authent = URL(r'/transactionnel/services/applications/authenticationstrong/listeAuthent/(?P<context>\w+)', ListAuthentPage)
......@@ -402,3 +402,14 @@ def on_load(self):
raise BrowserUnavailable(msg)
assert False, 'Error %s is not handled yet.' % code
class UnavailablePage(HTMLPage):
def is_here(self):
return CleanText('//h1[contains(text(), "Site en maintenance")]', default=None)(self.doc)
def on_load(self):
msg = CleanText('//div[contains(text(), "intervention technique est en cours")]', default=None)(self.doc)
if msg:
raise BrowserUnavailable(msg)
raise AssertionError('Ended up to this error page, message not handled yet.')
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