-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
continuing testing development. Adding/removing packages as needed
- Loading branch information
1 parent
2c6c672
commit c23d565
Showing
18 changed files
with
3,134 additions
and
138 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
frontend/app/(hub)/measurementshub/recentchanges/error.tsx
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,17 @@ | ||
'use client'; | ||
|
||
import React from 'react'; | ||
import { Box, Button, Typography } from '@mui/joy'; | ||
|
||
const ErrorPage = (props: { error: Error; reset: () => void }) => { | ||
const { error, reset } = props; | ||
return ( | ||
<Box sx={{ p: 3, textAlign: 'center' }}> | ||
<Typography level="h1">Something went wrong - Recent Changes Page</Typography> | ||
<Typography level="body-lg">{error?.message ?? 'No error message received'}</Typography> | ||
<Button onClick={reset}>Retry Now</Button> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default ErrorPage; |
8 changes: 0 additions & 8 deletions
8
frontend/cypress/components/app/hub/dashboard/dashboardpage.cy.tsx
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
frontend/cypress/components/app/hub/dashboard/errorpage.cy.tsx
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
...tend/cypress/components/app/hub/fixeddatainput/alltaxonomiesview/alltaxonomiespage.cy.tsx
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
frontend/cypress/components/app/hub/fixeddatainput/alltaxonomiesview/errorpage.cy.tsx
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
frontend/cypress/components/app/hub/fixeddatainput/attributes/attributespage.cy.tsx
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
frontend/cypress/components/app/hub/fixeddatainput/attributes/errorpage.cy.tsx
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
frontend/cypress/components/app/hub/fixeddatainput/personnel/errorpage.cy.tsx
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
frontend/cypress/components/app/hub/fixeddatainput/personnel/personnelpage.cy.tsx
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
frontend/cypress/components/app/loginfailed/page/loginfailedpage.cy.tsx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...ress/components/app/page/errorpage.cy.tsx → ...tend/cypress/components/errorpages.cy.tsx
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,32 @@ | ||
import React from 'react'; | ||
import HomePage from '@/app/page'; | ||
import LoginFailedPage from '@/app/loginfailed/page'; | ||
import * as nextAuthReact from 'next-auth/react'; | ||
import * as nextNavigation from 'next/navigation'; | ||
|
||
describe('Mounting Home Page', () => { | ||
it('renders', () => { | ||
cy.mount(<HomePage />); | ||
}); | ||
}); | ||
|
||
describe('Login failure page test', () => { | ||
beforeEach(() => { | ||
cy.stub(window.sessionStorage, 'clear').as('sessionStorageClear'); | ||
cy.stub(window.localStorage, 'clear').as('localStorageClear'); | ||
|
||
cy.stub(nextAuthReact, 'signOut').resolves(); | ||
|
||
cy.stub(nextNavigation, 'useSearchParams').returns(() => new URLSearchParams('?reason=Invalid Credentials')); | ||
}); | ||
|
||
it('renders the login failure message', () => { | ||
cy.mount(<LoginFailedPage />); | ||
cy.contains('Oops! Login Failed').should('be.visible'); | ||
}); | ||
|
||
it('displays a default failure reason if none is provided', () => { | ||
cy.mount(<LoginFailedPage />); | ||
cy.contains('Failure caused due to Login failure triggered without reason. Please speak to an administrator').should('be.visible'); | ||
}); | ||
}); |
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,10 @@ | ||
[ | ||
{ | ||
"id": 1, | ||
"operation": "UPDATE", | ||
"tableName": "measurements", | ||
"changeTimestamp": "2024-01-01T12:00:00Z", | ||
"oldRowState": { "columnA": "oldValue" }, | ||
"newRowState": { "columnA": "newValue" } | ||
} | ||
] |
Binary file added
BIN
+74.5 KB
...s.cy.tsx/Testing Dashboard Page -- triggers feedback form on click (failed).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,61 @@ | ||
// cypress/support/mocks.ts | ||
|
||
import * as nextAuthReact from 'next-auth/react'; | ||
import { PlotRDS, SitesRDS } from '@/config/sqlrdsdefinitions/zones'; | ||
import { OrgCensusRDS } from '@/config/sqlrdsdefinitions/timekeeping'; | ||
import * as userContext from '@/app/contexts/userselectionprovider'; | ||
import * as lockAnimationContext from '@/app/contexts/lockanimationcontext'; | ||
|
||
const testSite1: SitesRDS = { | ||
siteName: 'Test Site 1', | ||
schemaName: 'site1' | ||
}; | ||
|
||
const testSite2: SitesRDS = { | ||
siteName: 'Test Site 2', | ||
schemaName: 'site2' | ||
}; | ||
|
||
const testPlot: PlotRDS = { | ||
plotID: 1, | ||
plotName: 'Test Plot' | ||
}; | ||
|
||
const testCensus: OrgCensusRDS = { | ||
censusIDs: [], | ||
dateRanges: [], | ||
description: '', | ||
plotID: 1, | ||
plotCensusNumber: 1 | ||
}; | ||
|
||
export function mockUseSession(overrides = {}) { | ||
cy.stub(nextAuthReact, 'useSession').returns({ | ||
data: { | ||
user: { | ||
name: 'J Doe', | ||
email: '[email protected]', | ||
userStatus: 'db admin', | ||
sites: [testSite1, testSite2], | ||
...overrides | ||
} | ||
} | ||
}); | ||
} | ||
|
||
export function mockUserContexts(site = testSite1, plot = testPlot, census = testCensus) { | ||
cy.stub(userContext, 'useSiteContext').returns(site); | ||
cy.stub(userContext, 'usePlotContext').returns(plot); | ||
cy.stub(userContext, 'useOrgCensusContext').returns(census); | ||
} | ||
|
||
export function mockLockAnimationContext() { | ||
cy.stub(lockAnimationContext, 'useLockAnimation').returns({ | ||
triggerPulse: cy.stub().as('triggerPulse'), | ||
isPulsing: false | ||
}); | ||
} | ||
|
||
export function mockApiResponses() { | ||
cy.intercept('GET', '/api/changelog/**', { fixture: 'changelog.json' }).as('getChangelog'); | ||
} |
Oops, something went wrong.