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

CIV-8456 upgrade node 18v #3582

Open
wants to merge 97 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
3242cea
Fix pipeline
sabahirfan May 17, 2023
ffde08e
Fix pipeline
sabahirfan May 17, 2023
3160866
Fix failing tests
sabahirfan May 17, 2023
6f42e9c
Fix failing tests
sabahirfan May 17, 2023
c12a01c
Fix build
sabahirfan May 17, 2023
5525533
Temp skip failing tests
sabahirfan May 18, 2023
3a9698a
Fix build
sabahirfan May 18, 2023
7bfb540
Fix build
sabahirfan May 18, 2023
6566bd7
Fix build
sabahirfan May 18, 2023
993e92d
Fix build
sabahirfan May 18, 2023
abdb81d
Fix failing test
sabahirfan May 18, 2023
6644fe4
Update express version
sabahirfan May 19, 2023
2cb859e
update github link
zikrurR May 19, 2023
cfe3608
Remove package-lock
sabahirfan May 21, 2023
a640ead
add node 16 to integration test docker
zikrurR May 22, 2023
2e0eb5b
update version
sabahirfan May 22, 2023
a7cba3c
Merge branch 'feat/test-pipelines' of github.com:hmcts/cmc-citizen-fr…
sabahirfan May 22, 2023
e987699
upgrade test dependencies
sabahirfan May 22, 2023
0aa50b5
uskip failing tests
sabahirfan May 22, 2023
e2a3f32
Revert fix for the test
sabahirfan May 22, 2023
0a7794d
Upgrade nodejs version to 18
sabahirfan May 22, 2023
40f22bc
Upgrade dependencies
sabahirfan May 22, 2023
079a5e5
Add catch blocks
sabahirfan May 22, 2023
bb8b749
Upgrade chardet version
sabahirfan May 22, 2023
3657c96
Merge branch 'feat/test-pipelines' into feat/civ-8456-upgrade-node-18
sabahirfan May 22, 2023
beb9129
Configure eslint
sabahirfan May 22, 2023
7db539f
Configure eslint
sabahirfan May 22, 2023
acfcf30
Update selenium imgage
sabahirfan May 22, 2023
2e1c591
Fix pipeline
sabahirfan May 17, 2023
e6f4ce4
Fix pipeline
sabahirfan May 17, 2023
f3009e4
Fix failing tests
sabahirfan May 17, 2023
9e28c70
Fix failing tests
sabahirfan May 17, 2023
377fcb2
Fix build
sabahirfan May 17, 2023
e8af3d7
Temp skip failing tests
sabahirfan May 18, 2023
612a5d2
Fix build
sabahirfan May 18, 2023
050c80c
Fix build
sabahirfan May 18, 2023
76ae159
Fix build
sabahirfan May 18, 2023
918a665
Fix build
sabahirfan May 18, 2023
06aa1fe
Fix failing test
sabahirfan May 18, 2023
a541506
Update express version
sabahirfan May 19, 2023
0d65c00
update github link
zikrurR May 19, 2023
289894c
Remove package-lock
sabahirfan May 21, 2023
ed33716
update version
sabahirfan May 22, 2023
44a1452
add node 16 to integration test docker
zikrurR May 22, 2023
74e598d
upgrade test dependencies
sabahirfan May 22, 2023
3263ba6
uskip failing tests
sabahirfan May 22, 2023
b683b7c
Revert fix for the test
sabahirfan May 22, 2023
4099474
Upgrade dependencies
sabahirfan May 22, 2023
27cf7f8
Fix: add catch to taskList builders
GorilaNaranja May 22, 2023
3a8272b
Add catch blocks
zikrurR May 24, 2023
05e0428
Upgrade chardet version
sabahirfan May 22, 2023
cf68ac4
Update Dockerfile
sabahirfan May 22, 2023
717acf5
Fix: add try/catch tasklist controller
GorilaNaranja May 23, 2023
24cb1ae
Fix: lint
GorilaNaranja May 23, 2023
4fbc051
Update: downgrade mocha version
GorilaNaranja May 23, 2023
0d16a29
Revert "Update: downgrade mocha version"
GorilaNaranja May 23, 2023
2835895
Revert "Fix: lint"
GorilaNaranja May 23, 2023
13565bd
Revert "Fix: add try/catch tasklist controller"
GorilaNaranja May 23, 2023
28a09a5
FIx: lint
GorilaNaranja May 23, 2023
458623e
Update: delete urllib3
GorilaNaranja May 24, 2023
3ea63e2
Update: delete chardet
GorilaNaranja May 24, 2023
ef6596b
Revert "Update: delete chardet"
GorilaNaranja May 24, 2023
58aab03
Update: delete chardet
GorilaNaranja May 24, 2023
67adb32
add cookie clearer
zikrurR May 25, 2023
de93161
handle promise
zikrurR May 25, 2023
ea163af
add try block
zikrurR May 25, 2023
5894c7c
add async function
zikrurR May 25, 2023
722d97e
add compile option
zikrurR May 25, 2023
b30003b
modify function
zikrurR May 25, 2023
34f0d79
Merge branch 'master' into feat/civ-8456-upgrade-node-18
sabahirfan May 26, 2023
a83fe6b
Add await to promise call
sabahirfan May 26, 2023
e5a60c4
Merge branch 'feat/civ-8456-upgrade-node-18' of github.com:hmcts/cmc-…
sabahirfan May 26, 2023
0cebb06
add await to bypass
zikrurR May 26, 2023
d1337ca
Code clean up
sabahirfan May 26, 2023
1443354
Add await to promise call
sabahirfan May 26, 2023
fabe132
Code clean up
sabahirfan May 26, 2023
b2e7f8b
add tasklist await
zikrurR May 26, 2023
e64ca79
re-organize
zikrurR May 26, 2023
d1856f3
Code clean up
sabahirfan May 26, 2023
6b93754
Merge branch 'master' into feat/test-pipelines-2-node16
sabahirfan May 30, 2023
244d380
Update Dockerfile
sabahirfan May 30, 2023
3bacf52
Rebase from version 16 branch and resolve conflicts
sabahirfan May 30, 2023
07ee843
Rebase from master and resolve conflict
sabahirfan May 30, 2023
040e3cb
Rebase from master and resolve conflict
sabahirfan May 30, 2023
0c5eef7
Merge branch 'master' into feat/civ-8456-upgrade-node-18v
sabahirfan May 30, 2023
544f714
Merge branch 'master' into feat/civ-8456-upgrade-node-18v
sabahirfan May 31, 2023
467e3ef
Add logs
sabahirfan May 31, 2023
1384821
Add logs
sabahirfan May 31, 2023
0b6f2ce
Temp disable delete users
sabahirfan May 31, 2023
022be0a
Merge branch 'master' into feat/civ-8456-upgrade-node-18v
sabahirfan May 31, 2023
525639b
Enable delete users
sabahirfan May 31, 2023
bb65f44
update selenium version
sabahirfan May 31, 2023
16cf31a
update selenium version
sabahirfan May 31, 2023
f060055
Merge remote-tracking branch 'origin' into feat/civ-8456-upgrade-node…
sabahirfan May 31, 2023
ed5cea8
Add logs
sabahirfan Jun 1, 2023
d4d6e64
Rebase from master and resolve conflict
sabahirfan Jun 1, 2023
a3796ff
Merge branch 'master' into feat/civ-8456-upgrade-node-18v
sabahirfan Jun 1, 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
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.0.0
18.15.0
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ---- Base image ----
FROM hmctspublic.azurecr.io/base/node:16-alpine as base
FROM hmctspublic.azurecr.io/base/node:18-alpine as base

ENV PUPPETEER_SKIP_DOWNLOAD=true
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Service delegates most of the non UI responsibilities to underlying services e.g

### Prerequisites

* [Node.js](https://nodejs.org/) >= 16.0.0
* [Node.js](https://nodejs.org/) >= 18.15.0
* [yarn](https://yarnpkg.com/)
* [Gulp](http://gulpjs.com/)
* [Docker](https://www.docker.com)
Expand Down
2 changes: 1 addition & 1 deletion integration-tests.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM hmctspublic.azurecr.io/base/node:16-alpine
FROM hmctspublic.azurecr.io/base/node:18-alpine

USER root

Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.1.1",
"private": true,
"engines": {
"node": ">=16.0.0"
"node": ">=18.15.0"
},
"scripts": {
"setup": "gulp sass copy-files sass-govuk-frontend",
Expand Down Expand Up @@ -53,7 +53,7 @@
"@types/express": "^4.17.2",
"@types/i18next-sprintf-postprocessor": "^0.2.0",
"@types/lodash": "^4.14.170",
"@types/node": "^16.0.0",
"@types/node": "^18.15.0",
"@types/nunjucks": "^3.1.4",
"@types/request-promise-native": "^1.0.16",
"@types/shortid": "^0.0.29",
Expand All @@ -62,6 +62,7 @@
"body-parser": "^1.19.0",
"bootstrap-datepicker": "1.9.0",
"build-url": "^2.0.0",
"chardet": "^1.5.1",
"class-transformer": "^0.5.1",
"classlist-polyfill": "^1.2.0",
"cmc-cookies-manager": "github:hmcts/cmc-cookies-manager#3.0.2",
Expand Down Expand Up @@ -104,7 +105,7 @@
"serve-favicon": "^2.5.0",
"string.prototype.startswith": "^0.2.0",
"to-boolean": "^1.0.0",
"ts-node": "^9.1.1",
"ts-node": "^10.9.1",
"tsconfig-paths": "^3.9.0",
"tslint-microsoft-contrib": "^6.2.0",
"typescript": "^3.9.8",
Expand Down
11 changes: 5 additions & 6 deletions src/integration-test/bootstrap/teardown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import { IdamClient } from 'integration-test/helpers/clients/idamClient'

module.exports = {
teardownAll: async function (claimantEmail, defendantEmail) {
console.log('teardownAll...')
try {
if (process.env.IDAM_URL) {
if (process.env.SMOKE_TEST_CITIZEN_USERNAME) {
await Promise.all([
console.log('Deleting test users...'),
IdamClient.deleteUser(claimantEmail),
IdamClient.deleteUser(defendantEmail),
IdamClient.deleteUsers([claimantEmail, defendantEmail])
])
console.log('Deleting test users...')
await IdamClient.deleteUser(claimantEmail)
await IdamClient.deleteUser(defendantEmail)
await IdamClient.deleteUsers([claimantEmail, defendantEmail])
}
}
} catch (error) {
Expand Down
22 changes: 14 additions & 8 deletions src/integration-test/helpers/clients/idamClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,17 @@ export class IdamClient {
uri: `${baseURL}/testing-support/accounts/${username}`
}

return request(options).then(function (resp) {
return Promise.resolve()
}).catch(function (err) {
// tslint:disable-next-line:no-console
console.log(`error deleting user: ${username}` + err)
})
request(options)
.then(function (resp) {
// tslint:disable-next-line:no-console
console.log(`deleteUser for ${username} got response: ${resp}`)
return Promise.resolve()
})
.catch(function (err) {
// tslint:disable-next-line:no-console
console.log(`error deleting user: ${username}` + err)
})
return Promise.resolve()
}

/**
Expand All @@ -85,14 +90,15 @@ export class IdamClient {
uri: `${baseURL}/testing-support/test-data?${params}&async=true`
}

return request(options).then(function (resp) {
request(options).then(function (resp) {
// tslint:disable-next-line:no-console
console.log(resp)
console.log(`deleteUsers for ${JSON.stringify(usernames)} got response: ${resp}`)
return Promise.resolve()
}).catch(function (err) {
// tslint:disable-next-line:no-console
console.log(`error deleting user/s ${params}: ` + err)
})
return Promise.resolve()
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/integration-test/tests/citizen/claim/steps/claim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export class ClaimSteps {
I.see(AmountHelper.formatMoney(claimAmount.getTotal()), 'table.table-form > tfoot > tr > td.numeric.last > span')
interestSteps.skipClaimantInterestTotalPage()
this.enterClaimDetails()
I.bypassPCQ()
await I.bypassPCQ().catch(e => { return false })
userSteps.selectCheckAndSubmitYourClaim()
await this.checkClaimFactsAreTrueAndSubmit(I, claimantType, defendantType, enterDefendantEmail)
}
Expand Down Expand Up @@ -299,7 +299,7 @@ export class ClaimSteps {
I.see(AmountHelper.formatMoney(claimAmount.getTotal()), 'table.table-form > tfoot > tr > td.numeric.last > span')
interestSteps.skipClaimantInterestTotalPage()
this.enterClaimDetails()
I.bypassPCQ()
await I.bypassPCQ().catch(e => { return false })
userSteps.selectCheckAndSubmitYourClaim()
I.see('Mr. John Smith')
I.see('10, DALBERG')
Expand Down Expand Up @@ -391,7 +391,7 @@ export class ClaimSteps {
I.see(AmountHelper.formatMoney(claimAmount.getTotal()), 'table.table-form > tfoot > tr > td.numeric.last > span')
interestSteps.skipClaimantInterestTotalPage()
this.enterClaimDetails()
I.bypassPCQ()
await I.bypassPCQ().catch(e => { return false })
userSteps.selectCheckAndSubmitYourClaim()
I.see('Mr. John Smith')
I.see('10, DALBERG')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if (process.env.FEATURE_ADMISSIONS === 'true') {
Scenario('Defendant agreed to pay all of the claim via immediate payment route... @fullAdmission @citizen @admissions', { retries: 3 }, async (I: I) => {
testData.paymentOption = PaymentOption.IMMEDIATELY
// as defendant
helperSteps.finishResponseWithFullAdmission(testData)
await helperSteps.finishResponseWithFullAdmission(testData)
I.click('Sign out')
// as claimant
userSteps.login(testData.claimantEmail)
Expand All @@ -47,7 +47,7 @@ if (process.env.FEATURE_ADMISSIONS === 'true') {
testData.paymentOption = PaymentOption.BY_SET_DATE
const claimantResponseTestData = new ClaimantResponseTestData()
// as defendant
helperSteps.finishResponseWithFullAdmission(testData)
await helperSteps.finishResponseWithFullAdmission(testData)
I.click('Sign out')
// as claimant
userSteps.login(testData.claimantEmail)
Expand All @@ -65,7 +65,7 @@ if (process.env.FEATURE_ADMISSIONS === 'true') {
testData.claimantPaymentOption = PaymentOption.IMMEDIATELY
const claimantResponseTestData = new ClaimantResponseTestData()
// as defendant
helperSteps.finishResponseWithFullAdmission(testData)
await helperSteps.finishResponseWithFullAdmission(testData)
I.click('Sign out')
// as claimant
userSteps.login(testData.claimantEmail)
Expand All @@ -82,7 +82,7 @@ if (process.env.FEATURE_ADMISSIONS === 'true') {
testData.claimantPaymentOption = PaymentOption.BY_SET_DATE
const claimantResponseTestData = new ClaimantResponseTestData()
// as defendant
helperSteps.finishResponseWithFullAdmission(testData)
await helperSteps.finishResponseWithFullAdmission(testData)
I.click('Sign out')
// as claimant
userSteps.login(testData.claimantEmail)
Expand All @@ -100,7 +100,7 @@ if (process.env.FEATURE_ADMISSIONS === 'true') {
testData.claimantPaymentOption = PaymentOption.INSTALMENTS
const claimantResponseTestData = new ClaimantResponseTestData()
// as defendant
helperSteps.finishResponseWithFullAdmission(testData)
await helperSteps.finishResponseWithFullAdmission(testData)
I.click('Sign out')
// as claimant
userSteps.login(testData.claimantEmail)
Expand All @@ -118,7 +118,7 @@ if (process.env.FEATURE_ADMISSIONS === 'true') {
testData.claimantPaymentOption = PaymentOption.INSTALMENTS
const unreasonableClaimantResponseTestDate = new UnreasonableClaimantResponseTestData()
// as defendant
helperSteps.finishResponseWithFullAdmission(testData)
await helperSteps.finishResponseWithFullAdmission(testData)
I.click('Sign out')
// as claimant
userSteps.login(testData.claimantEmail)
Expand All @@ -134,7 +134,7 @@ if (process.env.FEATURE_ADMISSIONS === 'true') {
Scenario('I can as a claimant accept the defendants full admission by set date with CCJ and no previous payments made @admissions @citizen', { retries: 3 }, async (I: I) => {
testData.paymentOption = PaymentOption.BY_SET_DATE
// as defendant
helperSteps.finishResponseWithFullAdmission(testData)
await helperSteps.finishResponseWithFullAdmission(testData)
I.click('Sign out')
// as claimant
userSteps.login(testData.claimantEmail)
Expand All @@ -148,7 +148,7 @@ if (process.env.FEATURE_ADMISSIONS === 'true') {
Scenario('I can as a claimant accept the defendants full admission by set date with CCJ and a previous payment made @admissions @citizen', { retries: 3 }, async (I: I) => {
testData.paymentOption = PaymentOption.BY_SET_DATE
// as defendant
helperSteps.finishResponseWithFullAdmission(testData)
await helperSteps.finishResponseWithFullAdmission(testData)
I.click('Sign out')
// as claimant
userSteps.login(testData.claimantEmail)
Expand All @@ -167,7 +167,7 @@ if (process.env.FEATURE_ADMISSIONS === 'true') {
claimantResponseTestData.isExpectingToSeeCourtOfferedInstalmentsPage = true
claimantResponseTestData.pageSpecificValues.settleClaimEnterDate = '2019-01-01'
// as defendant
helperSteps.finishResponseWithFullAdmission(testData)
await helperSteps.finishResponseWithFullAdmission(testData)
I.click('Sign out')
// as claimant
userSteps.login(testData.claimantEmail)
Expand Down
6 changes: 3 additions & 3 deletions src/integration-test/tests/citizen/defence/steps/defence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,14 +366,14 @@ export class DefenceSteps {
I.waitForText('You’ve submitted your response')
}

makeFullAdmission (
async makeFullAdmission (
defendantParty: Party,
defendantType: PartyType,
paymentOption: PaymentOption,
claimantName: string,
statementOfMeansFullDataSet: boolean = true,
respondToPCQ?: boolean
): void {
): Promise<void> {
this.confirmYourDetails(defendantParty)

this.requestMoreTimeToRespond()
Expand Down Expand Up @@ -407,7 +407,7 @@ export class DefenceSteps {
}

defendantSteps.selectCheckAndSubmitYourDefence()
I.bypassPCQ()
await I.bypassPCQ()
this.checkAndSendAndSubmit(defendantType, DefenceType.FULL_ADMISSION)

I.see('You’ve submitted your response')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ Before(async (I: I) => {
if (process.env.FEATURE_ADMISSIONS === 'true') {

Scenario('Admit all of the claim(Pay Immediately) @citizen @nightly @admissions', { retries: 3 }, async (I: I) => {
defenceSteps.makeFullAdmission(defendant, PartyType.INDIVIDUAL, PaymentOption.IMMEDIATELY, claimant, false)
await defenceSteps.makeFullAdmission(defendant, PartyType.INDIVIDUAL, PaymentOption.IMMEDIATELY, claimant, false)
})

Scenario('Admit all of the claim(Pay By Set Date) @citizen @nightly @admissions', { retries: 3 }, async (I: I) => {
defenceSteps.makeFullAdmission(defendant, PartyType.INDIVIDUAL, PaymentOption.BY_SET_DATE, claimant, false)
await defenceSteps.makeFullAdmission(defendant, PartyType.INDIVIDUAL, PaymentOption.BY_SET_DATE, claimant, false)
})

Scenario('Admit all of the claim(Pay By Instalment) with PCQ @citizen @admissions', { retries: 3 }, async (I: I) => {
defenceSteps.makeFullAdmission(defendant, PartyType.INDIVIDUAL, PaymentOption.INSTALMENTS, claimant, false, true)
await defenceSteps.makeFullAdmission(defendant, PartyType.INDIVIDUAL, PaymentOption.INSTALMENTS, claimant, false, true)
})
}
4 changes: 2 additions & 2 deletions src/integration-test/tests/citizen/endToEnd/steps/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ export class Helper {
}

// TODO: refactor with above ^^^
finishResponseWithFullAdmission (testData: EndToEndTestData): void {
async finishResponseWithFullAdmission (testData: EndToEndTestData): Promise<void> {
if (testData.paymentOption === undefined) {
testData.paymentOption = PaymentOption.IMMEDIATELY
}
defenceSteps.loginAsDefendant(testData.defendantEmail)
I.click(testData.claimRef)
I.click('Respond to claim')
defenceSteps.makeFullAdmission(testData.defendant, testData.defendantPartyType, testData.paymentOption, testData.claimantName, false)
await defenceSteps.makeFullAdmission(testData.defendant, testData.defendantPartyType, testData.paymentOption, testData.claimantName, false)
}

finishResponseWithHandOff (claimRef: string, defendant: Party, claimant: Party, defendantEmail: string, defenceType: DefenceType): void {
Expand Down
7 changes: 6 additions & 1 deletion src/main/features/claim/helpers/taskListBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ export class TaskListBuilder extends TaskStatus {
new TaskListItem('Claim amount', Paths.amountPage.uri, claimAmountCompleted),
new TaskListItem('Claim details', Paths.reasonPage.uri, ClaimDetails.isCompleted(draft))
])
)
).catch(error => {
throw new Error(`Build prepare your claim section - ${error}`)
})
}

static async buildSubmitSection (): Promise<TaskList> {
Expand All @@ -43,5 +45,8 @@ export class TaskListBuilder extends TaskStatus {
.then(prepareYourClaimSection => []
.concat(TaskListBuilder.buildBeforeYouStartSection(draft).tasks, prepareYourClaimSection.tasks)
.filter(item => !item.completed))
.catch(error => {
throw new Error(`Build remaining task error - ${error}`)
})
}
}
1 change: 1 addition & 0 deletions src/main/features/dashboard/helpers/claimStatusFlow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export class ClaimStatusFlow {
}
if (nextPossibleConditions.length === 0) {
if (!flow.dashboard) {
logger.error(`No dashboard for flow: ${JSON.stringify(flow)}`)
throw new Error(`Trying to render an intermediate state with no dashboard, check the flow's logic`)
}
return flow.dashboard
Expand Down
1 change: 0 additions & 1 deletion types/steps-override.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
declare const Scenario: (string: string, { retries: number }, callback: ICodeceptCallback) => void;
declare const xScenario: (string: string, { retries: number }, callback: ICodeceptCallback) => void;

declare namespace CodeceptJS {
export interface I {
Expand Down
Loading