Skip to content
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

🐛 [e2e] _open_with_resources #6809

Merged
merged 13 commits into from
Nov 22, 2024
24 changes: 15 additions & 9 deletions tests/e2e-playwright/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import arrow
import pytest
from faker import Faker
from playwright.sync_api import APIRequestContext, BrowserContext, Page
from playwright.sync_api import APIRequestContext, BrowserContext, Page, expect
from playwright.sync_api._generated import Playwright
from pydantic import AnyUrl, TypeAdapter
from pytest_simcore.helpers.faker_factories import DEFAULT_TEST_PASSWORD
Expand Down Expand Up @@ -414,6 +414,17 @@ def log_in_and_out(
page.wait_for_timeout(500)


def _open_with_resources(page: Page, click_it: bool):
odeimaiz marked this conversation as resolved.
Show resolved Hide resolved
study_title_field = page.get_by_test_id("studyTitleField")
# wait until the title is automatically filled up
expect(study_title_field).not_to_have_value("", timeout=5000)

open_with_resources_button = page.get_by_test_id("openWithResources")
if click_it:
open_with_resources_button.click()
return open_with_resources_button


@pytest.fixture
def create_new_project_and_delete(
page: Page,
Expand Down Expand Up @@ -460,8 +471,7 @@ def _(
if template_id is not None:
if is_product_billable:
open_button.click()
# Open project with default resources
open_button = page.get_by_test_id("openWithResources")
open_button = _open_with_resources(page, False)
odeimaiz marked this conversation as resolved.
Show resolved Hide resolved
# it returns a Long Running Task
with page.expect_response(
re.compile(rf"/projects\?from_study\={template_id}")
Expand Down Expand Up @@ -506,14 +516,10 @@ def wait_for_done(response):
else:
open_button.click()
if is_product_billable:
# Open project with default resources
open_button = page.get_by_test_id("openWithResources")
open_button.click()
_open_with_resources(page, True)
odeimaiz marked this conversation as resolved.
Show resolved Hide resolved
open_with_resources_clicked = True
if is_product_billable and not open_with_resources_clicked:
# Open project with default resources
open_button = page.get_by_test_id("openWithResources")
open_button.click()
_open_with_resources(page, True)
odeimaiz marked this conversation as resolved.
Show resolved Hide resolved
project_data = response_info.value.json()
assert project_data
project_uuid = project_data["data"]["uuid"]
Expand Down
Loading