diff --git a/services/cypress/integration/cmsWorkflow/rateReview.spec.ts b/services/cypress/integration/cmsWorkflow/rateReview.spec.ts index 9d518ed2ab..f39108f859 100644 --- a/services/cypress/integration/cmsWorkflow/rateReview.spec.ts +++ b/services/cypress/integration/cmsWorkflow/rateReview.spec.ts @@ -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(() => { diff --git a/services/cypress/support/commands.ts b/services/cypress/support/commands.ts index b89215baf3..9901377b26 100644 --- a/services/cypress/support/commands.ts +++ b/services/cypress/support/commands.ts @@ -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') diff --git a/services/cypress/support/loginCommands.ts b/services/cypress/support/loginCommands.ts index 7c226869d0..fab90165dd 100644 --- a/services/cypress/support/loginCommands.ts +++ b/services/cypress/support/loginCommands.ts @@ -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') { @@ -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) @@ -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' ) @@ -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' + ) } } } diff --git a/services/cypress/support/stateSubmissionFormCommands.ts b/services/cypress/support/stateSubmissionFormCommands.ts index c28799f5e5..f5f50d0818 100644 --- a/services/cypress/support/stateSubmissionFormCommands.ts +++ b/services/cypress/support/stateSubmissionFormCommands.ts @@ -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() } }) @@ -566,4 +561,5 @@ Cypress.Commands.add( cy.findByTestId('state-dashboard-page').should('exist') cy.findByRole('heading',{name:'Submissions'}).should('exist') } - }) + } +)