Skip to content

Commit 415fb2d

Browse files
committed
added new test for my-dspace page
1 parent c2e296c commit 415fb2d

3 files changed

Lines changed: 43 additions & 331 deletions

File tree

cypress/e2e/my-dspace.cy.ts

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { testA11y } from 'cypress/support/utils';
2+
import { method } from 'node_modules/cypress/types/bluebird';
23

34
describe('My DSpace page', () => {
45
it('should display recent submissions and pass accessibility tests', () => {
@@ -149,10 +150,7 @@ describe('My DSpace page', () => {
149150
//Intercept the request to filter.
150151
cy.intercept({
151152
method: 'GET',
152-
url: '**/server/api/discover/facets/namedresourcetype**',
153-
query: {
154-
'f.namedresourcetype': 'item,authority'
155-
}
153+
url: '/server/api/discover/search/objects**',
156154
}).as('filterByItem');
157155

158156
//Apply the filter to the “archived” items.
@@ -203,4 +201,42 @@ describe('My DSpace page', () => {
203201
// New URL should include /workspaceitems, as we've started a new submission
204202
cy.url().should('include', '/workspaceitems');
205203
});
204+
205+
it('should let you take task from workflow', () => {
206+
cy.visit('/mydspace');
207+
208+
//This page is restricted, so we will be shown the login form. Fill it in and submit it
209+
cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD'));
210+
211+
//Wait for the page to display
212+
cy.get('ds-my-dspace-page').should('be.visible');
213+
214+
//Intercept to await backend response
215+
cy.intercept({
216+
method: 'GET',
217+
url: '/server/api/discover/search/objects**'
218+
}).as('workflowSearch');
219+
220+
//Change view to see workflow tasks
221+
cy.get('ds-search-switch-configuration select').select('2: Object');
222+
223+
//Await backend search response
224+
cy.wait('@workflowSearch');
225+
226+
//Check that we have at least one item and that they all have the archived badge.
227+
cy.get('[data-test="objects"]')
228+
.find('[data-test="list-object"]')
229+
.each(($item) => {
230+
cy.wrap($item)
231+
.find('ds-claimed-task-actions, ds-pool-task-actions').should('exist')
232+
.within(() => {
233+
cy.get('button, a.btn').each(($btn) => {
234+
cy.wrap($btn)
235+
.should('exist')
236+
.and('be.visible')
237+
.and('not.be.disabled');
238+
});
239+
});
240+
});
241+
});
206242
});

0 commit comments

Comments
 (0)