Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into ORV2-2857-be-refund-t…
Browse files Browse the repository at this point in the history
…o-multiple-payment-methods
  • Loading branch information
praju-aot committed Dec 17, 2024
2 parents 64ee0ef + 51727fa commit 8d89736
Show file tree
Hide file tree
Showing 135 changed files with 16,199 additions and 29,850 deletions.
74 changes: 0 additions & 74 deletions .github/workflows/.tests.yml

This file was deleted.

94 changes: 94 additions & 0 deletions .github/workflows/e2e-regression-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: E2E Regression Tests

on:
workflow_run:
workflows: ['PR Opened']
types: [completed]
workflow_dispatch:
inputs:
### Required
target:
description: 'PR number, test, uat or prod.'
default: 'test'
required: true
type: string

jobs:
vars:
name: Set Variables
outputs:
target: ${{ steps.env.outputs.target }}
environment: ${{ steps.env.outputs.environment }}
runs-on: ubuntu-22.04
steps:
- name: env
id: env
run: |
pr="${{github.event.workflow_run.pull_requests[0].number}}"
if [[ $pr ]]; then
target="$pr"
environment="dev"
else
target=${{inputs.target}}
environment=${{inputs.target}}
fi
echo "target=$target" >> $GITHUB_OUTPUT
echo "environment=$environment" >> $GITHUB_OUTPUT
e2e-tests:
name: ${{matrix.test}}
needs: [vars]
environment: ${{needs.vars.outputs.environment}}
runs-on: ubuntu-22.04
defaults:
run:
working-directory: tests/
strategy:
fail-fast: false
matrix:
browser:
- chrome
#- edge
#- firefox
test:
- 'bceid-crud-power-units.cy.js'
- 'bceid-crud-trailers.cy.js'
- 'bceid-new-term-oversize.cy.js'
- 'bceid-new-term-overweight.cy.js'
- 'bceid-update-term-oversize.cy.js'
- 'idir-amend-term-oversize.cy.js'
- 'idir-void-term-oversize.cy.js'

timeout-minutes: 10
steps:
- uses: actions/checkout@v4

- uses: cypress-io/[email protected]
name: Cypress run
env:
CYPRESS_baseUrl: https://${{ github.event.repository.name }}-${{ needs.vars.outputs.target || 'test' }}-frontend.apps.silver.devops.gov.bc.ca/
CYPRESS_bceid_username: ${{vars.BCEID_USERNAME}}
CYPRESS_bceid_password: ${{secrets.BCEID_PASSWORD}}
CYPRESS_idir_username: ${{vars.IDIR_USERNAME}}
CYPRESS_idir_password: ${{secrets.IDIR_PASSWORD}}
with:
browser: ${{ matrix.browser }}
config: pageLoadTimeout=10000,video=true
spec: cypress/e2e/${{matrix.test}}
working-directory: tests

- uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{matrix.test}}-${{matrix.browser}} screenshot
path: tests/cypress/screenshots/
if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn`

- uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{matrix.test}}-${{matrix.browser}} video
path: tests/cypress/videos/
overwrite: true
if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn`

2 changes: 1 addition & 1 deletion .github/workflows/notifications.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Notifications
on:
workflow_run:
workflows: [PR,Merge]
workflows: ['PR Opened',Merge]
types:
- completed
jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PR
name: PR Opened

on:
pull_request:
Expand Down

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions database/mssql/scripts/utility/refresh-sample-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ USAGE="-u ORBC_USER -p ORBC_PASS -s ORBC_SERVER -d ORBC_DATABASE"
parse_options "${USAGE}" ${@}

echo "Deleting existing sample data"
sqlcmd -C -U ${ORBC_USER} -P "${ORBC_PASS}" -S ${ORBC_SERVER} -d ${ORBC_DATABASE} -Q "SET NOCOUNT ON; DELETE FROM dbo.ORBC_FEATURE_FLAG"
sqlcmd -C -U ${ORBC_USER} -P "${ORBC_PASS}" -S ${ORBC_SERVER} -d ${ORBC_DATABASE} -Q "SET NOCOUNT ON; DELETE FROM dbo.ORBC_TRAILER"
sqlcmd -C -U ${ORBC_USER} -P "${ORBC_PASS}" -S ${ORBC_SERVER} -d ${ORBC_DATABASE} -Q "SET NOCOUNT ON; DELETE FROM dbo.ORBC_POWER_UNIT"
sqlcmd -C -U ${ORBC_USER} -P "${ORBC_PASS}" -S ${ORBC_SERVER} -d ${ORBC_DATABASE} -Q "SET NOCOUNT ON; DELETE FROM dbo.ORBC_COMPANY_USER"
sqlcmd -C -U ${ORBC_USER} -P "${ORBC_PASS}" -S ${ORBC_SERVER} -d ${ORBC_DATABASE} -Q "SET NOCOUNT ON; DELETE FROM dbo.ORBC_USER"
sqlcmd -C -U ${ORBC_USER} -P "${ORBC_PASS}" -S ${ORBC_SERVER} -d ${ORBC_DATABASE} -Q "SET NOCOUNT ON; DELETE FROM dbo.ORBC_COMPANY"
sqlcmd -C -U ${ORBC_USER} -P "${ORBC_PASS}" -S ${ORBC_SERVER} -d ${ORBC_DATABASE} -Q "SET NOCOUNT ON; DELETE FROM dbo.ORBC_CONTACT"
sqlcmd -C -U ${ORBC_USER} -P "${ORBC_PASS}" -S ${ORBC_SERVER} -d ${ORBC_DATABASE} -Q "SET NOCOUNT ON; DELETE FROM dbo.ORBC_ADDRESS"
sqlcmd -C -U ${ORBC_USER} -P "${ORBC_PASS}" -S ${ORBC_SERVER} -d ${ORBC_DATABASE} -Q "SET NOCOUNT ON; DELETE FROM dbo.ORBC_POLICY_CONFIGURATION"
sqlcmd -C -U ${ORBC_USER} -P "${ORBC_PASS}" -S ${ORBC_SERVER} -d ${ORBC_DATABASE} -Q "SET QUOTED_IDENTIFIER ON; SET NOCOUNT ON; DELETE FROM dbo.ORBC_FEATURE_FLAG"
sqlcmd -C -U ${ORBC_USER} -P "${ORBC_PASS}" -S ${ORBC_SERVER} -d ${ORBC_DATABASE} -Q "SET QUOTED_IDENTIFIER ON; SET NOCOUNT ON; DELETE FROM dbo.ORBC_TRAILER"
sqlcmd -C -U ${ORBC_USER} -P "${ORBC_PASS}" -S ${ORBC_SERVER} -d ${ORBC_DATABASE} -Q "SET QUOTED_IDENTIFIER ON; SET NOCOUNT ON; DELETE FROM dbo.ORBC_POWER_UNIT"
sqlcmd -C -U ${ORBC_USER} -P "${ORBC_PASS}" -S ${ORBC_SERVER} -d ${ORBC_DATABASE} -Q "SET QUOTED_IDENTIFIER ON; SET NOCOUNT ON; DELETE FROM dbo.ORBC_COMPANY_USER"
sqlcmd -C -U ${ORBC_USER} -P "${ORBC_PASS}" -S ${ORBC_SERVER} -d ${ORBC_DATABASE} -Q "SET QUOTED_IDENTIFIER ON; SET NOCOUNT ON; DELETE FROM dbo.ORBC_USER"
sqlcmd -C -U ${ORBC_USER} -P "${ORBC_PASS}" -S ${ORBC_SERVER} -d ${ORBC_DATABASE} -Q "SET QUOTED_IDENTIFIER ON; SET NOCOUNT ON; DELETE FROM dbo.ORBC_COMPANY"
sqlcmd -C -U ${ORBC_USER} -P "${ORBC_PASS}" -S ${ORBC_SERVER} -d ${ORBC_DATABASE} -Q "SET QUOTED_IDENTIFIER ON; SET NOCOUNT ON; DELETE FROM dbo.ORBC_CONTACT"
sqlcmd -C -U ${ORBC_USER} -P "${ORBC_PASS}" -S ${ORBC_SERVER} -d ${ORBC_DATABASE} -Q "SET QUOTED_IDENTIFIER ON; SET NOCOUNT ON; DELETE FROM dbo.ORBC_ADDRESS"
sqlcmd -C -U ${ORBC_USER} -P "${ORBC_PASS}" -S ${ORBC_SERVER} -d ${ORBC_DATABASE} -Q "SET QUOTED_IDENTIFIER ON; SET NOCOUNT ON; DELETE FROM dbo.ORBC_POLICY_CONFIGURATION"
echo "Finished deleting existing sample data"

echo "Loading sample data...please wait"
Expand Down
3 changes: 2 additions & 1 deletion database/mssql/scripts/versions/revert/v_39_ddl_revert.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ BEGIN TRY
ALTER TABLE [permit].[ORBC_NO_FEE_TYPE] DROP CONSTRAINT [DF_ORBC_NO_FEE_TYPE_DB_CREATE_TIMESTAMP]
ALTER TABLE [permit].[ORBC_NO_FEE_TYPE] DROP CONSTRAINT [DF_ORBC_NO_FEE_TYPE_DB_LAST_UPDATE_USERID]
ALTER TABLE [permit].[ORBC_NO_FEE_TYPE] DROP CONSTRAINT [DF_ORBC_NO_FEE_TYPE_DB_LAST_UPDATE_TIMESTAMP]
ALTER TABLE [permit].[ORBC_SPECIAL_AUTH_HIST] ALTER COLUMN NO_FEE_TYPE VARCHAR(12) NOT NULL
-- History table should not have any constraints
-- ALTER TABLE [permit].[ORBC_SPECIAL_AUTH_HIST] ALTER COLUMN NO_FEE_TYPE VARCHAR(12) NOT NULL
COMMIT
END TRY

Expand Down
3 changes: 2 additions & 1 deletion database/mssql/scripts/versions/revert/v_42_ddl_revert.sql
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ BEGIN TRY
DROP TABLE [case].[ORBC_CASE_TYPE]
DROP TABLE [case].[ORBC_CASE_STATUS_TYPE]
DROP SCHEMA [case]
DELETE FROM [permit].[ORBC_PERMIT_STATUS_TYPE] WHERE [PERMIT_STATUS_TYPE] ='IN_QUEUE'
-- Commenting the below line to Avoid FK constraints while running moti-reset-db.sh
-- DELETE FROM [permit].[ORBC_PERMIT_STATUS_TYPE] WHERE [PERMIT_STATUS_TYPE] ='IN_QUEUE'
COMMIT
END TRY

Expand Down
97 changes: 97 additions & 0 deletions database/mssql/scripts/versions/revert/v_51_ddl_revert.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET NOCOUNT ON
GO

SET XACT_ABORT ON
GO
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
GO
BEGIN TRANSACTION
GO

-- Remove the indexes on the new columns
IF EXISTS (SELECT * FROM sys.indexes WHERE name = 'IX_ORBC_POLICY_CONFIGURATION_UQ_IS_PRIMARY_DRAFT')
DROP INDEX IX_ORBC_POLICY_CONFIGURATION_UQ_IS_PRIMARY_DRAFT ON ORBC_POLICY_CONFIGURATION;
IF EXISTS (SELECT * FROM sys.indexes WHERE name = 'IX_FK_ORBC_POLICY_CONFIGURATION_ORIGIN_ID')
DROP INDEX IX_FK_ORBC_POLICY_CONFIGURATION_ORIGIN_ID ON ORBC_POLICY_CONFIGURATION;
IF EXISTS (SELECT * FROM sys.indexes WHERE name = 'IX_ORBC_POLICY_CONFIGURATION_IS_DRAFT')
DROP INDEX IX_ORBC_POLICY_CONFIGURATION_IS_DRAFT ON ORBC_POLICY_CONFIGURATION;
IF EXISTS (SELECT * FROM sys.indexes WHERE name = 'IX_ORBC_POLICY_CONFIGURATION_EFFECTIVE_DATE')
DROP INDEX IX_ORBC_POLICY_CONFIGURATION_EFFECTIVE_DATE ON ORBC_POLICY_CONFIGURATION;
GO

IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Drop the columns from main and history tables
ALTER TABLE [dbo].[ORBC_POLICY_CONFIGURATION]
DROP CONSTRAINT FK_ORBC_POLICY_CONFIGURATION_ORIGIN_ID
ALTER TABLE [dbo].[ORBC_POLICY_CONFIGURATION]
DROP COLUMN ORIGIN_ID
ALTER TABLE [dbo].[ORBC_POLICY_CONFIGURATION]
DROP COLUMN IS_PRIMARY_DRAFT
GO

IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Revert the trigger changes to remove the added columns
ALTER TRIGGER [dbo].[ORBC_POLCFG_A_S_IUD_TR] ON [dbo].[ORBC_POLICY_CONFIGURATION] FOR INSERT, UPDATE, DELETE AS
SET NOCOUNT ON
BEGIN TRY
DECLARE @curr_date datetime;
SET @curr_date = getutcdate();
IF NOT EXISTS(SELECT * FROM inserted) AND NOT EXISTS(SELECT * FROM deleted)
RETURN;

-- historical
IF EXISTS(SELECT * FROM deleted)
update [dbo].[ORBC_POLICY_CONFIGURATION_HIST] set END_DATE_HIST = @curr_date where POLICY_CONFIGURATION_ID in (select POLICY_CONFIGURATION_ID from deleted) and END_DATE_HIST is null;

IF EXISTS(SELECT * FROM inserted)
insert into [dbo].[ORBC_POLICY_CONFIGURATION_HIST] ([POLICY_CONFIGURATION_ID], [EFFECTIVE_DATE], [IS_DRAFT], [CHANGE_DESCRIPTION], [APP_CREATE_TIMESTAMP], [APP_CREATE_USERID], [APP_CREATE_USER_GUID], [APP_CREATE_USER_DIRECTORY], [APP_LAST_UPDATE_TIMESTAMP], [APP_LAST_UPDATE_USER_GUID], [APP_LAST_UPDATE_USER_DIRECTORY], [CONCURRENCY_CONTROL_NUMBER], [DB_CREATE_USERID], [DB_CREATE_TIMESTAMP], [DB_LAST_UPDATE_USERID], [DB_LAST_UPDATE_TIMESTAMP], _POLICY_CONFIGURATION_HIST_ID, END_DATE_HIST, EFFECTIVE_DATE_HIST)
select [POLICY_CONFIGURATION_ID], [EFFECTIVE_DATE], [IS_DRAFT], [CHANGE_DESCRIPTION], [APP_CREATE_TIMESTAMP], [APP_CREATE_USERID], [APP_CREATE_USER_GUID], [APP_CREATE_USER_DIRECTORY], [APP_LAST_UPDATE_TIMESTAMP], [APP_LAST_UPDATE_USER_GUID], [APP_LAST_UPDATE_USER_DIRECTORY], [CONCURRENCY_CONTROL_NUMBER], [DB_CREATE_USERID], [DB_CREATE_TIMESTAMP], [DB_LAST_UPDATE_USERID], [DB_LAST_UPDATE_TIMESTAMP], (next value for [dbo].[ORBC_POLICY_CONFIGURATION_H_ID_SEQ]) as [_POLICY_CONFIGURATION_HIST_ID], null as [END_DATE_HIST], @curr_date as [EFFECTIVE_DATE_HIST] from inserted;

END TRY
BEGIN CATCH
IF @@trancount > 0 ROLLBACK TRANSACTION
EXEC orbc_error_handling
END CATCH;
GO

IF @@ERROR <> 0 SET NOEXEC ON
GO

-- Remove the added policy configuration
DELETE FROM [dbo].[ORBC_POLICY_CONFIGURATION]
WHERE POLICY_CONFIGURATION_ID = (SELECT MAX(POLICY_CONFIGURATION_ID) FROM [dbo].[ORBC_POLICY_CONFIGURATION])
GO

IF @@ERROR <> 0 SET NOEXEC ON
GO

DECLARE @VersionDescription VARCHAR(255)
SET @VersionDescription = 'Reverting updates to policy configuration table for config versioning'

INSERT [dbo].[ORBC_SYS_VERSION] ([VERSION_ID], [DESCRIPTION], [RELEASE_DATE]) VALUES (50, @VersionDescription, getutcdate())
GO

IF @@ERROR <> 0 SET NOEXEC ON
GO

COMMIT TRANSACTION
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO
DECLARE @Success AS BIT
SET @Success = 1
SET NOEXEC OFF
IF (@Success = 1) PRINT 'The database revert succeeded'
ELSE BEGIN
IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION
PRINT 'The database revert failed'
END
GO
Loading

0 comments on commit 8d89736

Please sign in to comment.