tests/e2e: fix URLs, use self.login()
This commit is contained in:
parent
402afa1e85
commit
380786bfde
5
Makefile
5
Makefile
|
@ -1,10 +1,5 @@
|
|||
all: lint-fix lint coverage gen
|
||||
|
||||
test-full:
|
||||
coverage run manage.py test --failfast -v 3 .
|
||||
coverage html
|
||||
coverage report
|
||||
|
||||
test-integration:
|
||||
k3d cluster create || exit 0
|
||||
k3d kubeconfig write -o ~/.kube/config --overwrite
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
from sys import platform
|
||||
from unittest.case import skipUnless
|
||||
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
|
||||
from tests.e2e.utils import USER, SeleniumTestCase, retry
|
||||
|
||||
|
||||
|
@ -16,10 +13,6 @@ class TestFlowsLogin(SeleniumTestCase):
|
|||
def test_login(self):
|
||||
"""test default login flow"""
|
||||
self.driver.get(f"{self.live_server_url}/flows/default-authentication-flow/")
|
||||
self.driver.find_element(By.ID, "id_uid_field").click()
|
||||
self.driver.find_element(By.ID, "id_uid_field").send_keys(USER().username)
|
||||
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.shell_url("authentik_core:overview"))
|
||||
self.login()
|
||||
self.wait_for_url(self.shell_url("/library"))
|
||||
self.assert_user(USER())
|
||||
|
|
|
@ -38,7 +38,7 @@ class TestFlowsStageSetup(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.shell_url("authentik_core:overview"))
|
||||
self.wait_for_url(self.shell_url("/library"))
|
||||
|
||||
self.driver.get(
|
||||
self.url(
|
||||
|
@ -51,7 +51,7 @@ class TestFlowsStageSetup(SeleniumTestCase):
|
|||
self.driver.find_element(By.ID, "id_password_repeat").send_keys(new_password)
|
||||
self.driver.find_element(By.CSS_SELECTOR, ".pf-c-button").click()
|
||||
|
||||
self.wait_for_url(self.shell_url("authentik_core:overview"))
|
||||
self.wait_for_url(self.shell_url("/library"))
|
||||
# Because USER() is cached, we need to get the user manually here
|
||||
user = User.objects.get(username=USER().username)
|
||||
self.assertTrue(user.check_password(new_password))
|
||||
|
|
|
@ -9,7 +9,6 @@ from channels.testing import ChannelsLiveServerTestCase
|
|||
from docker.client import DockerClient, from_env
|
||||
from docker.models.containers import Container
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
|
||||
from authentik import __version__
|
||||
from authentik.core.models import Application
|
||||
|
@ -22,7 +21,7 @@ from authentik.outposts.models import (
|
|||
OutpostType,
|
||||
)
|
||||
from authentik.providers.proxy.models import ProxyProvider
|
||||
from tests.e2e.utils import USER, SeleniumTestCase, retry
|
||||
from tests.e2e.utils import SeleniumTestCase, retry
|
||||
|
||||
|
||||
@skipUnless(platform.startswith("linux"), "requires local docker")
|
||||
|
@ -94,13 +93,7 @@ class TestProviderProxy(SeleniumTestCase):
|
|||
sleep(0.5)
|
||||
|
||||
self.driver.get("http://localhost:4180")
|
||||
|
||||
self.driver.find_element(By.ID, "id_uid_field").click()
|
||||
self.driver.find_element(By.ID, "id_uid_field").send_keys(USER().username)
|
||||
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.login()
|
||||
sleep(1)
|
||||
|
||||
full_body_text = self.driver.find_element(By.CSS_SELECTOR, "pre").text
|
||||
|
|
|
@ -8,7 +8,6 @@ from docker import DockerClient, from_env
|
|||
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.stdlib import get_logger
|
||||
|
||||
|
@ -90,11 +89,7 @@ class TestProviderSAML(SeleniumTestCase):
|
|||
)
|
||||
self.container = self.setup_client(provider)
|
||||
self.driver.get("http://localhost:9009")
|
||||
self.driver.find_element(By.ID, "id_uid_field").click()
|
||||
self.driver.find_element(By.ID, "id_uid_field").send_keys(USER().username)
|
||||
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.login()
|
||||
self.wait_for_url("http://localhost:9009/")
|
||||
|
||||
body = loads(self.driver.find_element(By.CSS_SELECTOR, "pre").text)
|
||||
|
@ -153,11 +148,7 @@ class TestProviderSAML(SeleniumTestCase):
|
|||
)
|
||||
self.container = self.setup_client(provider)
|
||||
self.driver.get("http://localhost:9009")
|
||||
self.driver.find_element(By.ID, "id_uid_field").click()
|
||||
self.driver.find_element(By.ID, "id_uid_field").send_keys(USER().username)
|
||||
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.login()
|
||||
self.assertEqual(
|
||||
app.name,
|
||||
self.driver.find_element(By.ID, "application-name").text,
|
||||
|
@ -227,11 +218,7 @@ class TestProviderSAML(SeleniumTestCase):
|
|||
application_slug=provider.application.slug,
|
||||
)
|
||||
)
|
||||
self.driver.find_element(By.ID, "id_uid_field").click()
|
||||
self.driver.find_element(By.ID, "id_uid_field").send_keys(USER().username)
|
||||
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.login()
|
||||
sleep(1)
|
||||
self.wait_for_url("http://localhost:9009/")
|
||||
|
||||
|
@ -295,11 +282,7 @@ class TestProviderSAML(SeleniumTestCase):
|
|||
PolicyBinding.objects.create(target=app, policy=negative_policy, order=0)
|
||||
self.container = self.setup_client(provider)
|
||||
self.driver.get("http://localhost:9009/")
|
||||
self.driver.find_element(By.ID, "id_uid_field").click()
|
||||
self.driver.find_element(By.ID, "id_uid_field").send_keys(USER().username)
|
||||
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.login()
|
||||
|
||||
self.wait.until(
|
||||
ec.presence_of_element_located((By.CSS_SELECTOR, "header > h1"))
|
||||
|
|
|
@ -141,7 +141,7 @@ class TestSourceOAuth2(SeleniumTestCase):
|
|||
self.driver.find_element(By.NAME, "username").send_keys(Keys.ENTER)
|
||||
|
||||
# Wait until we've logged in
|
||||
self.wait_for_url(self.shell_url("authentik_core:overview"))
|
||||
self.wait_for_url(self.shell_url("/library"))
|
||||
self.driver.get(self.url("authentik_core:user-details"))
|
||||
|
||||
self.assertEqual(
|
||||
|
@ -223,7 +223,7 @@ class TestSourceOAuth2(SeleniumTestCase):
|
|||
self.driver.find_element(By.CSS_SELECTOR, "button[type=submit]").click()
|
||||
|
||||
# Wait until we've logged in
|
||||
self.wait_for_url(self.shell_url("authentik_core:overview"))
|
||||
self.wait_for_url(self.shell_url("/library"))
|
||||
self.driver.get(self.url("authentik_core:user-details"))
|
||||
|
||||
self.assertEqual(
|
||||
|
@ -316,7 +316,7 @@ class TestSourceOAuth1(SeleniumTestCase):
|
|||
# Wait until we've loaded the user info page
|
||||
sleep(2)
|
||||
# Wait until we've logged in
|
||||
self.wait_for_url(self.shell_url("authentik_core:overview"))
|
||||
self.wait_for_url(self.shell_url("/library"))
|
||||
self.driver.get(self.url("authentik_core:user-details"))
|
||||
|
||||
self.assertEqual(
|
||||
|
|
|
@ -133,7 +133,7 @@ class TestSourceSAML(SeleniumTestCase):
|
|||
self.driver.find_element(By.ID, "password").send_keys(Keys.ENTER)
|
||||
|
||||
# Wait until we're logged in
|
||||
self.wait_for_url(self.shell_url("authentik_core:overview"))
|
||||
self.wait_for_url(self.shell_url("/library"))
|
||||
self.driver.get(self.url("authentik_core:user-details"))
|
||||
|
||||
# Wait until we've loaded the user info page
|
||||
|
@ -184,7 +184,7 @@ class TestSourceSAML(SeleniumTestCase):
|
|||
self.driver.find_element(By.ID, "password").send_keys(Keys.ENTER)
|
||||
|
||||
# Wait until we're logged in
|
||||
self.wait_for_url(self.shell_url("authentik_core:overview"))
|
||||
self.wait_for_url(self.shell_url("/library"))
|
||||
self.driver.get(self.url("authentik_core:user-details"))
|
||||
|
||||
# Wait until we've loaded the user info page
|
||||
|
@ -233,7 +233,7 @@ class TestSourceSAML(SeleniumTestCase):
|
|||
self.driver.find_element(By.ID, "password").send_keys(Keys.ENTER)
|
||||
|
||||
# Wait until we're logged in
|
||||
self.wait_for_url(self.shell_url("authentik_core:overview"))
|
||||
self.wait_for_url(self.shell_url("/library"))
|
||||
self.driver.get(self.url("authentik_core:user-details"))
|
||||
|
||||
# Wait until we've loaded the user info page
|
||||
|
|
Reference in a new issue