Skip to content

Commit

Permalink
Merge pull request #1524 from MeasureAuthoringTool/MAT-7093
Browse files Browse the repository at this point in the history
feat: update for user story
  • Loading branch information
praveenavas authored Nov 21, 2024
2 parents 3316828 + 6654624 commit 3fc357f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
2 changes: 2 additions & 0 deletions cypress/Shared/EditMeasurePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ export class EditMeasurePage {
public static readonly successMessage = '[class="toast success"]'
public static readonly measureReferenceTable = '[data-testid="measure-references-table-body"]'
public static readonly measureReferenceDiscardChanges = '[data-testid="cancel-button"]'
public static readonly deleteReference = '[data-testid*="delete-measure-reference"]'
public static readonly editReference = '[data-testid*="edit-measure-reference"]'

//Definition(Terms) page
public static readonly definitionInputTextbox = '[data-testid="measureDefinitionInput"]'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { MeasureCQL } from "../../../../Shared/MeasureCQL"
import { Utilities } from "../../../../Shared/Utilities"
import { EditMeasurePage } from "../../../../Shared/EditMeasurePage"

let randValue = (Math.floor((Math.random() * 1000) + 1))
let randValue = Cypress._.random(100)
let newMeasureName = ''
let newCqlLibraryName = ''
let measureCQL = MeasureCQL.returnBooleanPatientBasedQDM_CQL
Expand All @@ -16,17 +16,14 @@ describe('QDM Measure Reference', () => {

newMeasureName = 'TestMeasure' + Date.now() + randValue
newCqlLibraryName = 'MeasureTypeTestLibrary' + Date.now() + randValue
//Create New Measure
CreateMeasurePage.CreateQDMMeasureWithBaseConfigurationFieldsAPI(newMeasureName, newCqlLibraryName, 'Cohort', true, measureCQL)
OktaLogin.Login()

})

afterEach('Logout and cleanup', () => {

OktaLogin.Logout()
Utilities.deleteMeasure(newMeasureName, newCqlLibraryName)

})

it('Add and Edit QDM Measure reference', () => {
Expand All @@ -44,16 +41,15 @@ describe('QDM Measure Reference', () => {
cy.get(EditMeasurePage.measureReferenceTable).should('contain.text', 'Measure Reference')

//Edit Measure reference
cy.get(EditMeasurePage.selectMeasureReference).click()
cy.get(EditMeasurePage.measureReferenceDropdown).contains('Edit').click()
// .editReference will work as long as there is only 1 item on the table
cy.get(EditMeasurePage.editReference).should('have.attr', 'aria-label', 'Edit').click()
cy.get(EditMeasurePage.referenceTypeDropdown).click()
cy.get(EditMeasurePage.justificationOption).click()
cy.get(EditMeasurePage.measureReferenceText).clear().type('Updated Measure Reference')
cy.get(EditMeasurePage.saveButton).click()
cy.get(EditMeasurePage.successMessage).should('contain.text', 'Measure Reference Saved Successfully')
cy.get(EditMeasurePage.measureReferenceTable).should('contain.text', 'Justification')
cy.get(EditMeasurePage.measureReferenceTable).should('contain.text', 'Updated Measure Reference')

})

it('Discard changes button', () => {
Expand Down Expand Up @@ -86,12 +82,11 @@ describe('QDM Measure Reference', () => {
cy.get(EditMeasurePage.measureReferenceTable).should('contain.text', 'Measure Reference')

//Delete Measure Reference
cy.get(EditMeasurePage.selectMeasureReference).click()
cy.get(EditMeasurePage.measureReferenceDropdown).contains('Delete').click()
// .deleteReference will work as long as there is only 1 item on the table
cy.get(EditMeasurePage.deleteReference).should('have.attr', 'aria-label', 'Delete').click()
cy.get('[class="dialog-warning-body"]').should('contain.text', 'Are you sure you want to delete ' + 'Measure Reference' + '?')
cy.get('[data-testid="delete-dialog-continue-button"]').click()
cy.get(EditMeasurePage.successMessage).should('contain.text', 'Measure reference deleted successfully')

})
})

Expand All @@ -104,14 +99,12 @@ describe('Add Measure Reference - ownership validation', () => {
//Create New Measure
CreateMeasurePage.CreateQDMMeasureWithBaseConfigurationFieldsAPI(newMeasureName, newCqlLibraryName, 'Cohort', true, measureCQL)
OktaLogin.AltLogin()

})

afterEach('Logout and cleanup', () => {

OktaLogin.UILogout()
Utilities.deleteMeasure(newMeasureName, newCqlLibraryName)

})

it('Non Measure owner unable to add Measure References', () => {
Expand All @@ -123,11 +116,10 @@ describe('Add Measure Reference - ownership validation', () => {
//Navigate to References page
cy.get(EditMeasurePage.leftPanelReference).click()
cy.get(EditMeasurePage.addReferenceButton).should('not.be.enabled')

})
})

describe('Delete Measure Reference - Ownership validation', () => {
describe('Delete or Edit Measure Reference - Ownership validation', () => {

beforeEach('Create Measure, add Cohort group and Login', () => {

Expand All @@ -149,17 +141,15 @@ describe('Delete Measure Reference - Ownership validation', () => {
cy.get(EditMeasurePage.measureReferenceTable).should('contain.text', 'Documentation')
cy.get(EditMeasurePage.measureReferenceTable).should('contain.text', 'Measure Reference')
OktaLogin.UILogout()

})

afterEach('Logout and cleanup', () => {

OktaLogin.UILogout()
Utilities.deleteMeasure(newMeasureName, newCqlLibraryName)

})

it('Non Measure owner unable to delete Measure reference', () => {
it('Non Measure owner unable to delete or edit Measure reference', () => {

OktaLogin.AltLogin()
cy.get(MeasuresPage.allMeasuresTab).wait(1000).click()
Expand All @@ -168,8 +158,11 @@ describe('Delete Measure Reference - Ownership validation', () => {

//Navigate to References page
cy.get(EditMeasurePage.leftPanelReference).click()
// older access method
cy.get(EditMeasurePage.selectMeasureReference).should('not.exist')

// current icons
cy.get(EditMeasurePage.deleteReference).should('not.exist')
cy.get(EditMeasurePage.editReference).should('not.exist')
})
})

Expand Down

0 comments on commit 3fc357f

Please sign in to comment.