2
2
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
3
3
* SPDX-License-Identifier: AGPL-3.0-or-later
4
4
*/
5
- import { getNc } from "./commands"
5
+ import { getNc , restoreState , saveState } from "./commands"
6
6
import { login , logout } from "./commands/sessions"
7
7
import { createDBSnapshot , restoreDBSnapshot } from "./commands/snapshots"
8
8
import { User , createRandomUser , createUser , deleteUser , modifyUser , listUsers , getUserData , enableUser } from "./commands/users"
@@ -53,7 +53,7 @@ declare global {
53
53
* Query list of users on the Nextcloud instance
54
54
*
55
55
* **Warning**: Using this function will reset the previous session
56
- *
56
+ *
57
57
* @param details Set to true to fetch users with detailed information (default false)
58
58
* @return List of user IDs or list of Users (if details was set to true)
59
59
*/
@@ -71,30 +71,34 @@ declare global {
71
71
72
72
/**
73
73
* Enable or disable a given user
74
- *
74
+ *
75
75
* @param user user whom to enable or disable
76
76
* @param enable True to enable, false to disable (default is enable)
77
77
*/
78
78
enableUser ( user : User , enable ?: boolean ) : Cypress . Chainable < Cypress . Response < any > >
79
79
80
80
/**
81
- *
81
+ *
82
82
* Query metadata for, and in behalf, of a given user
83
83
*
84
84
* @param user User whom metadata to query
85
85
*/
86
86
getUserData ( user : User ) : Cypress . Chainable < Cypress . Response < any > >
87
87
88
88
/**
89
- * Create a snapshot of the current database
90
- */
91
- createDBSnapshot ( snapshot ?: string ) : Cypress . Chainable < string > ,
89
+ * Create a snapshot of the current DB and data folder state.
90
+ *
91
+ * @return string the ID of the snapshot
92
+ */
93
+ saveState ( ) : Cypress . Chainable < string >
92
94
93
95
/**
94
- * Restore a snapshot of the database
95
- * Default is the post-setup state
96
- */
97
- restoreDBSnapshot ( snapshot ?: string ) : Cypress . Chainable ,
96
+ * Restore a snapshot of the database
97
+ * Default is the post-setup state
98
+ *
99
+ * @param snapshot string the ID of the snapshot
100
+ */
101
+ restoreState ( snapshot : string ) : Cypress . Chainable < void >
98
102
}
99
103
}
100
104
}
@@ -117,8 +121,8 @@ export const addCommands = function() {
117
121
Cypress . Commands . add ( 'modifyUser' , modifyUser )
118
122
Cypress . Commands . add ( 'enableUser' , enableUser )
119
123
Cypress . Commands . add ( 'getUserData' , getUserData )
120
- Cypress . Commands . add ( 'createDBSnapshot ' , createDBSnapshot )
121
- Cypress . Commands . add ( 'restoreDBSnapshot ' , restoreDBSnapshot )
124
+ Cypress . Commands . add ( 'saveState ' , saveState )
125
+ Cypress . Commands . add ( 'restoreState ' , restoreState )
122
126
}
123
127
124
128
export { User }
0 commit comments