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-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
@@ -260,12 +267,12 @@ describe('My DSpace page', () => {
260267 //Validate URL
261268 cy . url ( ) . should ( 'include' , 'configuration=workflow' ) ;
262269
263- //Wait to render the list and at leat one item
264- cy . get ( '[data-test="list-object"]' ) . should ( 'have.length.greaterThan' , 0 ) ;
270+ //Wait to render the list and at leat one item (supports list or grid view)
271+ cy . get ( SEARCH_RESULT_VIEW_MODE_SELECTOR ) . should ( 'have.length.greaterThan' , 0 ) ;
265272 cy . get ( '[data-test="claim-button"]' ) . should ( 'exist' ) ;
266273
267274 //Check that we have at least one item in worflow search, the item have claim-button and can click in it.
268- cy . get ( '[data-test="list-object"]' )
275+ cy . get ( SEARCH_RESULT_VIEW_MODE_SELECTOR )
269276 . then ( ( $items ) => {
270277 const itemWithClaim = [ ...$items ] . find ( item =>
271278 item . querySelector ( '[data-test="claim-button"]' ) ,
0 commit comments