-
Notifications
You must be signed in to change notification settings - Fork 17
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
Cu 86bznypcf notifications end to end testing #287
Open
NyashaMuusha
wants to merge
24
commits into
dev
Choose a base branch
from
CU-86bznypcf_Notifications-End-To-End-Testing
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 13 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
4ab535f
create end-to-end test for Dashboard,add tsconfig.build.json, updated…
NyashaMuusha d0db719
updated dependencies
NyashaMuusha 91dad36
removed example
NyashaMuusha 989a4cb
updated dependencies
NyashaMuusha b72acd7
added id to page header
NyashaMuusha af741cf
added notification worklist tests
NyashaMuusha 51698cc
fetch config api call
NyashaMuusha 8e376ad
refactored fetch notifications
NyashaMuusha e5a5e1d
Merge remote-tracking branch 'upstream/dev' into CU-86bznypcf_Notific…
NyashaMuusha 047eb29
updated config file
NyashaMuusha 7d57c07
updated dependencies
NyashaMuusha b0d53a2
updated tsconfig file
NyashaMuusha c4a5a6d
added mock data
NyashaMuusha 7e212e1
added id to data grid container, updated tests in notifications
NyashaMuusha 930df4a
Merge branch 'dev' into CU-86bznypcf_Notifications-End-To-End-Testing
NyashaMuusha b6a6476
Merge branch 'dev' into CU-86bznypcf_Notifications-End-To-End-Testing
NyashaMuusha 0bf10b6
Merge remote-tracking branch 'upstream/CU-86bznvd1v_Dashboard-End-To-…
NyashaMuusha f6ce941
updated notification automation test
NyashaMuusha ccd2df1
Merge remote-tracking branch 'upstream/CU-86bznypcf_Notifications-End…
NyashaMuusha 0bcb57c
updated notification filter tests
NyashaMuusha d547f89
CU-86bznyq73 - Browse-End-To-End-Testing
NyashaMuusha 67b2966
Merge branch 'dev' into CU-86bznypcf_Notifications-End-To-End-Testing
NyashaMuusha c14e8a2
Merge branch 'dev' into CU-86bznypcf_Notifications-End-To-End-Testing
NyashaMuusha f77c89c
updated imports
NyashaMuusha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { defineConfig } from "cypress"; | ||
|
||
export default defineConfig({ | ||
projectId: '35adzy', | ||
e2e: { | ||
baseUrl:'http://localhost:3001/', | ||
setupNodeEvents(on, config) { | ||
// implement node event listeners here | ||
}, | ||
}, | ||
|
||
component: { | ||
devServer: { | ||
framework: "create-react-app", | ||
bundler: "webpack", | ||
}, | ||
}, | ||
}); |
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,85 @@ | ||
describe('Dashboard Component', () => { | ||
beforeEach(() => { | ||
cy.visit('/') | ||
}) | ||
|
||
it('should display the dashboard tabs', () => { | ||
cy.get('[aria-label="dashboard tabs"]').should('be.visible') | ||
}) | ||
|
||
it('should navigate through tabs', () => { | ||
// Check initial tab (Confusion Matrix) | ||
cy.get('[id="dashboard-tab-0"]').click() | ||
cy.get('#dashboard-tabpanel-0').should('be.visible') | ||
|
||
// Switch to M & U Values tab | ||
cy.get('[id="dashboard-tab-1"]').click() | ||
cy.get('#dashboard-tabpanel-1').should('be.visible') | ||
cy.get('#dashboard-tabpanel-0').should('not.be.visible') | ||
|
||
// Switch to Import Process Status tab | ||
cy.get('[id="dashboard-tab-2"]').click() | ||
cy.get('#dashboard-tabpanel-2').should('be.visible') | ||
cy.get('#dashboard-tabpanel-1').should('not.be.visible') | ||
}) | ||
|
||
it('should display widgets in Confusion Matrix tab', () => { | ||
cy.get('[id="dashboard-tab-0"]').click() | ||
cy.get('#dashboard-tabpanel-0').within(() => { | ||
cy.get('fieldset legend').contains('Records').should('be.visible') | ||
cy.get('fieldset legend').contains('Notifications').should('be.visible') | ||
cy.get('legend').contains('Confusion Matrix').should('be.visible') | ||
}) | ||
}) | ||
|
||
it('should display M & U widget in M & U Values tab', () => { | ||
cy.get('[id="dashboard-tab-1"]').click() | ||
cy.get('#dashboard-tabpanel-1').within(() => { | ||
cy.get('legend').contains('M & U Values').should('be.visible') | ||
}) | ||
}) | ||
|
||
|
||
it('should render correctly with no data', () => { | ||
// Mock the useDashboardData hook to return no data | ||
cy.intercept('GET', '/api/dashboard-data', { | ||
body: { | ||
data: { | ||
dashboardData: {} | ||
} | ||
} | ||
}) | ||
|
||
// Visit the page and click on the dashboard tab | ||
cy.visit('/') | ||
cy.get('[id="dashboard-tab-0"]').click() | ||
|
||
// Verify that the page renders correctly with no data | ||
cy.get('#dashboard-tabpanel-0').within(() => { | ||
cy.get('fieldset legend').contains('Records').should('be.visible') | ||
cy.get('fieldset legend').contains('Notifications').should('be.visible') | ||
cy.get('legend').contains('Confusion Matrix').should('be.visible') | ||
}) | ||
}) | ||
|
||
it('should display loading state correctly', () => { | ||
// Mock the useDashboardData hook to simulate loading state | ||
cy.intercept('GET', '/api/dashboard-data', (req) => { | ||
req.on('response', (res) => { | ||
res.setDelay(1000) | ||
}) | ||
}) | ||
cy.visit('/') | ||
cy.get('[id="dashboard-tab-0"]').click() | ||
}) | ||
|
||
it('should handle API errors', () => { | ||
// Mock the useDashboardData hook to return an error | ||
cy.intercept('GET', '/api/dashboard-data', { | ||
statusCode: 500, | ||
body: { error: 'Internal Server Error' } | ||
}) | ||
cy.visit('/') | ||
cy.get('[id="dashboard-tab-0"]').click() | ||
}) | ||
}) |
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,8 @@ | ||
describe('it mocks fetch notifications',()=>{ | ||
it.only('checks api call', () => { | ||
cy.populateData() | ||
cy.wait('@fetchNotifications') // wait for the intercept to finish | ||
cy.get('[data-cy=item-list]').should('contain', 'Bob Smith'); | ||
}) | ||
|
||
}) |
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,71 @@ | ||
describe('NotificationWorklist component', () => { | ||
beforeEach(() => { | ||
cy.visit('/notifications'); | ||
}); | ||
|
||
describe('Page Header', () => { | ||
it('should display the page header', () => { | ||
cy.get('#page-header').should('contain.text', 'Notification Worklist'); | ||
}); | ||
}); | ||
|
||
describe('Filters', () => { | ||
it('should display the start date filter', () => { | ||
cy.get('#start-date-filter').should('be.visible'); | ||
}); | ||
|
||
it('should display the end date filter', () => { | ||
cy.get('#end-date-filter').should('be.visible'); | ||
}); | ||
|
||
it('should display the states dropdown', () => { | ||
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 }); | ||
}); | ||
|
||
it('should allow selecting an option', () => { | ||
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'); | ||
}); | ||
}); | ||
|
||
describe('Data Grid', () => { | ||
it('should display the data grid', () => { | ||
cy.get('.MuiDataGrid-root').should('be.visible'); | ||
}); | ||
|
||
it('should display the pagination', () => { | ||
cy.get('.MuiPagination-root').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); | ||
}); | ||
}); | ||
|
||
}); | ||
|
||
|
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,5 @@ | ||
{ | ||
"name": "Using fixtures to represent data", | ||
"email": "[email protected]", | ||
"body": "Fixtures are a great way to mock data for responses to routes" | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
it.only
to ensure all tests are executed.The
it.only
method is often used for debugging or during implementation. It should be removed before deploying to production to ensure that all tests are executed.Committable suggestion
Tools
Biome