diff --git a/tests/e2e/test_provider_oauth2_oidc.py b/tests/e2e/test_provider_oauth2_oidc.py index 6c4055422fd..06a44ce8f0c 100644 --- a/tests/e2e/test_provider_oauth2_oidc.py +++ b/tests/e2e/test_provider_oauth2_oidc.py @@ -142,6 +142,7 @@ def test_authorization_consent_implied(self): self.driver.get("http://localhost:9009") self.login() self.wait.until(ec.presence_of_element_located((By.CSS_SELECTOR, "pre"))) + self.wait.until(ec.text_to_be_present_in_element((By.CSS_SELECTOR, "pre"), "{")) body = loads(self.driver.find_element(By.CSS_SELECTOR, "pre").text) self.assertEqual(body["IDTokenClaims"]["nickname"], self.user.username) @@ -206,6 +207,7 @@ def test_authorization_consent_explicit(self): ).click() self.wait.until(ec.presence_of_element_located((By.CSS_SELECTOR, "pre"))) + self.wait.until(ec.text_to_be_present_in_element((By.CSS_SELECTOR, "pre"), "{")) body = loads(self.driver.find_element(By.CSS_SELECTOR, "pre").text) self.assertEqual(body["IDTokenClaims"]["nickname"], self.user.username) diff --git a/tests/e2e/test_provider_oauth2_oidc_implicit.py b/tests/e2e/test_provider_oauth2_oidc_implicit.py index 8734f01c0d3..fa64165ea41 100644 --- a/tests/e2e/test_provider_oauth2_oidc_implicit.py +++ b/tests/e2e/test_provider_oauth2_oidc_implicit.py @@ -140,10 +140,10 @@ def test_authorization_consent_implied(self): self.container = self.setup_client() self.driver.get("http://localhost:9009/implicit/") - sleep(2) + self.wait.until(ec.title_contains("authentik")) self.login() self.wait.until(ec.presence_of_element_located((By.CSS_SELECTOR, "pre"))) - sleep(1) + self.wait.until(ec.text_to_be_present_in_element((By.CSS_SELECTOR, "pre"), "{")) body = loads(self.driver.find_element(By.CSS_SELECTOR, "pre").text) self.assertEqual(body["profile"]["nickname"], self.user.username) self.assertEqual(body["profile"]["name"], self.user.name) @@ -185,7 +185,7 @@ def test_authorization_consent_explicit(self): self.container = self.setup_client() self.driver.get("http://localhost:9009/implicit/") - sleep(2) + self.wait.until(ec.title_contains("authentik")) self.login() self.wait.until(ec.presence_of_element_located((By.CSS_SELECTOR, "ak-flow-executor"))) @@ -203,7 +203,7 @@ def test_authorization_consent_explicit(self): ).click() self.wait.until(ec.presence_of_element_located((By.CSS_SELECTOR, "pre"))) - sleep(1) + self.wait.until(ec.text_to_be_present_in_element((By.CSS_SELECTOR, "pre"), "{")) body = loads(self.driver.find_element(By.CSS_SELECTOR, "pre").text) self.assertEqual(body["profile"]["nickname"], self.user.username) @@ -250,7 +250,7 @@ def test_authorization_denied(self): self.container = self.setup_client() self.driver.get("http://localhost:9009/implicit/") - sleep(2) + self.wait.until(ec.title_contains("authentik")) self.login() self.wait.until(ec.presence_of_element_located((By.CSS_SELECTOR, "header > h1"))) self.assertEqual(