e2e: further cleanup tests, directly navigate to user-settings instead of click

This commit is contained in:
Jens Langhammer 2020-09-29 00:27:58 +02:00
parent e54b98a80e
commit 5da4ff4ff1
6 changed files with 14 additions and 26 deletions

View File

@ -66,8 +66,7 @@ class TestFlowsOTP(SeleniumTestCase):
)
self.driver.find_element(By.CSS_SELECTOR, ".pf-c-page__header").click()
self.driver.find_element(By.ID, "user-settings").click()
self.wait_for_url(self.url("passbook_core:user-settings"))
self.driver.get(self.url("passbook_core:user-settings"))
self.driver.find_element(By.LINK_TEXT, "Time-based OTP").click()

View File

@ -149,13 +149,7 @@ class TestProviderOAuth2Github(SeleniumTestCase):
"GitHub Compatibility: Access you Email addresses",
self.driver.find_element(By.ID, "scope-user:email").text,
)
self.driver.find_element(
By.CSS_SELECTOR,
(
"form[action='/flows/b/default-provider-authorization-explicit-consent/'] "
"[type=submit]"
),
).click()
self.driver.find_element(By.CSS_SELECTOR, ("[type=submit]"),).click()
self.wait_for_url("http://localhost:3000/?orgId=1")
self.driver.get("http://localhost:3000/profile")

View File

@ -140,10 +140,9 @@ class TestSourceOAuth2(SeleniumTestCase):
self.driver.find_element(By.NAME, "username").send_keys(Keys.ENTER)
# Wait until we've loaded the user info page
self.wait.until(ec.presence_of_element_located((By.LINK_TEXT, "foo")))
self.driver.find_element(By.LINK_TEXT, "foo").click()
self.wait.until(ec.presence_of_element_located((By.ID, "user-settings")))
self.driver.get(self.url("passbook_core:user-settings"))
self.wait_for_url(self.url("passbook_core:user-settings"))
self.assertEqual(
self.driver.find_element(By.ID, "user-settings").text, "foo",
)
@ -222,11 +221,9 @@ class TestSourceOAuth2(SeleniumTestCase):
)
self.driver.find_element(By.CSS_SELECTOR, "button[type=submit]").click()
# Wait until we've loaded the user info page
self.wait.until(ec.presence_of_element_located((By.LINK_TEXT, "foo")))
self.driver.find_element(By.LINK_TEXT, "foo").click()
self.wait.until(ec.presence_of_element_located((By.ID, "user-settings")))
self.driver.get(self.url("passbook_core:user-settings"))
self.wait_for_url(self.url("passbook_core:user-settings"))
self.assertEqual(
self.driver.find_element(By.ID, "user-settings").text, "foo",
)
@ -316,11 +313,9 @@ class TestSourceOAuth1(SeleniumTestCase):
self.driver.find_element(By.CSS_SELECTOR, "[name='confirm']").click()
# Wait until we've loaded the user info page
sleep(1)
self.wait.until(ec.presence_of_element_located((By.LINK_TEXT, "example-user")))
self.driver.find_element(By.LINK_TEXT, "example-user").click()
self.wait.until(ec.presence_of_element_located((By.ID, "user-settings")))
self.driver.get(self.url("passbook_core:user-settings"))
self.wait_for_url(self.url("passbook_core:user-settings"))
self.assertEqual(
self.driver.find_element(By.ID, "user-settings").text, "example-user",
)

View File

@ -131,7 +131,7 @@ class TestSourceSAML(SeleniumTestCase):
# Wait until we're logged in
self.wait.until(ec.presence_of_element_located((By.ID, "user-settings")))
self.driver.find_element(By.ID, "user-settings").click()
self.driver.get(self.url("passbook_core:user-settings"))
# Wait until we've loaded the user info page
self.wait.until(ec.presence_of_element_located((By.ID, "id_username")))
@ -180,7 +180,7 @@ class TestSourceSAML(SeleniumTestCase):
# Wait until we're logged in
self.wait.until(ec.presence_of_element_located((By.ID, "user-settings")))
self.driver.find_element(By.ID, "user-settings").click()
self.driver.get(self.url("passbook_core:user-settings"))
# Wait until we've loaded the user info page
self.wait.until(ec.presence_of_element_located((By.ID, "id_username")))
@ -227,7 +227,7 @@ class TestSourceSAML(SeleniumTestCase):
# Wait until we're logged in
self.wait.until(ec.presence_of_element_located((By.ID, "user-settings")))
self.driver.find_element(By.ID, "user-settings").click()
self.driver.get(self.url("passbook_core:user-settings"))
# Wait until we've loaded the user info page
self.wait.until(ec.presence_of_element_located((By.ID, "id_username")))

View File

@ -18,7 +18,7 @@ from passbook.flows.planner import PLAN_CONTEXT_PENDING_USER, FlowPlanner
LOGGER = get_logger()
class FlowPlanProcess(Process):
class FlowPlanProcess(Process): # pragma: no cover
"""Test process which executes flow planner"""
def __init__(self, index, return_dict, flow, user) -> None:
@ -46,7 +46,7 @@ class FlowPlanProcess(Process):
self.return_dict[self.index] = diffs
class Command(BaseCommand):
class Command(BaseCommand): # pragma: no cover
"""Benchmark passbook"""
def add_arguments(self, parser):

View File

@ -8,7 +8,7 @@ LOGGER = get_logger()
@CELERY_APP.task()
def backup_database():
def backup_database(): # pragma: no cover
"""Backup database"""
management.call_command("dbbackup")
LOGGER.info("Successfully backed up database.")