diff --git a/src/sections/create-collection/collection-form/useSubmitCollection.ts b/src/sections/create-collection/collection-form/useSubmitCollection.ts index 19e8fb09d..c917ed0cd 100644 --- a/src/sections/create-collection/collection-form/useSubmitCollection.ts +++ b/src/sections/create-collection/collection-form/useSubmitCollection.ts @@ -5,7 +5,7 @@ import { createCollection } from '../../../collection/domain/useCases/createColl import { CollectionRepository } from '../../../collection/domain/repositories/CollectionRepository' import { CollectionDTO } from '../../../collection/domain/useCases/DTOs/CollectionDTO' import { CollectionFormData, CollectionFormValuesOnSubmit } from './CollectionForm' -import { Route } from '../../Route.enum' +import { RouteWithParams } from '../../Route.enum' import { JSDataverseWriteErrorHandler } from '../../../shared/helpers/JSDataverseWriteErrorHandler' export enum SubmissionStatus { @@ -60,7 +60,7 @@ export function useSubmitCollection( setSubmitError(null) setSubmissionStatus(SubmissionStatus.SubmitComplete) - navigate(`${Route.COLLECTIONS}/${newCollection.alias}`, { + navigate(RouteWithParams.COLLECTIONS(newCollection.alias), { state: { created: true } }) return diff --git a/tests/e2e-integration/e2e/sections/create-collection/CreateCollection.spec.tsx b/tests/e2e-integration/e2e/sections/create-collection/CreateCollection.spec.tsx index 093871cb8..948efddd4 100644 --- a/tests/e2e-integration/e2e/sections/create-collection/CreateCollection.spec.tsx +++ b/tests/e2e-integration/e2e/sections/create-collection/CreateCollection.spec.tsx @@ -1,4 +1,5 @@ import { TestsUtils } from '../../../shared/TestsUtils' +import { faker } from '@faker-js/faker' describe('Create Collection', () => { before(() => { @@ -12,13 +13,18 @@ describe('Create Collection', () => { it('navigates to the collection page after submitting a valid form', () => { cy.visit('/spa/collections/root/create') - cy.findByLabelText(/^Identifier/i).type('some-alias') + const collectionName = faker.lorem.words(3) + + cy.findByLabelText(/^Collection Name/i).clear() + cy.findByLabelText(/^Collection Name/i).type(collectionName) + + cy.findByRole('button', { name: 'Apply suggestion' }).click() cy.findByLabelText(/^Category/i).select(1) cy.findByRole('button', { name: 'Create Collection' }).click() - cy.findByRole('heading', { name: 'Dataverse Admin Collection' }).should('exist') + cy.findByRole('heading', { name: collectionName }).should('exist') cy.findByText('Success!').should('exist') }) })