Skip to content

Commit

Permalink
🐛 Bugfix/e2e sim4life test (ITISFoundation#5219)
Browse files Browse the repository at this point in the history
  • Loading branch information
matusdrobuliak66 authored Jan 9, 2024
1 parent 744ff06 commit f533257
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/e2e-playwright/tests/sim4life.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import re
from http import HTTPStatus
from typing import Final

from playwright.sync_api import APIRequestContext, Page
from pydantic import AnyUrl
Expand All @@ -15,6 +16,10 @@
from tenacity.stop import stop_after_attempt
from tenacity.wait import wait_fixed

projects_uuid_pattern: Final[re.Pattern] = re.compile(
r"/projects/([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})"
)


def on_web_socket(ws) -> None:
print(f"WebSocket opened: {ws.url}")
Expand Down Expand Up @@ -42,7 +47,7 @@ def test_sim4life(
_textbox.press("Enter")
page.get_by_test_id(service_test_id).click()

with page.expect_response(re.compile(r"/projects/")) as response_info:
with page.expect_response(projects_uuid_pattern) as response_info:
# Project detail view pop-ups shows
page.get_by_test_id("openResource").click()
if product_billable:
Expand All @@ -51,8 +56,8 @@ def test_sim4life(
page.wait_for_timeout(1000)

# Get project uuid, will be used to delete this project in the end
uuid_pattern = re.compile(r"/projects/([0-9a-fA-F-]+)")
match = uuid_pattern.search(response_info.value.url)
print(f"projects uuid endpoint captured: {response_info.value.url}")
match = projects_uuid_pattern.search(response_info.value.url)
assert match
extracted_uuid = match.group(1)

Expand Down

0 comments on commit f533257

Please sign in to comment.