From 6428801270da94534b45547645f3664867912f96 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 15 Sep 2020 10:29:59 +0200 Subject: [PATCH] e2e: update e2e tests for new AccessDenied response --- e2e/test_provider_oauth2_github.py | 6 +++++- e2e/test_provider_oauth2_oidc.py | 5 ++++- e2e/test_provider_saml.py | 6 +++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/e2e/test_provider_oauth2_github.py b/e2e/test_provider_oauth2_github.py index cfa7459b1..f2a60a3d0 100644 --- a/e2e/test_provider_oauth2_github.py +++ b/e2e/test_provider_oauth2_github.py @@ -6,6 +6,7 @@ from unittest.case import skipUnless from docker.types import Healthcheck from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys +from selenium.webdriver.support import expected_conditions as ec from e2e.utils import USER, SeleniumTestCase from passbook.core.models import Application @@ -214,7 +215,10 @@ class TestProviderOAuth2Github(SeleniumTestCase): self.driver.find_element(By.ID, "id_uid_field").send_keys(Keys.ENTER) self.driver.find_element(By.ID, "id_password").send_keys(USER().username) self.driver.find_element(By.ID, "id_password").send_keys(Keys.ENTER) - self.wait_for_url(self.url("passbook_flows:denied")) + + self.wait.until( + ec.presence_of_element_located((By.CSS_SELECTOR, "header > h1")) + ) self.assertEqual( self.driver.find_element(By.CSS_SELECTOR, "header > h1").text, "Permission denied", diff --git a/e2e/test_provider_oauth2_oidc.py b/e2e/test_provider_oauth2_oidc.py index 317f32977..d504d9c49 100644 --- a/e2e/test_provider_oauth2_oidc.py +++ b/e2e/test_provider_oauth2_oidc.py @@ -285,7 +285,10 @@ class TestProviderOAuth2OIDC(SeleniumTestCase): self.driver.find_element(By.ID, "id_uid_field").send_keys(Keys.ENTER) self.driver.find_element(By.ID, "id_password").send_keys(USER().username) self.driver.find_element(By.ID, "id_password").send_keys(Keys.ENTER) - self.wait_for_url(self.url("passbook_flows:denied")) + + self.wait.until( + ec.presence_of_element_located((By.CSS_SELECTOR, "header > h1")) + ) self.assertEqual( self.driver.find_element(By.CSS_SELECTOR, "header > h1").text, "Permission denied", diff --git a/e2e/test_provider_saml.py b/e2e/test_provider_saml.py index 2272a2956..9a68b075f 100644 --- a/e2e/test_provider_saml.py +++ b/e2e/test_provider_saml.py @@ -8,6 +8,7 @@ from docker.models.containers import Container from docker.types import Healthcheck from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys +from selenium.webdriver.support import expected_conditions as ec from structlog import get_logger from e2e.utils import USER, SeleniumTestCase @@ -206,7 +207,10 @@ class TestProviderSAML(SeleniumTestCase): self.driver.find_element(By.ID, "id_uid_field").send_keys(Keys.ENTER) self.driver.find_element(By.ID, "id_password").send_keys(USER().username) self.driver.find_element(By.ID, "id_password").send_keys(Keys.ENTER) - self.wait_for_url(self.url("passbook_flows:denied")) + + self.wait.until( + ec.presence_of_element_located((By.CSS_SELECTOR, "header > h1")) + ) self.assertEqual( self.driver.find_element(By.CSS_SELECTOR, "header > h1").text, "Permission denied",