Skip to content

Commit

Permalink
Merge pull request #7459 from opengovsg/release_v6.131.0
Browse files Browse the repository at this point in the history
build: release v6.131.0
  • Loading branch information
kevin9foong authored Jul 1, 2024
2 parents 9b98847 + ef1599b commit 2cfcda8
Show file tree
Hide file tree
Showing 48 changed files with 1,118 additions and 265 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ jobs:
- run: npm run build
env:
NODE_OPTIONS: '--max-old-space-size=4096 --openssl-legacy-provider'
AWS_SDK_JS_SUPPRESS_MAINTENANCE_MODE_MESSAGE: 1
- name: Upload build files
uses: actions/upload-artifact@v2
if: always()
Expand Down Expand Up @@ -98,6 +99,7 @@ jobs:
- name: Run frontend test
env:
NODE_OPTIONS: --max-old-space-size=4096
AWS_SDK_JS_SUPPRESS_MAINTENANCE_MODE_MESSAGE: 1
run: npm run test:frontend

frontend_lint:
Expand Down Expand Up @@ -157,6 +159,7 @@ jobs:
- run: npm run test:backend:ci
env:
NODE_OPTIONS: '--max-old-space-size=4096'
AWS_SDK_JS_SUPPRESS_MAINTENANCE_MODE_MESSAGE: 1
- name: Coveralls
uses: coverallsapp/github-action@master
with:
Expand Down
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ fi
# Initialise git-secrets configuration
git-secrets --register-aws > /dev/null

echo "Running git-secrets..."
echo "Running git-secrets commit_msg_hook"
# Scans the commit message.
git-secrets --commit_msg_hook -- "$@"
2 changes: 1 addition & 1 deletion .husky/prepare-commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fi
# Initialise git-secrets configuration
git-secrets --register-aws > /dev/null

echo "Running git-secrets..."
echo "Running git-secrets prepare_commit_msg_hook"
# Determines if merging in a commit will introduce tainted history.
git-secrets --prepare_commit_msg_hook -- "$@"

17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,27 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [v6.131.0](https://github.com/opengovsg/FormSG/compare/v6.130.1...v6.131.0)

- fix: update husky commit hook status msg [`#7458`](https://github.com/opengovsg/FormSG/pull/7458)
- build: merge release v6.130.1 to develop [`#7455`](https://github.com/opengovsg/FormSG/pull/7455)
- fix(attachment): convoy separation (#7449) [`#7451`](https://github.com/opengovsg/FormSG/pull/7451)
- chore(deps-dev): bump @types/lodash from 4.17.5 to 4.17.6 in /shared [`#7452`](https://github.com/opengovsg/FormSG/pull/7452)
- build: merge release v6.130.0 to develop [`#7447`](https://github.com/opengovsg/FormSG/pull/7447)
- feat(admin-form): support nric masking [`#7388`](https://github.com/opengovsg/FormSG/pull/7388)
- chore: replace outdated esrv id link [`#7438`](https://github.com/opengovsg/FormSG/pull/7438)
- chore: add minor changes to sample form submission api [`#7442`](https://github.com/opengovsg/FormSG/pull/7442)
- fix: silence aws-sdk deprecation warnings [`#7445`](https://github.com/opengovsg/FormSG/pull/7445)
- fix: move link to constants file, move out helper text as own component [`b549278`](https://github.com/opengovsg/FormSG/commit/b549278906a6960879066760c574340119cc7832)
- fix: remove memo from low cost component [`10b037d`](https://github.com/opengovsg/FormSG/commit/10b037d707f096591ebbd1bdaba90ecc9da7175f)

#### [v6.130.1](https://github.com/opengovsg/FormSG/compare/v6.130.0...v6.130.1)

> 27 June 2024

- fix(attachment): convoy separation [`#7449`](https://github.com/opengovsg/FormSG/pull/7449)
- build: release v6.130.0 [`#7441`](https://github.com/opengovsg/FormSG/pull/7441)
- chore: bump version to v6.130.1 [`f1acaf0`](https://github.com/opengovsg/FormSG/commit/f1acaf068c3bf9a579c76021674c9c59212958bb)

#### [v6.130.0](https://github.com/opengovsg/FormSG/compare/v6.129.0...v6.130.0)

Expand Down
28 changes: 19 additions & 9 deletions __tests__/e2e/helpers/createForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,20 +291,30 @@ const addAuthSettings = async (
await page.getByRole('tab', { name: 'Singpass' }).click()

// Ensure that we are on the auth page
await expect(
page.getByRole('heading', { name: 'Enable Singpass authentication' }),
).toBeVisible()
await expect(page.getByRole('heading', { name: 'Singpass' })).toBeVisible()

await page
.locator('label', {
has: page.locator(
`input[type='radio'][value='${formSettings.authType}']`,
),
has: page.locator('[aria-label="Enable Singpass authentication"]'),
})
.first() // Since 'Singpass' will match all radio options, pick the first matching one.
.click({ position: { x: 1, y: 1 } }) // Clicking the center of the sgid button launches the sgid contact form, put this here until we get rid of the link
.click()

await expectToast(page, /form authentication successfully updated/i)
await expectToast(page, /singpass authentication successfully enabled/i)

// Don't need to click if SGID is desired auth type
// since SGID is the default once Singpass is enabled
if (formSettings.authType !== FormAuthType.SGID) {
await page
.locator('label', {
has: page.locator(
`input[type='radio'][value='${formSettings.authType}']`,
),
})
.first() // Since 'Singpass' will match all radio options, pick the first matching one.
.click({ position: { x: 1, y: 1 } }) // Clicking the center of the sgid button launches the sgid contact form, put this here until we get rid of the link

await expectToast(page, /singpass authentication successfully updated/i)
}

switch (formSettings.authType) {
case FormAuthType.SP:
Expand Down
4 changes: 2 additions & 2 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "form-frontend",
"version": "6.130.1",
"version": "6.131.0",
"homepage": ".",
"private": true,
"dependencies": {
Expand Down
17 changes: 14 additions & 3 deletions frontend/src/features/admin-form/common/AdminViewFormService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ import {
filterHiddenInputs,
} from '~features/public-form/utils'

import { PREVIEW_MOCK_UINFIN } from '../preview/constants'
import {
PREVIEW_MASKED_MOCK_UINFIN,
PREVIEW_MOCK_UINFIN,
} from '../preview/constants'

// endpoint exported for testing
export const ADMIN_FORM_ENDPOINT = '/admin/forms'
Expand Down Expand Up @@ -58,7 +61,11 @@ export const previewForm = async (
// Add default mock authenticated state if previewing an authenticatable form
// and if server has not already sent back a mock authenticated state.
if (data.form.authType !== FormAuthType.NIL && !data.spcpSession) {
data.spcpSession = { userName: PREVIEW_MOCK_UINFIN }
data.spcpSession = {
userName: data.form.isNricMaskEnabled
? PREVIEW_MASKED_MOCK_UINFIN
: PREVIEW_MOCK_UINFIN,
}
}

// Inject MyInfo preview values into form fields (if they are MyInfo fields).
Expand Down Expand Up @@ -87,7 +94,11 @@ export const viewFormTemplate = async (
// Add default mock authenticated state if previewing an authenticatable form
// and if server has not already sent back a mock authenticated state.
if (data.form.authType !== FormAuthType.NIL && !data.spcpSession) {
data.spcpSession = { userName: PREVIEW_MOCK_UINFIN }
data.spcpSession = {
userName: data.form.isNricMaskEnabled
? PREVIEW_MASKED_MOCK_UINFIN
: PREVIEW_MOCK_UINFIN,
}
}

// Inject MyInfo preview values into form fields (if they are MyInfo fields).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import { FormAuthType, FormLogoState, FormStartPage } from '~shared/types'

import { useIsMobile } from '~hooks/useIsMobile'

import { PREVIEW_MOCK_UINFIN } from '~features/admin-form/preview/constants'
import {
PREVIEW_MASKED_MOCK_UINFIN as PREVIEW_MASKED_MOCK_UINFIN,
PREVIEW_MOCK_UINFIN,
} from '~features/admin-form/preview/constants'
import { useEnv } from '~features/env/queries'
import { FormInstructions } from '~features/public-form/components/FormInstructions/FormInstructions'
import {
Expand Down Expand Up @@ -197,7 +200,9 @@ export const StartPageView = () => {
showHeader
loggedInId={
form && form.authType !== FormAuthType.NIL
? PREVIEW_MOCK_UINFIN
? form.isNricMaskEnabled
? PREVIEW_MASKED_MOCK_UINFIN
: PREVIEW_MOCK_UINFIN
: undefined
}
{...formHeaderProps}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import { PaymentsThankYouSvgr } from '~components/FormEndPage/PaymentsThankYouSv
import { ThankYouSvgr } from '~components/FormEndPage/ThankYouSvgr'

import { useAdminForm } from '~features/admin-form/common/queries'
import { PREVIEW_MOCK_UINFIN } from '~features/admin-form/preview/constants'
import {
PREVIEW_MASKED_MOCK_UINFIN,
PREVIEW_MOCK_UINFIN,
} from '~features/admin-form/preview/constants'
import { useEnv } from '~features/env/queries'
import {
FormBannerLogo,
Expand Down Expand Up @@ -90,7 +93,9 @@ export const EndPageContent = (): JSX.Element => {
onLogout={undefined}
loggedInId={
form && form.authType !== FormAuthType.NIL
? PREVIEW_MOCK_UINFIN
? form.isNricMaskEnabled
? PREVIEW_MASKED_MOCK_UINFIN
: PREVIEW_MOCK_UINFIN
: undefined
}
/>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/features/admin-form/preview/constants.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export const PREVIEW_MOCK_UINFIN = 'S1234567A'
export const PREVIEW_MASKED_MOCK_UINFIN = '*****567A'
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,42 @@ export default {
} as Meta

const Template: Story = () => <SettingsAuthPage />
export const PrivateEmailForm = Template.bind({})
PrivateEmailForm.parameters = {
export const PrivateEmailNilAuthForm = Template.bind({})
PrivateEmailNilAuthForm.parameters = {
msw: buildMswRoutes({ status: FormStatus.Private }),
}

export const PrivateStorageForm = Template.bind({})
PrivateStorageForm.parameters = {
export const PrivateStorageNilAuthForm = Template.bind({})
PrivateStorageNilAuthForm.parameters = {
msw: buildMswRoutes({
responseMode: FormResponseMode.Encrypt,
status: FormStatus.Private,
}),
}

export const PublicEmailSingpassForm = Template.bind({})
PublicEmailSingpassForm.parameters = {
export const PublicEmailNilAuthForm = Template.bind({})
PublicEmailNilAuthForm.parameters = {
msw: buildMswRoutes({
responseMode: FormResponseMode.Email,
status: FormStatus.Public,
authType: FormAuthType.SP,
esrvcId: 'STORYBOOK-TEST',
}),
}

export const PublicStorageNilAuthForm = Template.bind({})
PublicStorageNilAuthForm.parameters = {
msw: buildMswRoutes({
responseMode: FormResponseMode.Encrypt,
status: FormStatus.Public,
}),
}

// purpose: tests that isNricMaskEnabled should not affect setting options available
export const PublicStorageNilAuthFormNricMaskingEnabled = Template.bind({})
PublicStorageNilAuthFormNricMaskingEnabled.parameters = {
msw: buildMswRoutes({
responseMode: FormResponseMode.Encrypt,
status: FormStatus.Public,
isNricMaskEnabled: true,
}),
}

Expand All @@ -63,9 +80,31 @@ PrivateStorageCorppassForm.parameters = {
status: FormStatus.Private,
authType: FormAuthType.CP,
responseMode: FormResponseMode.Encrypt,
esrvcId: 'STORYBOOK-TEST',
}),
}

export const PublicEmailSingpassForm = Template.bind({})
PublicEmailSingpassForm.parameters = {
msw: buildMswRoutes({
status: FormStatus.Public,
authType: FormAuthType.SP,
esrvcId: 'STORYBOOK-TEST',
}),
}

export const PrivateEmailMyInfoWithoutMyInfoFieldsForm = Template.bind({})
PrivateEmailMyInfoWithoutMyInfoFieldsForm.parameters = {
msw: [
...buildMswRoutes({
status: FormStatus.Private,
authType: FormAuthType.MyInfo,
esrvcId: 'STORYBOOK-TEST',
}),
...createFormBuilderMocks({ form_fields: [] }),
],
}

export const PrivateEmailMyinfoForm = Template.bind({})
PrivateEmailMyinfoForm.parameters = {
msw: [
Expand All @@ -78,6 +117,39 @@ PrivateEmailMyinfoForm.parameters = {
],
}

export const PublicEmailMyInfoForm = Template.bind({})
PublicEmailMyInfoForm.parameters = {
msw: [
...buildMswRoutes({
status: FormStatus.Public,
authType: FormAuthType.MyInfo,
esrvcId: 'STORYBOOK-TEST',
}),
...createFormBuilderMocks({ form_fields: MOCK_FORM_FIELDS_WITH_MYINFO }),
],
}

export const PrivateEmailSingpassFormNricMaskingEnabled = Template.bind({})
PrivateEmailSingpassFormNricMaskingEnabled.parameters = {
msw: buildMswRoutes({
status: FormStatus.Private,
authType: FormAuthType.SGID,
isNricMaskEnabled: true,
}),
}
export const PrivateEmailMyInfoFormNricMaskingEnabled = Template.bind({})
PrivateEmailMyInfoFormNricMaskingEnabled.parameters = {
msw: [
...buildMswRoutes({
status: FormStatus.Private,
authType: FormAuthType.MyInfo,
esrvcId: 'STORYBOOK-TEST',
isNricMaskEnabled: true,
}),
...createFormBuilderMocks({ form_fields: MOCK_FORM_FIELDS_WITH_MYINFO }),
],
}

export const Loading = Template.bind({})
Loading.parameters = {
msw: [getAdminFormSettings({ delay: 'infinite' })],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const SettingsAuthPage = (): JSX.Element => {

return (
<>
<CategoryHeader>Enable Singpass authentication</CategoryHeader>
<CategoryHeader>Singpass</CategoryHeader>
<AuthSettingsSection />
</>
)
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/features/admin-form/settings/SettingsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ export const updateFormAuthType: UpdateFormFn<'authType'> = async (
return updateFormSettings(formId, { authType: newAuthType })
}

export const updateFormNricMask: UpdateFormFn<'isNricMaskEnabled'> = async (
formId,
newIsNricMaskEnabled,
) => {
return updateFormSettings(formId, {
isNricMaskEnabled: newIsNricMaskEnabled,
})
}

export const updateFormEsrvcId: UpdateFormFn<'esrvcId'> = async (
formId,
newEsrvcId,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Text } from '@chakra-ui/react'

import { GUIDE_SPCP_ESRVCID } from '~constants/links'
import Link from '~components/Link'

export const AuthSettingsDescriptionText = () => {
return (
<Text textStyle="subhead-1" color="secondary.500" mb="2.5rem" mt="2.5rem">
Authenticate respondents by NRIC/FIN.{' '}
<Link
textStyle="subhead-1"
href={GUIDE_SPCP_ESRVCID}
isExternal
// Needed for link to open since there are nested onClicks
onClickCapture={(e) => e.stopPropagation()}
>
Learn more about Singpass authentication
</Link>
</Text>
)
}
Loading

0 comments on commit 2cfcda8

Please sign in to comment.