Skip to content

Commit

Permalink
Merge branch 'master' into feature/EUI-8736-JRD-e-Links-API-V2
Browse files Browse the repository at this point in the history
  • Loading branch information
johnbenjamin-hmcts committed Oct 5, 2023
2 parents 4e7ca86 + 656cfcc commit acf8be3
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 53 deletions.
31 changes: 7 additions & 24 deletions api/test/pact/mocks/openid-well-known-configuration.mock.ts
Original file line number Diff line number Diff line change
@@ -1,49 +1,32 @@
import { Matchers } from '@pact-foundation/pact';
import { like } from '@pact-foundation/pact/src/dsl/matchers';

const { term, string, boolean, eachLike } = Matchers;

export default {
'request_parameter_supported': boolean(true),
'claims_parameter_supported': boolean(false),
'scopes_supported': eachLike('openid'),
'issuer': term({
generate: 'https://idam-web-public.aat.platform.hmcts.net/o',
matcher: '/o$'
}),
'issuer': like('https://idam-web-public.aat.platform.hmcts.net/o'),
'id_token_encryption_enc_values_supported': eachLike('A256GCM'),
'acr_values_supported': [],
'authorization_endpoint': term({
generate: 'https://idam-web-public.aat.platform.hmcts.net/o/authorize',
matcher: '/o/authorize$'
}),
'authorization_endpoint': like('https://idam-web-public.aat.platform.hmcts.net/o/authorize'),
'request_object_encryption_enc_values_supported': eachLike('A256GCM'),
'rcs_request_encryption_alg_values_supported': eachLike('RSA-OAEP'),
'claims_supported': [],
'rcs_request_signing_alg_values_supported': eachLike('PS384'),
'token_endpoint_auth_methods_supported': eachLike('client_secret_post'),
'token_endpoint': term({
generate: 'https://idam-web-public.aat.platform.hmcts.net/o/token',
matcher: '/o/token$'
}),
'token_endpoint': like('https://idam-web-public.aat.platform.hmcts.net/o/token'),
'response_types_supported': eachLike('code'),
'request_uri_parameter_supported': boolean(true),
'rcs_response_encryption_enc_values_supported': eachLike('A256GCM'),
'end_session_endpoint': term({
generate: 'https://idam-web-public.aat.platform.hmcts.net/o/endSession',
matcher: '/o/endSession$'
}),
'end_session_endpoint': like('https://idam-web-public.aat.platform.hmcts.net/o/endSession'),
'rcs_request_encryption_enc_values_supported': eachLike('A256GCM'),
'version': string('3.0'),
'rcs_response_encryption_alg_values_supported': eachLike('RSA-OAEP'),
'userinfo_endpoint': term({
generate: 'https://idam-web-public.aat.platform.hmcts.net/o/userinfo',
matcher: '/o/userinfo$'
}),
'userinfo_endpoint': like('https://idam-web-public.aat.platform.hmcts.net/o/userinfo'),
'id_token_encryption_alg_values_supported': eachLike('RSA-OAEP'),
'jwks_uri': term({
generate: 'https://idam-web-public.aat.platform.hmcts.net/o/jwks',
matcher: '/o/jwks$'
}),
'jwks_uri': like('https://idam-web-public.aat.platform.hmcts.net/o/jwks'),
'subject_types_supported': eachLike('public'),
'id_token_signing_alg_values_supported': eachLike('ES384'),
'request_object_signing_alg_values_supported': eachLike('ES384'),
Expand Down
2 changes: 1 addition & 1 deletion api/test/pact/pact-tests/idam/oidc.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { assert } from 'chai';
import mockResponse from '../../mocks/openid-well-known-configuration.mock';
import { PactTestSetup } from '../settings/provider.mock';

const pactSetUp = new PactTestSetup({ provider: 'Idam_api', port: 8000 });
const pactSetUp = new PactTestSetup({ provider: 'idamApi_oidc', port: 8000 });

describe('OpenId Connect API', () => {
// Write Pact when all tests done
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@
"test:pact:run-and-publish": "yarn test-pact && yarn publish-pact",
"test:backendMock": "DEBUG=true nodemon test_codecept/backendMock/app --standalone",
"test:codeceptE2EDebug": "TEST_TYPE=e2e npx codeceptjs run --plugins retryFailedStep --config=./test_codecept/codeceptCommon/codecept.conf.ts --features --grep @functional_test",
"test:codeceptE2E": "PARALLEL=true TEST_TYPE=e2e npx codeceptjs run-workers --suites 8 --plugins retryFailedStep --config=./test_codecept/codeceptCommon/codecept.conf.ts --features --grep @functional_enabled ",
"test:codeceptE2E": "PARALLEL=true TEST_TYPE=e2e npx codeceptjs run-workers --suites 6 --plugins retryFailedStep --config=./test_codecept/codeceptCommon/codecept.conf.ts --features --grep @functional_enabled ",
"test:xuiIntegrationDebug": "DEBUG=true NODE_CONFIG_ENV=mock TEST_TYPE=ngIntegration npx codeceptjs run -p pauseOnFail --config=./test_codecept/codeceptCommon/codecept.conf.ts --features --grep '(?=.*@functional_debug)^(?!.*@ignore)' ",
"test:xuiIntegration": "yarn build && node ./test_codecept/backendMock/configCopy.js && NODE_CONFIG_ENV=mock TEST_TYPE=ngIntegration PARALLEL=true npx codeceptjs run-workers --suites 8 --config=./test_codecept/codeceptCommon/codecept.conf.ts --features --grep '(?=.*@functional_enabled)^(?!.*@ignore)' ",
"test:xuiIntegration": "yarn build && node ./test_codecept/backendMock/configCopy.js && NODE_CONFIG_ENV=mock TEST_TYPE=ngIntegration PARALLEL=true npx codeceptjs run-workers --suites 6 --config=./test_codecept/codeceptCommon/codecept.conf.ts --features --grep '(?=.*@functional_enabled)^(?!.*@ignore)' ",
"parallel": "npm-run-all -l -p test:api test:xuiIntegration test:codeceptE2E"
},
"private": true,
Expand Down
50 changes: 24 additions & 26 deletions test_codecept/codeceptCommon/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,34 @@ let featureLogFile = null;

function overrideConsoleLogforWorkersThreads(){

if (process.env.PARALLEL === "true") {
const consoleLogRef = console.log;
const consoleErrorRef = console.error;
global.console.log = function (message) {
const folderName = path.resolve(__dirname, `../../functional-output/tests/featureLogs-${testType}`)
if (!featureLogFile) {
featureLogFile = folderName + '/executionLogs.log'
}
if (!fs.existsSync(folderName)) {
fs.mkdirSync(folderName);
}
const dateTime = new Date().toLocaleTimeString('en-GB');
consoleLogRef(message)
fs.appendFileSync(`${featureLogFile}`, `\n ${dateTime} : ${message}`)
const consoleLogRef = console.log;
const consoleErrorRef = console.error;
global.console.log = function (message) {
const folderName = path.resolve(__dirname, `../../functional-output/tests/featureLogs-${testType}`)
if (!featureLogFile) {
featureLogFile = folderName + '/executionLogs.log'
}
if (!fs.existsSync(folderName)) {
fs.mkdirSync(folderName);
}
const dateTime = new Date().toLocaleTimeString('en-GB');
consoleLogRef(message)
fs.appendFileSync(`${featureLogFile}`, `\n ${dateTime} : ${message}`)
}


global.console.error = (error) => {
const folderName = path.resolve(__dirname, `../../functional-output/tests/featureLogs-${testType}`)
if (!featureLogFile) {
featureLogFile = folderName + '/executionLogs.log'
}
if (!fs.existsSync(folderName)) {
fs.mkdirSync(folderName);
}
fs.appendFileSync(`${featureLogFile}`, "\n ERROR \n")

fs.appendFileSync(`${featureLogFile}`, '\n' + error)
consoleErrorRef(error)
global.console.error = (error) => {
const folderName = path.resolve(__dirname, `../../functional-output/tests/featureLogs-${testType}`)
if (!featureLogFile) {
featureLogFile = folderName + '/executionLogs.log'
}
if (!fs.existsSync(folderName)) {
fs.mkdirSync(folderName);
}
fs.appendFileSync(`${featureLogFile}`, "\n ERROR \n")

fs.appendFileSync(`${featureLogFile}`, '\n' + error)
consoleErrorRef(error)
}

}
Expand Down

0 comments on commit acf8be3

Please sign in to comment.