1- import { testA11y } from 'cypress/support/utils' ;
1+ import {
2+ SEARCH_RESULT_VIEW_MODE_SELECTOR ,
3+ switchToListView ,
4+ testA11y ,
5+ } from 'cypress/support/utils' ;
26
37describe ( 'My DSpace page' , ( ) => {
48 it ( 'should display recent submissions and pass accessibility tests' , ( ) => {
@@ -9,8 +13,8 @@ describe('My DSpace page', () => {
913
1014 cy . get ( 'ds-my-dspace-page' ) . should ( 'be.visible' ) ;
1115
12- // At least one recent submission should be displayed
13- cy . get ( '[data-test="list-object"]' ) . should ( 'be.visible' ) ;
16+ // At least one recent submission should be displayed (supports list or grid view)
17+ cy . get ( SEARCH_RESULT_VIEW_MODE_SELECTOR ) . should ( 'be.visible' ) ;
1418
1519 // Click each filter toggle to open *every* filter
1620 // (As we want to scan filter section for accessibility issues as well)
@@ -86,6 +90,9 @@ describe('My DSpace page', () => {
8690 // Close any open notifications, to make sure they don't get in the way of next steps
8791 cy . get ( '[data-bs-dismiss="alert"]' ) . click ( { multiple : true } ) ;
8892
93+ // Switch to list view so that edit/delete action buttons are visible
94+ switchToListView ( ) ;
95+
8996 // This is the GET command that will actually run the search
9097 cy . intercept ( 'GET' , '**/server/api/discover/search/objects*' ) . as ( 'search-results' ) ;
9198 // On MyDSpace, find the submission we just created via its ID
@@ -164,6 +171,9 @@ describe('My DSpace page', () => {
164171 //Wait for the response.
165172 cy . wait ( '@filterByItem' ) ;
166173
174+ // Switch to list view so that list-specific result elements are visible
175+ switchToListView ( ) ;
176+
167177 //Check that we have at least one item and that they all have the archived badge.
168178 cy . get ( 'ds-item-search-result-list-element-submission' ) . should ( 'exist' ) ;
169179 cy . get ( 'ds-item-search-result-list-element-submission' )
@@ -259,12 +269,12 @@ describe('My DSpace page', () => {
259269 //Validate URL
260270 cy . url ( ) . should ( 'include' , 'configuration=workflow' ) ;
261271
262- //Wait to render the list and at leat one item
263- cy . get ( '[data-test="list-object"]' ) . should ( 'have.length.greaterThan' , 0 ) ;
272+ //Wait to render the list and at leat one item (supports list or grid view)
273+ cy . get ( SEARCH_RESULT_VIEW_MODE_SELECTOR ) . should ( 'have.length.greaterThan' , 0 ) ;
264274 cy . get ( '[data-test="claim-button"]' ) . should ( 'exist' ) ;
265275
266276 //Check that we have at least one item in worflow search, the item have claim-button and can click in it.
267- cy . get ( '[data-test="list-object"]' )
277+ cy . get ( SEARCH_RESULT_VIEW_MODE_SELECTOR )
268278 . then ( ( $items ) => {
269279 const itemWithClaim = [ ...$items ] . find ( item =>
270280 item . querySelector ( '[data-test="claim-button"]' ) ,
0 commit comments