@@ -33,19 +33,19 @@ suite(`"Create Empty Workspace sample" test ${BASE_TEST_CONSTANTS.TEST_ENVIRONME
3333
3434 let firstWorkspaceName : string ;
3535 let secondWorkspaceName : string ;
36+ let thirdWorkspaceName : string ;
3637
3738 suiteSetup ( 'Login' , async function ( ) : Promise < void > {
3839 await loginTests . loginIntoChe ( ) ;
3940 } ) ;
4041
41- async function waitDashboardPage ( ) : Promise < void > {
42+ async function openCreateWorkspacePage ( ) : Promise < void > {
4243 await dashboard . openDashboard ( ) ;
4344 await dashboard . waitPage ( ) ;
4445 await browserTabsUtil . closeAllTabsExceptCurrent ( ) ;
4546
4647 await dashboard . clickCreateWorkspaceButton ( ) ;
4748 await createWorkspace . waitPage ( ) ;
48- expect ( await createWorkspace . isCreateNewWorkspaceCheckboxChecked ( ) ) . to . be . true ;
4949 }
5050
5151 async function waitWorkspaceReadiness ( ) : Promise < void > {
@@ -60,37 +60,70 @@ suite(`"Create Empty Workspace sample" test ${BASE_TEST_CONSTANTS.TEST_ENVIRONME
6060 }
6161 }
6262
63- test ( 'Verify "Create New" is on and a new workspace is created without warnings ' , async function ( ) : Promise < void > {
64- await waitDashboardPage ( ) ;
63+ test ( 'Step 1-2: Verify "Create New" is ON by default and create first Empty Workspace ' , async function ( ) : Promise < void > {
64+ await openCreateWorkspacePage ( ) ;
6565
6666 // verify "Create New" checkbox is checked by default
67- expect ( await createWorkspace . isCreateNewWorkspaceCheckboxChecked ( ) ) . to . be . true ;
67+ expect ( await createWorkspace . isCreateNewWorkspaceCheckboxChecked ( ) , '"Create New" checkbox should be checked by default' ) . to . be
68+ . true ;
69+
6870 await workspaceHandlingTests . createAndOpenWorkspace ( stackName , true ) ;
6971 await workspaceHandlingTests . obtainWorkspaceNameFromStartingPage ( ) ;
70- registerRunningWorkspace ( WorkspaceHandlingTests . getWorkspaceName ( ) ) ;
72+ firstWorkspaceName = WorkspaceHandlingTests . getWorkspaceName ( ) ;
73+ expect ( firstWorkspaceName , 'First workspace name should not be empty' ) . not . empty ;
74+ registerRunningWorkspace ( firstWorkspaceName ) ;
75+
7176 await waitWorkspaceReadiness ( ) ;
77+ } ) ;
7278
73- firstWorkspaceName = WorkspaceHandlingTests . getWorkspaceName ( ) ;
79+ test ( 'Step 3: Create second Empty Workspace with "Create New" ON - should succeed without warnings' , async function ( ) : Promise < void > {
80+ await openCreateWorkspacePage ( ) ;
81+
82+ // verify "Create New" checkbox is still checked
83+ expect ( await createWorkspace . isCreateNewWorkspaceCheckboxChecked ( ) , '"Create New" checkbox should be checked' ) . to . be . true ;
84+
85+ await workspaceHandlingTests . createAndOpenWorkspace ( stackName , true ) ;
86+ await workspaceHandlingTests . obtainWorkspaceNameFromStartingPage ( ) ;
87+ secondWorkspaceName = WorkspaceHandlingTests . getWorkspaceName ( ) ;
88+ expect ( secondWorkspaceName , 'Second workspace name should not be empty' ) . not . empty ;
89+ registerRunningWorkspace ( secondWorkspaceName ) ;
90+
91+ await waitWorkspaceReadiness ( ) ;
92+
93+ // empty Workspace sample generates unique names, so workspaces should have different names
94+ expect ( secondWorkspaceName , 'Second workspace should have a different name than the first one' ) . not . to . be . equal ( firstWorkspaceName ) ;
7495 } ) ;
7596
76- test ( 'Verify "Create New" is off and a new workspace is created' , async function ( ) : Promise < void > {
77- await waitDashboardPage ( ) ;
97+ test ( 'Step 4-5: Turn OFF "Create New" and create third Empty Workspace - should succeed without warnings' , async function ( ) : Promise < void > {
98+ await openCreateWorkspacePage ( ) ;
99+
100+ // turn off "Create New" checkbox
101+ await createWorkspace . setCreateNewWorkspaceCheckbox ( false ) ;
102+ expect ( await createWorkspace . isCreateNewWorkspaceCheckboxChecked ( ) , '"Create New" checkbox should be unchecked' ) . to . be . false ;
78103
79- expect ( await createWorkspace . isCreateNewWorkspaceCheckboxChecked ( ) ) . to . be . true ;
80104 await workspaceHandlingTests . createAndOpenWorkspace ( stackName , false ) ;
81105 await workspaceHandlingTests . obtainWorkspaceNameFromStartingPage ( ) ;
82- registerRunningWorkspace ( WorkspaceHandlingTests . getWorkspaceName ( ) ) ;
83- await waitWorkspaceReadiness ( ) ;
106+ thirdWorkspaceName = WorkspaceHandlingTests . getWorkspaceName ( ) ;
107+ expect ( thirdWorkspaceName , 'Third workspace name should not be empty' ) . not . empty ;
108+ registerRunningWorkspace ( thirdWorkspaceName ) ;
84109
85- secondWorkspaceName = WorkspaceHandlingTests . getWorkspaceName ( ) ;
110+ await waitWorkspaceReadiness ( ) ;
86111
87- // empty Workspace sample generates unique names, so workspaces should have different names
88- expect ( WorkspaceHandlingTests . getWorkspaceName ( ) ) . not . to . be . equal ( firstWorkspaceName ) ;
112+ // empty Workspace sample generates unique names, so all workspaces should have different names
113+ expect ( thirdWorkspaceName , 'Third workspace should have a different name than the first one' ) . not . to . be . equal ( firstWorkspaceName ) ;
114+ expect ( thirdWorkspaceName , 'Third workspace should have a different name than the second one' ) . not . to . be . equal ( secondWorkspaceName ) ;
89115 } ) ;
90116
91117 suiteTeardown ( 'Stop and delete all created workspaces' , async function ( ) : Promise < void > {
92- await workspaceHandlingTests . stopAndRemoveWorkspace ( firstWorkspaceName ) ;
93- await workspaceHandlingTests . stopAndRemoveWorkspace ( secondWorkspaceName ) ;
118+ if ( firstWorkspaceName ) {
119+ await workspaceHandlingTests . stopAndRemoveWorkspace ( firstWorkspaceName ) ;
120+ }
121+ if ( secondWorkspaceName ) {
122+ await workspaceHandlingTests . stopAndRemoveWorkspace ( secondWorkspaceName ) ;
123+ }
124+ if ( thirdWorkspaceName ) {
125+ await workspaceHandlingTests . stopAndRemoveWorkspace ( thirdWorkspaceName ) ;
126+ }
94127 } ) ;
95128
96129 suiteTeardown ( 'Unregister running workspace' , function ( ) : void {
0 commit comments