@@ -131,4 +131,76 @@ describe('My DSpace page', () => {
131131 testA11y ( 'ds-submission-import-external' ) ;
132132 } ) ;
133133
134+ it ( 'should let you filter to only archived items' , ( ) => {
135+ cy . visit ( '/mydspace' ) ;
136+
137+ //This page is restricted, so we will be shown the login form. Fill it in and submit it
138+ cy . loginViaForm ( Cypress . env ( 'DSPACE_TEST_ADMIN_USER' ) , Cypress . env ( 'DSPACE_TEST_ADMIN_PASSWORD' ) ) ;
139+
140+ //Wait for the page to display
141+ cy . get ( 'ds-my-dspace-page' ) . should ( 'be.visible' ) ;
142+
143+ //Open all filters
144+ cy . get ( '.filter-toggle' ) . click ( { multiple : true } ) ;
145+
146+ //The authority filter should be visible.
147+ cy . get ( 'ds-search-authority-filter' ) . should ( 'be.visible' ) ;
148+
149+ //Intercept the request to filter.
150+ cy . intercept ( {
151+ method : 'GET' ,
152+ url : '**/server/api/discover/facets/namedresourcetype**' ,
153+ query : {
154+ 'f.namedresourcetype' : 'item,authority'
155+ }
156+ } ) . as ( 'filterByItem' ) ;
157+
158+ //Apply the filter to the “archived” items.
159+ cy . get ( 'ds-search-authority-filter a[href*="f.namedresourcetype=item,authority"]' ) . find ( 'input[type="checkbox"]' ) . click ( ) ;
160+
161+ //Wait for the response.
162+ cy . wait ( '@filterByItem' ) ;
163+
164+ //Check that we have at least one item and that they all have the archived badge.
165+ cy . get ( 'ds-item-search-result-list-element-submission' ) . should ( 'exist' ) ;
166+ cy . get ( 'ds-item-search-result-list-element-submission' )
167+ . each ( ( $item ) => {
168+ cy . wrap ( $item )
169+ . find ( '.badge-archived' )
170+ . should ( 'exist' ) ;
171+ } ) ;
172+ } ) ;
173+
174+ it ( 'should upload a file via drag & drop and display it in the UI' , ( ) => {
175+ const fileName = 'example.pdf' ;
176+
177+ cy . visit ( '/mydspace' ) ;
178+
179+ //This page is restricted, so we will be shown the login form. Fill it in and submit it
180+ cy . loginViaForm ( Cypress . env ( 'DSPACE_TEST_SUBMIT_USER' ) , Cypress . env ( 'DSPACE_TEST_SUBMIT_USER_PASSWORD' ) ) ;
181+
182+ //Wait for the page to display
183+ cy . get ( 'ds-my-dspace-page' ) . should ( 'be.visible' ) ;
184+
185+ //Select the uploader and perform the drag-and-drop action.
186+ cy . get ( 'ds-uploader .ds-base-drop-zone' ) . selectFile ( `cypress/fixtures/${ fileName } ` , { action : 'drag-drop' } ) ;
187+
188+ //Validate that the file appears in the UI
189+ cy . get ( 'ds-uploader .filename' ) . should ( 'exist' ) . and ( 'contain.text' , fileName ) ;
190+
191+ //Validate that there is now exactly 1 file in the queue
192+ cy . get ( 'ds-uploader .upload-item-top' ) . should ( 'have.length' , 1 ) ;
193+
194+ // This should display the <ds-collection-dropdown> (popup window)
195+ cy . get ( 'ds-collection-dropdown' ) . should ( 'be.visible' ) ;
196+
197+ // Type in a known Collection name in the search box
198+ cy . get ( 'ds-collection-dropdown input[type="search"]' ) . type ( Cypress . env ( 'DSPACE_TEST_SUBMIT_COLLECTION_NAME' ) ) ;
199+
200+ // Click on the button matching that known Collection name
201+ cy . get ( 'ds-collection-dropdown li[title="' . concat ( Cypress . env ( 'DSPACE_TEST_SUBMIT_COLLECTION_NAME' ) ) . concat ( '"]' ) ) . click ( ) ;
202+
203+ // New URL should include /workspaceitems, as we've started a new submission
204+ cy . url ( ) . should ( 'include' , '/workspaceitems' ) ;
205+ } ) ;
134206} ) ;
0 commit comments