File tree Expand file tree Collapse file tree 1 file changed +29
-1
lines changed
Expand file tree Collapse file tree 1 file changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -27,8 +27,36 @@ window._oc_webroot = url
2727
2828addCommands ( )
2929
30+ // Copy of the new login command as long as we are blocked to upgrade @nextcloud /cypress by cypress crashes
31+ const login = function ( user ) {
32+ cy . session ( user , function ( ) {
33+ cy . request ( '/csrftoken' ) . then ( ( { body } ) => {
34+ const requestToken = body . token
35+ cy . request ( {
36+ method : 'POST' ,
37+ url : '/login' ,
38+ body : {
39+ user : user . userId ,
40+ password : user . password ,
41+ requesttoken : requestToken ,
42+ } ,
43+ headers : {
44+ 'Content-Type' : 'application/x-www-form-urlencoded' ,
45+ // Add the Origin header so that the request is not blocked by the browser.
46+ Origin : ( Cypress . config ( 'baseUrl' ) ?? '' ) . replace ( 'index.php/' , '' ) ,
47+ } ,
48+ followRedirect : false ,
49+ } )
50+ } )
51+ } , {
52+ validate ( ) {
53+ cy . request ( '/apps/files' ) . its ( 'status' ) . should ( 'eq' , 200 )
54+ } ,
55+ } )
56+ }
57+
3058// Prepare the csrf-token for axios
31- Cypress . Commands . overwrite ( 'login' , ( login , user ) => {
59+ Cypress . Commands . overwrite ( 'login' , ( _login , user ) => {
3260 cy . window ( silent ) . then ( ( win ) => {
3361 win . location . href = 'about:blank'
3462 } )
You can’t perform that action at this time.
0 commit comments