-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update e2e tests #710
base: main
Are you sure you want to change the base?
update e2e tests #710
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,8 @@ def utils(): | |
|
||
@pytest.fixture | ||
def page(page, request) -> Page: | ||
page.context.set_default_timeout(5000) | ||
page.context.set_default_timeout(10000) | ||
page.set_default_timeout(10000) | ||
if "test_css_" not in request.node.name and callable(request.node.obj): | ||
|
||
def route_intercept(route): | ||
|
@@ -55,10 +56,19 @@ def create_user_page( | |
): # FIXME: browser_name specified until https://github.com/microsoft/playwright-pytest/issues/172 fixed | ||
# so that multiple browser flags in cli are honoured | ||
def _create_user_page(username, password) -> Page: | ||
page.goto("/sign-in") | ||
page.wait_for_timeout(10000) | ||
page.set_default_timeout(10000) | ||
page.goto("/sign-in", timeout=10000) | ||
page.get_by_label("Email address").fill(username) | ||
page.get_by_label("Password").fill(password) | ||
page.get_by_role("button", name="Sign in").click() | ||
|
||
# keycloak local | ||
# page.get_by_label("Username or email").click() | ||
# page.get_by_label("Username or email").fill(username) | ||
# page.get_by_label("Password", exact=True).click() | ||
# page.get_by_label("Password", exact=True).fill(password) | ||
# page.get_by_role("button", name="Sign In").click() | ||
return page | ||
|
||
return _create_user_page | ||
|
@@ -94,17 +104,28 @@ def _create_keycloak_user(groups, user_type): | |
user_pass = uuid.uuid4().hex | ||
user_first_name = "Test" | ||
user_last_name = "Name" | ||
user_id = keycloak_admin.create_user( | ||
{ | ||
"firstName": user_first_name, | ||
"lastName": user_last_name, | ||
"username": user_email, | ||
"email": user_email, | ||
"enabled": True, | ||
"groups": groups, | ||
"credentials": [{"value": user_pass, "type": "password"}], | ||
} | ||
) | ||
user_id = None # Initialize user_id to avoid UnboundLocalError | ||
|
||
try: | ||
user_id = keycloak_admin.create_user( | ||
{ | ||
"firstName": user_first_name, | ||
"lastName": user_last_name, | ||
"username": user_email, | ||
"email": user_email, | ||
"enabled": True, | ||
"groups": groups, | ||
"credentials": [{"value": user_pass, "type": "password"}], | ||
} | ||
) | ||
except Exception as e: | ||
print(f"Error creating user: {e}") | ||
raise # Re-raise the exception to fail the test | ||
|
||
if not user_id: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this block ever get hit if you raise the exception above? |
||
raise ValueError("User creation failed; no user ID returned.") | ||
|
||
print(f"Created user with ID: {user_id}, email: {user_email}") | ||
return user_id, user_email, user_pass | ||
|
||
return _create_keycloak_user | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,9 @@ def test_search_to_record(aau_user_page: Page): | |
|
||
aau_user_page.get_by_role("textbox").first.fill("a") | ||
aau_user_page.get_by_role("button", name="Search").click() | ||
expect(aau_user_page).to_have_url("search_results_summary?query=a") | ||
expect(aau_user_page).to_have_url( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so this test is the one about nvaigating to a record i na search journey. I think the tests in We just need to make sure that we cover the 2 ac in the ticket: https://national-archives.atlassian.net/jira/software/projects/AYR/boards/66?selectedIssue=AYR-1236&text=AYR-1236 The AC do have 2 actions and currently that file splits out these scenarios into 2 test classes with the second starting from the summary results page, but do whatever feels best to you. |
||
"search_results_summary?query=a&search_area=everywhere" | ||
) | ||
|
||
aau_user_page.get_by_role("cell").first.get_by_role("link").first.click() | ||
expect(aau_user_page).to_have_url( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we remove the comments