Skip to content
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

HAAR 1902 - Data layer #22

Merged
merged 23 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
639c82d
Add initial data-layer files
thomasridd Oct 4, 2023
70b23cd
implement call to listBaseClients endpoint - currently clients/all
thomasridd Oct 10, 2023
3aac44d
surface data layer on homepage to demonstrate layer model
thomasridd Oct 10, 2023
961db82
Util function for splitting string responses from API
thomasridd Oct 11, 2023
21bd543
tidy front end code
thomasridd Oct 11, 2023
70160c6
update package-lock
thomasridd Oct 11, 2023
2e7c9dc
clean up for linter - (only comment out upcoming work)
thomasridd Oct 11, 2023
d844f6e
update integration test specification for home page
thomasridd Oct 11, 2023
897caec
updates for integration testing
thomasridd Oct 12, 2023
491ea82
updates to integration tests
thomasridd Oct 13, 2023
33fb43e
HAAR-1902: Fix for integration tests
brightonsbox Oct 13, 2023
cb04fac
move list base-clients endpoint to new authorization-server schema
thomasridd Oct 13, 2023
4838042
For getBaseClient api
thomasridd Oct 16, 2023
bc3f2be
fix linting errors
thomasridd Oct 16, 2023
d88ea66
post base-client endpoint added
thomasridd Oct 16, 2023
059f166
update base client
thomasridd Oct 16, 2023
4555c96
update base client deployment details
thomasridd Oct 17, 2023
10d0dcd
list client instances
thomasridd Oct 17, 2023
104f782
Merge branch 'main' into HAAR-1902-data
thomasridd Oct 17, 2023
3ea718a
delete client instance
thomasridd Oct 17, 2023
178269e
remove commented code
thomasridd Oct 18, 2023
4db37a4
remove clientid and secret from authorization server until needed
thomasridd Oct 18, 2023
bc00c90
respond to review comments
thomasridd Oct 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions assets/js/initMOJFilterPage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
new MOJFrontend.FilterToggleButton({
bigModeMediaQuery: '(min-width: 48.063em)',
startHidden: true,
toggleButton: {
container: $('.moj-action-bar__filter'),
showText: 'Show filter',
hideText: 'Hide filter',
classes: 'govuk-button--secondary',
},
closeButton: {
container: $('.moj-filter__header-action'),
text: 'Close',
},
filter: {
container: $('.moj-filter'),
},
})
6 changes: 6 additions & 0 deletions assets/scss/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ $govuk-page-width: $moj-page-width;

@import './components/header-bar';
@import 'assets/scss/local';

.extra-wide {
.govuk-width-container {
max-width: 1300px;
}
}
2 changes: 2 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { defineConfig } from 'cypress'
import { resetStubs } from './integration_tests/mockApis/wiremock'
import auth from './integration_tests/mockApis/auth'
import tokenVerification from './integration_tests/mockApis/tokenVerification'
import baseClientsApi from './integration_tests/mockApis/baseClientsApi'

export default defineConfig({
chromeWebSecurity: false,
Expand All @@ -21,6 +22,7 @@ export default defineConfig({
reset: resetStubs,
...auth,
...tokenVerification,
...baseClientsApi,
})
},
baseUrl: 'http://localhost:3007',
Expand Down
1 change: 1 addition & 0 deletions feature.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
PORT=3007
HMPPS_AUTH_URL=http://localhost:9091/auth
HMPPS_AUTHORIZATION_SERVER_URL=http://localhost:9091/baseClientsApi
TOKEN_VERIFICATION_API_URL=http://localhost:9091/verification
TOKEN_VERIFICATION_ENABLED=true
NODE_ENV=development
Expand Down
10 changes: 8 additions & 2 deletions integration_tests/e2e/login.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ context('SignIn', () => {
cy.task('reset')
cy.task('stubSignIn')
cy.task('stubAuthUser')
cy.task('stubListBaseClients')
cy.task('stubGetBaseClient')
})

it('Unauthenticated user directed to auth', () => {
Expand Down Expand Up @@ -58,17 +60,21 @@ context('SignIn', () => {
})

it('Token verification failure clears user session', () => {
// sign in as one user
cy.signIn()
const indexPage = Page.verifyOnPage(IndexPage)
cy.task('stubVerifyToken', false)

// can't do a visit here as cypress requires only one domain
// invalidate the token
cy.task('stubVerifyToken', false)
// and check they are sent to sign in - can't do a visit here as cypress requires only one domain
cy.request('/').its('body').should('contain', 'Sign in')

// sign back in as a different person
cy.task('stubVerifyToken', true)
cy.task('stubAuthUser', 'bobby brown')
cy.signIn()

// check the new user is signed in
indexPage.headerUserName().contains('B. Brown')
})
})
39 changes: 39 additions & 0 deletions integration_tests/mockApis/baseClientsApi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { stubFor } from './wiremock'
import {
listBaseClientsResponseMock,
getBaseClientResponseMock,
} from '../../server/data/localMockData/baseClientsResponseMock'

export default {
stubListBaseClients: () => {
return stubFor({
request: {
method: 'GET',
urlPattern: `/baseClientsApi/base-clients`,
},
response: {
status: 200,
headers: {
'Content-Type': 'application/json;charset=UTF-8',
},
jsonBody: listBaseClientsResponseMock,
},
})
},

stubGetBaseClient: () => {
return stubFor({
request: {
method: 'GET',
urlPattern: `/baseClientsApi/base-clients/baseClientId`,
},
response: {
status: 200,
headers: {
'Content-Type': 'application/json;charset=UTF-8',
},
jsonBody: getBaseClientResponseMock,
},
})
},
}
2 changes: 1 addition & 1 deletion integration_tests/pages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Page, { PageElement } from './page'

export default class IndexPage extends Page {
constructor() {
super('This site is under construction...')
super('OAuth Client details')
}

headerUserName = (): PageElement => cy.get('[data-qa=header-user-name]')
Expand Down
Loading