@@ -479,15 +479,15 @@ def create_new_project_and_delete( # noqa: C901, PLR0915
479479 api_request_context : APIRequestContext ,
480480 product_url : AnyUrl ,
481481) -> Iterator [
482- Callable [[tuple [RunningState ], bool , str | None , str | None ], dict [str , Any ]]
482+ Callable [[tuple [RunningState , ... ], bool , str | None , str | None ], dict [str , Any ]]
483483]:
484484 """The first available service currently displayed in the dashboard will be opened
485485 NOTE: cannot be used multiple times or going back to dashboard will fail!!
486486 """
487487 created_project_uuids = []
488488
489489 def _ ( # noqa: C901
490- expected_states : tuple [RunningState ],
490+ expected_states : tuple [RunningState , ... ],
491491 press_open : bool ,
492492 template_id : str | None ,
493493 service_version : str | None ,
@@ -505,6 +505,16 @@ def _( # noqa: C901
505505 if template_id is not None
506506 else _OPENING_NEW_EMPTY_PROJECT_MAX_WAIT_TIME
507507 )
508+
509+ # Enhanced context for better debugging when timeout occurs
510+ operation_type = "template" if template_id is not None else "new project"
511+ ctx .logger .info (
512+ "Waiting for project to open: %s (timeout: %s seconds, expected_states: %s)" ,
513+ operation_type ,
514+ (timeout + 10 * SECOND ) / 1000 ,
515+ expected_states ,
516+ )
517+
508518 with log_in_and_out .expect_event (
509519 "framereceived" , waiter , timeout = timeout + 10 * SECOND
510520 ):
@@ -685,8 +695,13 @@ def create_project_from_new_button(
685695) -> Callable [[str ], dict [str , Any ]]:
686696 def _ (plus_button_test_id : str ) -> dict [str , Any ]:
687697 start_study_from_plus_button (plus_button_test_id )
688- expected_states = (RunningState .UNKNOWN ,)
689- return create_new_project_and_delete (expected_states , False , None , None )
698+ expected_states = (RunningState .NOT_STARTED ,)
699+ return create_new_project_and_delete (
700+ expected_states ,
701+ False , # noqa: FBT003
702+ None ,
703+ None ,
704+ )
690705
691706 return _
692707
@@ -700,8 +715,13 @@ def create_project_from_template_dashboard(
700715) -> Callable [[str ], dict [str , Any ]]:
701716 def _ (template_id : str ) -> dict [str , Any ]:
702717 find_and_click_template_in_dashboard (template_id )
703- expected_states = (RunningState .UNKNOWN ,)
704- return create_new_project_and_delete (expected_states , True , template_id , None )
718+ expected_states = (RunningState .NOT_STARTED ,)
719+ return create_new_project_and_delete (
720+ expected_states ,
721+ True , # noqa: FBT003
722+ template_id ,
723+ None ,
724+ )
705725
706726 return _
707727
@@ -722,11 +742,15 @@ def _(
722742 find_and_start_service_in_dashboard (
723743 service_type , service_name , service_key_prefix
724744 )
725- expected_states = (RunningState .UNKNOWN ,)
745+ expected_states = (RunningState .NOT_STARTED ,)
726746 if service_type is ServiceType .COMPUTATIONAL :
727747 expected_states = (RunningState .NOT_STARTED ,)
748+ # press_open=True, template_id=None, service_version=service_version
728749 return create_new_project_and_delete (
729- expected_states , True , None , service_version
750+ expected_states ,
751+ True ,
752+ None ,
753+ service_version , # noqa: FBT003
730754 )
731755
732756 return _
0 commit comments