@@ -22,8 +22,8 @@ describe('Files user credentials', { testIsolation: true }, () => {
2222 cy . runOccCommand ( 'app:enable files_external' )
2323
2424 // Create some users
25- cy . createRandomUser ( ) . then ( ( user ) => user1 = user )
26- cy . createRandomUser ( ) . then ( ( user ) => user2 = user )
25+ cy . createRandomUser ( ) . then ( ( user ) => { user1 = user } )
26+ cy . createRandomUser ( ) . then ( ( user ) => { user2 = user } )
2727
2828 // This user will hold the webdav storage
2929 cy . createRandomUser ( ) . then ( ( user ) => {
@@ -34,7 +34,7 @@ describe('Files user credentials', { testIsolation: true }, () => {
3434
3535 after ( ( ) => {
3636 // Cleanup global storages
37- cy . runOccCommand ( ` files_external:list --output=json` ) . then ( ( { stdout} ) => {
37+ cy . runOccCommand ( ' files_external:list --output=json' ) . then ( ( { stdout } ) => {
3838 const list = JSON . parse ( stdout )
3939 list . forEach ( ( storage ) => cy . runOccCommand ( `files_external:delete --yes ${ storage . mount_id } ` ) , { failOnNonZeroExit : false } )
4040 } )
@@ -44,7 +44,7 @@ describe('Files user credentials', { testIsolation: true }, () => {
4444
4545 it ( 'Create a user storage with user credentials' , ( ) => {
4646 const url = Cypress . config ( 'baseUrl' ) + '/remote.php/dav/files/' + storageUser . userId
47- createStorageWithConfig ( storageUser . userId , StorageBackend . DAV , AuthBackend . UserProvided , { host : url . replace ( 'index.php/' , '' ) , ' secure' : 'false' } )
47+ createStorageWithConfig ( storageUser . userId , StorageBackend . DAV , AuthBackend . UserProvided , { host : url . replace ( 'index.php/' , '' ) , secure : 'false' } )
4848
4949 cy . login ( user1 )
5050 cy . visit ( '/apps/files/extstoragemounts' )
@@ -55,23 +55,23 @@ describe('Files user credentials', { testIsolation: true }, () => {
5555 triggerInlineActionForFile ( storageUser . userId , ACTION_CREDENTIALS_EXTERNAL_STORAGE )
5656
5757 // See credentials dialog
58- const storageDialog = cy . findByRole ( 'dialog' , { name : 'Storage credentials' } )
59- storageDialog . should ( 'be.visible' )
60- storageDialog . findByRole ( 'textbox' , { name : 'Login' } ) . type ( storageUser . userId )
61- storageDialog . get ( 'input[type="password"]' ) . type ( storageUser . password )
62- storageDialog . get ( 'button' ) . contains ( 'Confirm' ) . click ( )
63- storageDialog . should ( 'not.exist' )
58+ cy . findByRole ( 'dialog' , { name : 'Storage credentials' } ) . as ( 'storageDialog' )
59+ cy . get ( '@ storageDialog' ) . should ( 'be.visible' )
60+ cy . get ( '@ storageDialog' ) . findByRole ( 'textbox' , { name : 'Login' } ) . type ( storageUser . userId )
61+ cy . get ( '@ storageDialog' ) . get ( 'input[type="password"]' ) . type ( storageUser . password )
62+ cy . get ( '@ storageDialog' ) . get ( 'button' ) . contains ( 'Confirm' ) . click ( )
63+ cy . get ( '@ storageDialog' ) . should ( 'not.exist' )
6464
6565 // Storage dialog now closed, the user auth dialog should be visible
66- const authDialog = cy . findByRole ( 'dialog' , { name : 'Confirm your password' } )
67- authDialog . should ( 'be.visible' )
66+ cy . findByRole ( 'dialog' , { name : 'Confirm your password' } ) . as ( 'authDialog' )
67+ cy . get ( '@ authDialog' ) . should ( 'be.visible' )
6868 handlePasswordConfirmation ( user1 . password )
6969
7070 // Wait for the credentials to be set
7171 cy . wait ( '@setCredentials' )
7272
7373 // Auth dialog should be closed and the set credentials button should be gone
74- authDialog . should ( 'not.exist' , { timeout : 2000 } )
74+ cy . get ( '@ authDialog' ) . should ( 'not.exist' , { timeout : 2000 } )
7575 getActionEntryForFile ( storageUser . userId , ACTION_CREDENTIALS_EXTERNAL_STORAGE ) . should ( 'not.exist' )
7676
7777 // Finally, the storage should be accessible
@@ -82,7 +82,7 @@ describe('Files user credentials', { testIsolation: true }, () => {
8282
8383 it ( 'Create a user storage with GLOBAL user credentials' , ( ) => {
8484 const url = Cypress . config ( 'baseUrl' ) + '/remote.php/dav/files/' + storageUser . userId
85- createStorageWithConfig ( 'storage1' , StorageBackend . DAV , AuthBackend . UserGlobalAuth , { host : url . replace ( 'index.php/' , '' ) , ' secure' : 'false' } )
85+ createStorageWithConfig ( 'storage1' , StorageBackend . DAV , AuthBackend . UserGlobalAuth , { host : url . replace ( 'index.php/' , '' ) , secure : 'false' } )
8686
8787 cy . login ( user2 )
8888 cy . visit ( '/apps/files/extstoragemounts' )
@@ -93,23 +93,23 @@ describe('Files user credentials', { testIsolation: true }, () => {
9393 triggerInlineActionForFile ( 'storage1' , ACTION_CREDENTIALS_EXTERNAL_STORAGE )
9494
9595 // See credentials dialog
96- const storageDialog = cy . findByRole ( 'dialog' , { name : 'Storage credentials' } )
97- storageDialog . should ( 'be.visible' )
98- storageDialog . findByRole ( 'textbox' , { name : 'Login' } ) . type ( storageUser . userId )
99- storageDialog . get ( 'input[type="password"]' ) . type ( storageUser . password )
100- storageDialog . get ( 'button' ) . contains ( 'Confirm' ) . click ( )
101- storageDialog . should ( 'not.exist' )
96+ cy . findByRole ( 'dialog' , { name : 'Storage credentials' } ) . as ( 'storageDialog' )
97+ cy . get ( '@ storageDialog' ) . should ( 'be.visible' )
98+ cy . get ( '@ storageDialog' ) . findByRole ( 'textbox' , { name : 'Login' } ) . type ( storageUser . userId )
99+ cy . get ( '@ storageDialog' ) . get ( 'input[type="password"]' ) . type ( storageUser . password )
100+ cy . get ( '@ storageDialog' ) . get ( 'button' ) . contains ( 'Confirm' ) . click ( )
101+ cy . get ( '@ storageDialog' ) . should ( 'not.exist' )
102102
103103 // Storage dialog now closed, the user auth dialog should be visible
104- const authDialog = cy . findByRole ( 'dialog' , { name : 'Confirm your password' } )
105- authDialog . should ( 'be.visible' )
104+ cy . findByRole ( 'dialog' , { name : 'Confirm your password' } ) . as ( 'authDialog' )
105+ cy . get ( '@ authDialog' ) . should ( 'be.visible' )
106106 handlePasswordConfirmation ( user2 . password )
107107
108108 // Wait for the credentials to be set
109109 cy . wait ( '@setCredentials' )
110110
111111 // Auth dialog should be closed and the set credentials button should be gone
112- authDialog . should ( 'not.exist' , { timeout : 2000 } )
112+ cy . get ( '@ authDialog' ) . should ( 'not.exist' , { timeout : 2000 } )
113113 getActionEntryForFile ( 'storage1' , ACTION_CREDENTIALS_EXTERNAL_STORAGE ) . should ( 'not.exist' )
114114
115115 // Finally, the storage should be accessible
@@ -120,7 +120,7 @@ describe('Files user credentials', { testIsolation: true }, () => {
120120
121121 it ( 'Create another user storage while reusing GLOBAL user credentials' , ( ) => {
122122 const url = Cypress . config ( 'baseUrl' ) + '/remote.php/dav/files/' + storageUser . userId
123- createStorageWithConfig ( 'storage2' , StorageBackend . DAV , AuthBackend . UserGlobalAuth , { host : url . replace ( 'index.php/' , '' ) , ' secure' : 'false' } )
123+ createStorageWithConfig ( 'storage2' , StorageBackend . DAV , AuthBackend . UserGlobalAuth , { host : url . replace ( 'index.php/' , '' ) , secure : 'false' } )
124124
125125 cy . login ( user2 )
126126 cy . visit ( '/apps/files/extstoragemounts' )
0 commit comments