@@ -414,6 +414,13 @@ def log_in_and_out(
414414 page .wait_for_timeout (500 )
415415
416416
417+ def open_with_resources (page : Page , click_it : bool ):
418+ open_with_resources_button = page .get_by_test_id ("openWithResources" )
419+ if click_it :
420+ open_with_resources_button .click ()
421+ return open_with_resources_button
422+
423+
417424@pytest .fixture
418425def create_new_project_and_delete (
419426 page : Page ,
@@ -460,8 +467,7 @@ def _(
460467 if template_id is not None :
461468 if is_product_billable :
462469 open_button .click ()
463- # Open project with default resources
464- open_button = page .get_by_test_id ("openWithResources" )
470+ open_button = open_with_resources (page , False )
465471 # it returns a Long Running Task
466472 with page .expect_response (
467473 re .compile (rf"/projects\?from_study\={ template_id } " )
@@ -506,14 +512,10 @@ def wait_for_done(response):
506512 else :
507513 open_button .click ()
508514 if is_product_billable :
509- # Open project with default resources
510- open_button = page .get_by_test_id ("openWithResources" )
511- open_button .click ()
515+ open_with_resources (page , True )
512516 open_with_resources_clicked = True
513517 if is_product_billable and not open_with_resources_clicked :
514- # Open project with default resources
515- open_button = page .get_by_test_id ("openWithResources" )
516- open_button .click ()
518+ open_with_resources (page , True )
517519 project_data = response_info .value .json ()
518520 assert project_data
519521 project_uuid = project_data ["data" ]["uuid" ]
0 commit comments