Skip to content

Commit

Permalink
more test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ruizajtruss committed Apr 18, 2024
1 parent ddc31b3 commit a72efe8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -940,21 +940,22 @@ describe('RateDetailsv2', () => {

//Additional actuary contacts
const contacts = screen.getAllByTestId('actuary-contact')
expect(contacts).toHaveLength(1)
expect(contacts).toHaveLength(2)

//Adding another addtional actuary contact
await user.click(addActuaryContact)

const contactsPostClick = screen.getAllByTestId('actuary-contact')
expect(contactsPostClick).toHaveLength(2)
expect(contactsPostClick).toHaveLength(3)

//Testing removal of actuary contact
const removeButtons = screen.getAllByText('Remove')
expect(removeButtons).toHaveLength(2)
const removeButtons = screen.getAllByTestId('removeContactBtn')
expect(removeButtons).toHaveLength(3)
await user.click(removeButtons[0])

const removeButtonsPostRemoval = screen.getAllByText('Remove')
expect(removeButtonsPostRemoval).toHaveLength(1)
const removeButtonsPostRemoval =
screen.getAllByTestId('removeContactBtn')
expect(removeButtonsPostRemoval).toHaveLength(2)
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ export const SingleRateFormFields = ({
remove(index)
setNewActuaryContactButtonFocus()
}}
data-testid="removeContactBtn"
>
Remove
</Button>
Expand Down
18 changes: 11 additions & 7 deletions services/app-web/src/testHelpers/jestRateHelpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,15 @@ const fillOutIndexRate = async (screen: Screen, index: number) => {
expect(
withinTargetRateCert.queryByText('Date certified')
).toBeInTheDocument()
expect(withinTargetRateCert.queryByText('Name')).toBeInTheDocument()
expect(
withinTargetRateCert.queryByText('Title/Role')
withinTargetRateCert.queryAllByText('Name')[0]
).toBeInTheDocument()
expect(
withinTargetRateCert.queryAllByText('Title/Role')[0]
).toBeInTheDocument()
expect(
withinTargetRateCert.queryAllByText('Email')[0]
).toBeInTheDocument()
expect(withinTargetRateCert.queryByText('Email')).toBeInTheDocument()
})

const startDateInputs = withinTargetRateCert.getAllByLabelText('Start date')
Expand All @@ -93,16 +97,16 @@ const fillOutIndexRate = async (screen: Screen, index: number) => {
await userEvent.paste('12/01/2021')

// fill out actuary contact
withinTargetRateCert.getByLabelText('Name').focus()
withinTargetRateCert.getAllByLabelText('Name')[0].focus()
await userEvent.paste(`Actuary Contact Person ${index}`)

withinTargetRateCert.getByLabelText('Title/Role').focus()
withinTargetRateCert.getAllByLabelText('Title/Role')[0].focus()
await userEvent.paste(`Actuary Contact Title ${index}`)

withinTargetRateCert.getByLabelText('Email').focus()
withinTargetRateCert.getAllByLabelText('Email')[0].focus()
await userEvent.paste(`actuarycontact${index}@test.com`)

await userEvent.click(withinTargetRateCert.getByLabelText('Mercer'))
await userEvent.click(withinTargetRateCert.getAllByLabelText('Mercer')[0])
}

const rateCertifications = (screen: Screen) => {
Expand Down

0 comments on commit a72efe8

Please sign in to comment.