Skip to content

Commit

Permalink
tests: new fix
Browse files Browse the repository at this point in the history
  • Loading branch information
g-saracca committed Aug 8, 2024
1 parent e717e2b commit 8027032
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { TestsUtils } from '../../../shared/TestsUtils'
import { faker } from '@faker-js/faker'

describe('Create Collection', () => {
before(() => {
Expand All @@ -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')
})
})

0 comments on commit 8027032

Please sign in to comment.