-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CU-86bznyq73 - Browse-End-To-End-Testing
- Loading branch information
1 parent
0bcb57c
commit d547f89
Showing
7 changed files
with
1,152 additions
and
61 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
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 |
---|---|---|
@@ -0,0 +1,125 @@ | ||
/// <reference types="cypress" /> | ||
|
||
describe('Browse Records', () => { | ||
beforeEach(() => { | ||
cy.visit( | ||
'/browse-records?isFetchingInteractions=false¶meters=%5B%5D&limit=25&offset=0&sortAsc=0&sortBy="auxDateCreated"' | ||
) | ||
}) | ||
|
||
const openRecordDetails = () => { | ||
cy.get('.MuiDataGrid-row').first().dblclick() | ||
} | ||
|
||
describe('Page Header', () => { | ||
it('should display the page header', () => { | ||
cy.get('#page-header').contains('Browse Patients') | ||
}) | ||
}) | ||
|
||
describe('Filters', () => { | ||
beforeEach(() => { | ||
cy.get('#panel1a-header').click() | ||
cy.get('#panel1a-content').should('be.visible') | ||
}) | ||
|
||
it('should expand and collapse the filter accordion', () => { | ||
cy.get('#panel1a-header').click() | ||
cy.get('#panel1a-content').should('not.be.visible') | ||
|
||
cy.get('#panel1a-header').click() | ||
cy.get('#panel1a-content').should('be.visible') | ||
}) | ||
|
||
it('should display the start date filter', () => { | ||
cy.get( | ||
'#panel1a-content > div > div > div.MuiStack-root.css-uhybnf-MuiStack-root > div > div:nth-child(1) > div' | ||
).should('be.visible') | ||
}) | ||
|
||
it('should display the end date filter', () => { | ||
cy.get( | ||
'#panel1a-content > div > div > div.MuiStack-root.css-uhybnf-MuiStack-root > div > div:nth-child(2) > div' | ||
).should('be.visible') | ||
}) | ||
|
||
it('should toggle get interactions switch', () => { | ||
cy.get('#interactions-switch').click() | ||
cy.get( | ||
'#interactions-switch > span.MuiSwitch-root.MuiSwitch-sizeMedium.css-julti5-MuiSwitch-root > span.MuiButtonBase-root.MuiSwitch-switchBase.MuiSwitch-colorPrimary.Mui-checked.PrivateSwitchBase-root.MuiSwitch-switchBase.MuiSwitch-colorPrimary.Mui-checked.Mui-checked.css-byenzh-MuiButtonBase-root-MuiSwitch-switchBase > input' | ||
).should('be.checked') | ||
}) | ||
}) | ||
|
||
describe('Search Results', () => { | ||
it('should display search results in the data grid', () => { | ||
cy.get('.MuiDataGrid-root').should('be.visible') | ||
cy.get('.MuiDataGrid-row').should('have.length.at.least', 1) | ||
}) | ||
|
||
it('should navigate to the record details page on row double-click', () => { | ||
cy.get('.MuiDataGrid-row').first().dblclick() | ||
cy.url().should('include', '/record-details/') | ||
}) | ||
}) | ||
describe('Record Details Page', () => { | ||
beforeEach(() => { | ||
cy.visit('/browse-records') | ||
openRecordDetails() | ||
}) | ||
|
||
it('It navigates to the record details page when a row is double-clicked', () => { | ||
cy.url().should('match', /\/record-details\/\w+/) | ||
}) | ||
|
||
it('It displays the records table', () => { | ||
cy.get('.MuiDataGrid-root').should('be.visible') | ||
}) | ||
|
||
it('It displays the audit trail table', () => { | ||
cy.get('.MuiDataGrid-root').eq(1).should('be.visible') | ||
}) | ||
it('It enables the edit button when a record is selected', () => { | ||
cy.get('.MuiDataGrid-row').first().click() | ||
cy.get('button').contains('Edit').should('be.enabled') | ||
}) | ||
|
||
it('It enables the save button when changes are made', () => { | ||
cy.get('.MuiDataGrid-row').first().click() | ||
cy.get('button').contains('Edit').click() | ||
cy.get('.MuiDataGrid-cell').first().dblclick() | ||
cy.get('button').contains('Save').should('be.enabled') | ||
}) | ||
|
||
it('It discards changes when the cancel button is clicked', () => { | ||
cy.get('.MuiDataGrid-row').first().click() | ||
cy.get('button').contains('Edit').click() | ||
cy.get('.MuiDataGrid-cell').first().dblclick() | ||
cy.get('button').contains('Cancel').click() | ||
cy.get('.MuiDataGrid-cell').first().should('not.contain', 'New value') | ||
}) | ||
|
||
it('It enables relink button on row double click', () => { | ||
openRecordDetails() | ||
cy.get('.MuiDataGrid-row').eq(1).dblclick() | ||
cy.get('button').contains('Relink') | ||
cy.get('button').contains('Relink').click() | ||
cy.contains('PATIENT LINKED TO GOLDEN RECORD').should('be.visible') | ||
cy.pause() | ||
}) | ||
}) | ||
|
||
describe('API Calls', () => { | ||
beforeEach(() => { | ||
cy.intercept('POST', '**/search', { fixture: 'searchResponse.json' }).as( | ||
'searchQuery' | ||
) | ||
cy.visit('/browse-records') | ||
}) | ||
|
||
it('It displays search results in the data grid', () => { | ||
cy.get('.MuiDataGrid-root').should('be.visible') | ||
cy.get('.MuiDataGrid-row').should('have.length.at.least', 1) | ||
}) | ||
}) | ||
}) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,75 @@ | ||
describe('Notifications', () => { | ||
beforeEach(() => { | ||
cy.visit('/notifications'); | ||
}); | ||
cy.visit('/notifications') | ||
}) | ||
|
||
describe('Page Header', () => { | ||
it('should display the page header', () => { | ||
cy.get('#page-header').should('contain.text', 'Notification Worklist'); | ||
}); | ||
}); | ||
cy.get('#page-header').should('contain.text', 'Notification Worklist') | ||
}) | ||
}) | ||
|
||
describe('Filters', () => { | ||
it('should display the start date filter', () => { | ||
cy.contains('Start Date').should('be.visible'); | ||
}); | ||
cy.contains('Start Date').should('be.visible') | ||
}) | ||
|
||
it('should display the end date filter', () => { | ||
cy.contains('End Date').should('be.visible'); | ||
}); | ||
cy.contains('End Date').should('be.visible') | ||
}) | ||
|
||
it('should display the states dropdown', () => { | ||
cy.get('#single-chip').click(); | ||
cy.contains('ALL').click(); | ||
}); | ||
cy.get('#single-chip').click() | ||
cy.contains('ALL').click() | ||
}) | ||
|
||
it('should have the correct default selected value', () => { | ||
cy.get('#single-chip').click(); | ||
cy.contains('OPEN').click({ force: true }); | ||
}); | ||
cy.get('#single-chip').click() | ||
cy.contains('OPEN').click({ force: true }) | ||
}) | ||
|
||
it('should allow selecting an option', () => { | ||
cy.get('#single-chip').click(); | ||
cy.contains('ALL').click(); | ||
}); | ||
cy.get('#single-chip').click() | ||
cy.contains('ALL').click() | ||
}) | ||
|
||
it('should not allow multiple selections', () => { | ||
cy.get('#single-chip').click(); | ||
cy.contains('ALL').click(); | ||
cy.get('#single-chip').click(); | ||
cy.contains('CLOSED').click(); | ||
cy.get('#single-chip').find('span.MuiChip-label').should('contain.text', 'CLOSED'); | ||
}); | ||
}); | ||
cy.get('#single-chip').click() | ||
cy.contains('ALL').click() | ||
cy.get('#single-chip').click() | ||
cy.contains('CLOSED').click() | ||
cy.get('#single-chip') | ||
.find('span.MuiChip-label') | ||
.should('contain.text', 'CLOSED') | ||
}) | ||
}) | ||
|
||
describe('Data Grid', () => { | ||
it('should display the data grid', () => { | ||
cy.contains('OPEN').should('be.visible'); | ||
}); | ||
cy.contains('OPEN').should('be.visible') | ||
}) | ||
|
||
it('should display the pagination', () => { | ||
cy.contains('Rows per page:').should('be.visible'); | ||
}); | ||
}); | ||
|
||
cy.contains('Rows per page:').should('be.visible') | ||
}) | ||
}) | ||
|
||
describe('API Calls', () => { | ||
beforeEach(() => { | ||
cy.intercept("POST", "http://localhost:50000/JeMPI/notifications", { fixture: "notifications.json" }).as('getNotifications'); | ||
cy.visit("/notifications"); | ||
}); | ||
|
||
it("It mocks API response", () => { | ||
cy.get('#notification-container').should('be.visible'); | ||
cy.get('#notification-container .MuiDataGrid-main .MuiDataGrid-virtualScroller .MuiDataGrid-row').should('exist'); | ||
cy.get('#notification-container .MuiDataGrid-main .MuiDataGrid-virtualScroller .MuiDataGrid-row').should('have.length',25); | ||
}); | ||
}); | ||
|
||
}); | ||
|
||
|
||
cy.intercept('POST', 'http://localhost:50000/JeMPI/notifications', { | ||
fixture: 'notifications.json' | ||
}).as('getNotifications') | ||
cy.visit('/notifications') | ||
}) | ||
|
||
it('It mocks API response', () => { | ||
cy.get('#notification-container').should('be.visible') | ||
cy.get( | ||
'#notification-container .MuiDataGrid-main .MuiDataGrid-virtualScroller .MuiDataGrid-row' | ||
).should('exist') | ||
cy.get( | ||
'#notification-container .MuiDataGrid-main .MuiDataGrid-virtualScroller .MuiDataGrid-row' | ||
).should('have.length', 25) | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.