Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MCR-4783: withdraw rate e2e test #3079

Merged
merged 4 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions services/cypress/integration/cmsWorkflow/rateReview.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,50 @@ describe('CMS user can view rate reviews', () => {
cy.interceptGraphQL()
})

it('and withdraw a rate', () => {
cy.interceptFeatureFlags({
'withdraw-rate': true,
})
cy.apiAssignDivisionToCMSUser(cmsUser(), 'DMCO').then(() => {
// Create a new contract and rates submission with two attached rates
cy.apiCreateAndSubmitContractWithRates(stateUser()).then(
(contract) => {
const latestSubmission = contract.packageSubmissions[0]
const rate1 = latestSubmission.rateRevisions[0]

// Then check both rates in rate reviews table
cy.logInAsCMSUser({
initialURL: `/dashboard/rate-reviews`,
})

cy.get('table')
.findByTestId(`rate-link-${rate1.rateID}`)
.should('exist')
// click the first rate to navigate to rate summary page
cy.get('table')
.findByTestId(`rate-link-${rate1.rateID}`)
.click()
cy.url({ timeout: 10_000 }).should('contain', rate1.rateID)
cy.findByRole('heading', {
name: `${rate1.formData.rateCertificationName}`,
}).should('exist')

cy.findByRole('button', { name: 'Withdraw rate' }).click()

cy.findByText('Withdraw a rate').should('exist')

cy.get('#rateWithdrawReason').type('Withdrawn for testing')

cy.findByRole('button', { name: 'Withdraw rate' }).click()

cy.url({ timeout: 20_000 }).should('contain', `rates/${rate1.rateID}`)

cy.findByTestId('rateWithdrawBanner').should('exist')
}
)
})
})

// NEEDS TO BE REWRITTEN AS API TEST WE FINISH CONTRACT API EPIC
it.skip('and navigate to a specific rate from the rates dashboard', () => {
cy.apiAssignDivisionToCMSUser(cmsUser(), 'DMCO').then(() => {
Expand Down
1 change: 1 addition & 0 deletions services/cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Cypress.Commands.add('interceptGraphQL', () => {
aliasQuery(req, 'fetchContractWithQuestions')
aliasQuery(req, 'indexHealthPlanPackages')
aliasQuery(req, 'indexRates')
aliasQuery(req, 'indexRatesForDashboard')
aliasQuery(req, 'indexContractsForDashboard')
aliasQuery(req, 'fetchContract')
aliasQuery(req, 'fetchMcReviewSettings')
Expand Down
13 changes: 8 additions & 5 deletions services/cypress/support/loginCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ Cypress.Commands.add(
cy.findByText(
'Medicaid and CHIP Managed Care Reporting and Review System'
)
// cy.findByRole('link', { name: 'Sign In' }).click()
const authMode = Cypress.env('AUTH_MODE')

if (authMode === 'LOCAL') {
Expand All @@ -84,10 +83,11 @@ Cypress.Commands.add(

cy.wait('@fetchCurrentUserQuery', { timeout: 20_000 })
cy.wait('@indexContractsForDashboardQuery', { timeout: 80_000 })
cy.findByTestId('cms-dashboard-page', { timeout: 10_000 }).should(
'exist'
)
cy.findByTestId('cms-dashboard-page', { timeout: 10_000 }).should(
'exist'
)

// After logging in, we visit the initial URL if it's not the dashboard.
if (initialURL !== '/') {
cy.visit(initialURL)
cy.url({ timeout: 20_000 }).should('contain', initialURL)
Expand All @@ -97,7 +97,7 @@ Cypress.Commands.add(
timeout: 20_000,
}) // for cases where CMs user goes to specific submission on login, likely from email link
} else if (initialURL.includes('rate-reviews')) {
cy.wait('@indexRatesQuery', { timeout: 80_000 })
cy.wait('@indexRatesForDashboardQuery', { timeout: 80_000 })
cy.findByTestId('cms-dashboard-page', { timeout: 10_000 }).should(
'exist'
)
Expand All @@ -106,6 +106,9 @@ Cypress.Commands.add(
cy.wait('@fetchRateWithQuestionsQuery', { timeout: 80_000 })
} else {
cy.wait('@indexContractsForDashboardQuery', { timeout: 80_000 })
cy.findByTestId('cms-dashboard-page', { timeout: 10_000 }).should(
'exist'
)
}
}
}
Expand Down
10 changes: 3 additions & 7 deletions services/cypress/support/stateSubmissionFormCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -548,14 +548,9 @@ Cypress.Commands.add(
cy.get('#unlockSubmitModalInput').type(
summary || 'Resubmission summary'
)

cy.findByTestId('resubmit_contract-modal-submit').click()

} else {

cy.findByTestId('submit_contract-modal-submit').click()


cy.findByTestId('submit_contract-modal-submit').click()
}
})

Expand All @@ -566,4 +561,5 @@ Cypress.Commands.add(
cy.findByTestId('state-dashboard-page').should('exist')
cy.findByRole('heading',{name:'Submissions'}).should('exist')
}
})
}
)
Loading