-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
172 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
158 changes: 71 additions & 87 deletions
158
services/cypress/integration/cmsWorkflow/rateReview.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,107 +1,91 @@ | ||
import { HealthPlanFormDataType, packageName } from "../../../app-web/src/common-code/healthPlanFormDataType" | ||
import { base64ToDomain } from "../../../app-web/src/common-code/proto/healthPlanFormDataProto" | ||
import { HealthPlanPackage } from "../../gen/gqlClient" | ||
import { cmsUser, minnesotaStatePrograms, stateUser } from "../../utils/apollo-test-utils" | ||
|
||
describe('CMS user can view rate reviews', () => { | ||
beforeEach(() => { | ||
cy.stubFeatureFlags() | ||
cy.interceptGraphQL() | ||
}) | ||
it('and navigate to a specific rate from the rates dashboard', () => { | ||
// Assign Division to CMS user zuko | ||
cy.apiAssignDivisionToCMSUser(cmsUser(), 'DMCO').then(() => { | ||
// Create a new submission | ||
cy.apiCreateAndSubmitContractOnlySubmission(stateUser()).then( | ||
(pkg) => { | ||
}) | ||
}) | ||
// state user adds a new package | ||
cy.logInAsStateUser() | ||
cy.startNewContractAndRatesSubmission() | ||
cy.fillOutBaseContractDetails() | ||
cy.navigateFormByButtonClick('CONTINUE') | ||
// By default return lastest revision | ||
const getFormData = (pkg: HealthPlanPackage, indx = 0): HealthPlanFormDataType => { | ||
const latestRevision = pkg.revisions[indx].node | ||
if (!latestRevision) { | ||
throw new Error('no revisions found for package' + pkg.id) | ||
} | ||
|
||
cy.findByRole('heading', { | ||
level: 2, | ||
name: /Rate details/, | ||
}).should('exist') | ||
cy.fillOutNewRateCertification() | ||
cy.navigateFormByButtonClick('CONTINUE') | ||
const unwrapResult = base64ToDomain(latestRevision.formDataProto) | ||
if (unwrapResult instanceof Error) { | ||
throw unwrapResult | ||
} | ||
|
||
cy.findByRole('heading', { | ||
level: 2, | ||
name: /Contacts/, | ||
}).should('exist') | ||
cy.fillOutStateContact() | ||
cy.fillOutAdditionalActuaryContact() | ||
cy.navigateFormByButtonClick('CONTINUE') | ||
return unwrapResult | ||
} | ||
|
||
cy.findByRole('heading', { | ||
level: 2, | ||
name: /Supporting documents/, | ||
}).should('exist') | ||
cy.fillOutSupportingDocuments() | ||
cy.navigateFormByButtonClick('CONTINUE') | ||
|
||
// store submission id for reference later | ||
let submissionId = '' | ||
cy.location().then((fullUrl) => { | ||
const { pathname } = fullUrl | ||
const pathnameArray = pathname.split('/') | ||
submissionId = pathnameArray[2] | ||
it('and navigate to a specific rate from the rates dashboard', () => { | ||
cy.interceptFeatureFlags({ | ||
'rates-db-refactor':true, | ||
'rate-reviews-dashboard': true | ||
}) | ||
|
||
// submit package | ||
cy.findByRole('heading', { level: 2, name: /Review and submit/ }) | ||
cy.submitStateSubmissionForm() | ||
|
||
// store submission name for later | ||
cy.location().then((loc) => { | ||
expect(loc.search).to.match(/.*justSubmitted=*/) | ||
const submissionName = loc.search.split('=').pop() | ||
if (submissionName === undefined) { | ||
throw new Error('No submission name found' + loc.search) | ||
} | ||
|
||
// sign out state user | ||
cy.logOut() | ||
// sign in CMS user | ||
cy.logInAsCMSUser() | ||
cy.findByTestId('cms-dashboard-page').should('exist') | ||
cy.findByRole('table').should('exist') | ||
cy.findByText(submissionName).should('exist') | ||
// check the table of submissions | ||
|
||
// only one matching entry | ||
cy.get('table') | ||
.findAllByText(submissionName) | ||
.should('have.length', 1) | ||
cy.apiAssignDivisionToCMSUser(cmsUser(), 'DMCO').then(() => { | ||
|
||
// has proper row data | ||
cy.get('table') | ||
// Create a new contract and rates submission with two attached rates | ||
cy.apiCreateAndSubmitContractWithRates(stateUser()).then( | ||
(pkg) => { | ||
const submission = getFormData(pkg) | ||
const submissionName = packageName( | ||
pkg.stateCode, | ||
submission.stateNumber, | ||
submission.programIDs, | ||
minnesotaStatePrograms | ||
) | ||
// Then check both rates in rate reviews table | ||
cy.logInAsCMSUser({ | ||
initialURL: `/dashboard/rate-reviews`, | ||
}) | ||
const rate1 = submission.rateInfos[0] | ||
const rate2 = submission.rateInfos[1] | ||
cy.get('table') | ||
.findByRole('link', { name: rate1.rateCertificationName }) | ||
.should('exist') | ||
.findByText(submissionName) | ||
.parent() | ||
.findByTestId('submission-date') | ||
.should('not.be.empty') | ||
|
||
cy.get('table') | ||
cy.get('table') | ||
.findByRole('link', { name: rate2.rateCertificationName }) | ||
.should('exist') | ||
.findByText(submissionName) | ||
.parent() | ||
.siblings('[data-testid="submission-status"]') | ||
.should('have.text', 'Submitted') | ||
|
||
cy.get('table') | ||
.contains('a', submissionName) | ||
.parents('tr') | ||
.findByTestId('submission-type') | ||
.should('have.text', 'Contract action and rate certification') | ||
// click the first rate to navigate to rate summary page | ||
cy.get('table') | ||
.findByRole('link', { name: rate1.rateCertificationName }) | ||
.should('exist').click() | ||
cy.url({ timeout: 10_000 }).should('contain',rate1.id) | ||
cy.findByRole('heading', { | ||
name: `${rate1.rateCertificationName}`, | ||
}).should('exist') | ||
cy.findByText('Rate certification type').should('exist').siblings('dd').should('have.text', 'New rate certification') | ||
cy.findByText('Rating period').should('exist').siblings('dd').should('have.text', '06/01/2025 to 05/30/2026') | ||
cy.findByText('Date certified').should('exist').siblings('dd').should('have.text', '04/15/2025') | ||
cy.findByText('Submission this rate was submitted with').should('exist').siblings('dd').should('have.text', submissionName) | ||
cy.findByText('Certifying actuary').should('exist').siblings('dd').should('have.text', 'actuary1test titleemail@example.comMercer') | ||
// cy.findByText('Download all rate documents').should('exist') | ||
cy.findByRole('table', { | ||
name: 'Rate certification', | ||
}).should('exist') | ||
cy.findByText('rate1Document1.pdf').should('exist') | ||
cy.findByRole('table', { | ||
name: 'Rate supporting documents', | ||
}).should('exist') | ||
}) | ||
cy.findByText('rate1SupportingDocument1.pdf').should('exist') | ||
|
||
cy.get('table') | ||
.contains('a', submissionName) | ||
.should('have.attr', 'href') | ||
// Go back to dashboard and check both rates in the table | ||
// check the dashboard has the columns we expect | ||
cy.findByText('Back to dashboard').should('exist').click() | ||
cy.url({ timeout: 10_000 }).should('contain', 'rate-reviews') | ||
cy.findByText('Rate reviews').should('exist') | ||
cy.get('thead').should('have.attr', 'data-testid', 'rate-reviews-table').should('be.visible') // can't put id on table itself because data attributes not passing through in react-uswds component | ||
|
||
// can navigate to submission summary by clicking link | ||
cy.findByText(submissionName).should('exist').click() | ||
cy.url({ timeout: 10_000 }).should('contain', submissionId) | ||
cy.findByTestId('submission-summary').should('exist') | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.