Skip to content

Commit

Permalink
✅ [#390] Add test for OIDC login in frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
SilviaAmAm committed Oct 10, 2024
1 parent 80804e3 commit 1b1b26e
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions backend/src/openarchiefbeheer/api/tests/test_oidc_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,29 @@ async def test_login_admin_staff_with_oidc(self):
page_text = page.get_by_text("You don't have permission to")
await expect(page_text).to_be_visible()

# async def test_login_app_with_oidc(self):
# async with browser_page() as page:
# await page.goto(self.live_server_url)
# await page.wait_for_url(
# f"{self.live_server_url}/login?next=/destruction-lists"
# )
async def test_login_app_with_oidc(self):
async with browser_page() as page:
await page.goto(self.live_server_url)
await page.wait_for_url(
f"{self.live_server_url}/login?next=/destruction-lists"
)

login_button = page.get_by_text("Organisatie login")

# login_button = page.get_by_text("Organisatie login")
await login_button.click()

# await login_button.click()
username_field = page.get_by_role("textbox", name="username")
await username_field.fill(
"alice_doe"
) # configured in the Keycloak fixture as record manager

# username_field = page.get_by_role("textbox", name="username")
# await username_field.fill(
# "alice_doe"
# ) # configured in the Keycloak fixture as record manager
password_field = page.get_by_role("textbox", name="password")
await password_field.fill("aNic3Passw0rd")

# password_field = page.get_by_role("textbox", name="password")
# await password_field.fill("aNic3Passw0rd")
login_button = page.get_by_role("button", name="Sign In")
await login_button.click()

# await page.wait_for_url(f"{self.live_server_url}/destruction-lists")
await page.wait_for_url(f"{self.live_server_url}/destruction-lists")

# page_text = page.get_by_text("Vernietigingslijsten")
# await expect(page_text).to_be_visible()
page_text = page.get_by_role("heading", name="Vernietigingslijsten")
await expect(page_text).to_be_visible()

0 comments on commit 1b1b26e

Please sign in to comment.