Skip to content

Commit

Permalink
tests/e2e: improve stability
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
  • Loading branch information
BeryJu committed Jun 11, 2022
1 parent 9a313f4 commit 1305965
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions tests/e2e/test_provider_oauth2_oidc.py
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions tests/e2e/test_provider_oauth2_oidc_implicit.py
Expand Up @@ -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)
Expand Down Expand Up @@ -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")))
Expand All @@ -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)
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 1305965

Please sign in to comment.