Skip to content

Commit

Permalink
UI - menu items in business tombstone (#48)
Browse files Browse the repository at this point in the history
* menu options in tombstone; confirm dissolution dialog; small bug fixes

* add cypress tests

* clean-up

* add new ticket number for future work
  • Loading branch information
patrickpeinanw authored Sep 23, 2024
1 parent a616897 commit 9d41e70
Show file tree
Hide file tree
Showing 11 changed files with 290 additions and 87 deletions.
32 changes: 0 additions & 32 deletions cypress/e2e/components/tombstone/digital-credentials.cy.ts

This file was deleted.

95 changes: 95 additions & 0 deletions cypress/e2e/components/tombstone/menu-options.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
context('Business tombstone - action buttons in the dropdown menu', () => {
it('Verify the Digital Business Cards button works', () => {
// Intercept the GET request for the digital business card page
cy.intercept('GET', '**/**/digital-credentials/**').as('getDigitalCredentials')

cy.visitBusinessDashFor('businessInfo/sp/withDigitalCredential.json')

cy.get('[data-cy="button.moreActions"]')
.click()
.find('[data-cy="button.digitalCredentials"]')
.should('have.text', 'Digital Business Cards')
.as('digitalBusinessCardsButton')

cy.fixture('businessInfo/sp/withDigitalCredential.json').then((businessInfo) => {
cy.get('@digitalBusinessCardsButton')
.click()
.wait('@getDigitalCredentials')
.its('request.url').should('include', `/${businessInfo.business.identifier}/digital-credentials/`)
})
})

it('The button should be hidden when allowedActions.digitalBusinessCard === false', () => {
cy.visitBusinessDashFor('businessInfo/sp/active.json')

cy.get('[data-cy="button.moreActions"]')
.click()
.find('[data-cy="button.digitalCredentials"]')
.should('not.exist')
})

it('Verify the action buttons in the dropdown menu', () => {
// Intercept the request for Continuation Out, Request AGM Extension, Request AGM Location Change, and Amalgamate
cy.intercept('GET', '**/**/consent-continuation-out?**filingId=0**').as('goToContinuationOut')
cy.intercept('GET', '**/**/agm-extension?**filingId=0**').as('goToAgmExtension')
cy.intercept('GET', '**/**/agm-location-chg?**filingId=0**').as('goToAgmLocationChange')
cy.intercept('GET', '**/**/amalgamation-selection?**').as('goToAmalgamation')

cy.visitBusinessDashFor('businessInfo/ben/active.json')
.get('[data-cy="button.moreActions"]').as('moreActionsButton')
.click()
.find('[data-cy="button.consentToContinueOut"]')
.should('have.text', 'Consent to Continue Out')
.click()
.wait('@goToContinuationOut')

cy.visitBusinessDashFor('businessInfo/ben/active.json')
.get('@moreActionsButton')
.click()
.find('[data-cy="button.requestAgmExtension"]')
.should('have.text', 'Request AGM Extension')
.click()
.wait('@goToAgmExtension')

cy.visitBusinessDashFor('businessInfo/ben/active.json')
.get('@moreActionsButton')
.click()
.find('[data-cy="button.requestAgmLocationChange"]')
.should('have.text', 'Request AGM Location Change')
.click()
.wait('@goToAgmLocationChange')

cy.visitBusinessDashFor('businessInfo/ben/active.json')
.get('@moreActionsButton')
.click()
.find('[data-cy="button.amalgamate"]')
.should('have.text', 'Amalgamate')
.click()
.wait('@goToAmalgamation')
})

it('Verify the dissolve business button works', () => {
// open the dissolution confirm dialog for 'Voluntary Dissolution' for a BEN company
cy.visitBusinessDashFor('businessInfo/ben/active.json')
.get('[data-cy="button.moreActions"]')
.click()
.find('[data-cy="button.dissolveBusiness"]')
.should('have.text', 'Dissolve this Business')
.click()
.get('[data-cy="bcros-dialog-confirmDissolution"]')
.find('[data-cy="bcros-dialog-title"]')
.should('have.text', 'Voluntary Dissolution')

// open the dissolution confirm dialog for 'Dissolution' for a SP company
cy.visitBusinessDashFor('businessInfo/sp/active.json')
.get('[data-cy="button.moreActions"]')
.click()
.find('[data-cy="button.dissolveBusiness"]')
.click()
.get('[data-cy="bcros-dialog-confirmDissolution"]')
.find('[data-cy="bcros-dialog-title"]')
.should('have.text', 'Dissolution')

// TO-DO: test the buttons and redirections in ticket #23467
})
})
2 changes: 1 addition & 1 deletion src/components/bcros/LegalObligation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const hasNoMaintenanceFilings = computed(() =>
// - it is an active business (no temp business)
// - it has no tasks in todo section and no maintenance filings in the filing history
const showLegalObligation = computed(() => {
return !dismissed.value && !!obligations && isActive && prop.noTasks && hasNoMaintenanceFilings.value
return !dismissed.value && !!obligations.value && isActive && prop.noTasks && hasNoMaintenanceFilings.value
})
const readMore = ref(false)
Expand Down
52 changes: 35 additions & 17 deletions src/components/bcros/businessDetails/LinkActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,22 @@ import { FilingTypes } from '@bcrs-shared-components/enums'
import { FilingSubTypeE } from '~/enums/filing-sub-type-e'
const { currentBusiness } = storeToRefs(useBcrosBusiness())
const { goToDigitalCredentialsPage } = useBcrosNavigate()
const { goToDigitalCredentialsPage, goToBusinessDashboard } = useBcrosNavigate()
const { isAllowedToFile } = useBcrosBusiness()
const { getStoredFlag } = useBcrosLaunchdarkly()
const t = useNuxtApp().$i18n.t
const emit = defineEmits(['dissolve'])
interface MenuActionItem extends DropdownItem {
showButton: boolean
tooltip?: string
name?: string
}
const param = { filingId: '0' }
const allActions: ComputedRef<Array<MenuActionItem>> = computed(() => {
return [
{ // <!-- View/Add Digital Credentials -->
Expand All @@ -26,7 +31,8 @@ const allActions: ComputedRef<Array<MenuActionItem>> = computed(() => {
click: () => {
goToDigitalCredentialsPage()
},
tooltip: t('tooltip.tombstone.menuAction.digitalCredentials')
tooltip: t('tooltip.tombstone.menuAction.digitalCredentials'),
name: 'digitalCredentials'
},
{ // <!-- Dissolve Business -->
showButton: currentBusiness.value.state !== BusinessStateE.HISTORICAL,
Expand All @@ -35,64 +41,70 @@ const allActions: ComputedRef<Array<MenuActionItem>> = computed(() => {
!isAllowedToFile(FilingTypes.DISSOLUTION, FilingSubTypeE.DISSOLUTION_VOLUNTARY),
label: t('button.tombstone.menuAction.dissolveBusiness'),
click: () => {
// TO-DO: open a dialog to confirm dissolution; then redirect to the dissolution page, e.g.
// https://dev.create.business.bcregistry.gov.bc.ca/dissolution-define-dissolution?id=BC0883549&accountid=3040
// open a dialog to confirm dissolution
emit('dissolve')
},
tooltip: t('tooltip.tombstone.menuAction.dissolveBusiness')
tooltip: t('tooltip.tombstone.menuAction.dissolveBusiness'),
name: 'dissolveBusiness'
},
{ // <!-- Consent to Amalgamate Out -->
showButton: currentBusiness.value.state !== BusinessStateE.HISTORICAL,
disabled: !isAllowedToFile(FilingTypes.CONSENT_AMALGAMATION_OUT),
label: t('button.tombstone.menuAction.consentToAmalgamateOut'),
click: () => {
// TO-DO: redirect to the filing page (URL to be confirmed)
goToBusinessDashboard(`/${currentBusiness.value.identifier}/consent-amalgamation-out'`, param)
},
tooltip: t('tooltip.tombstone.menuAction.consentToAmalgamateOut')
tooltip: t('tooltip.tombstone.menuAction.consentToAmalgamateOut'),
name: 'consentToAmalgamateOut'
},
{ // <!-- Consent to Continue Out -->
showButton: currentBusiness.value.state !== BusinessStateE.HISTORICAL,
disabled: !isAllowedToFile(FilingTypes.CONSENT_CONTINUATION_OUT),
label: t('button.tombstone.menuAction.consentToContinueOut'),
click: () => {
// TO-DO: redirect to https://dev.business.bcregistry.gov.bc.ca/{identifier}/consent-continuation-out
goToBusinessDashboard(`/${currentBusiness.value.identifier}/consent-continuation-out`, param)
},
tooltip: t('tooltip.tombstone.menuAction.consentToContinueOut')
tooltip: t('tooltip.tombstone.menuAction.consentToContinueOut'),
name: 'consentToContinueOut'
},
{ // <!-- Request AGM Extension -->
showButton: currentBusiness.value.state !== BusinessStateE.HISTORICAL,
disabled: !isAllowedToFile(FilingTypes.AGM_EXTENSION),
label: t('button.tombstone.menuAction.requestAgmExtension'),
click: () => {
// TO-DO: redirect to https://dev.business.bcregistry.gov.bc.ca/{identifier}/agm-extension
goToBusinessDashboard(`/${currentBusiness.value.identifier}/agm-extension`, param)
},
tooltip:
!isAllowedToFile(FilingTypes.AGM_EXTENSION)
? t('tooltip.tombstone.menuAction.requirementsForRequestAgmExtension')
: t('tooltip.tombstone.menuAction.requestAgmExtension')
: t('tooltip.tombstone.menuAction.requestAgmExtension'),
name: 'requestAgmExtension'
},
{ // <!-- Request AGM Location Change -->
showButton: currentBusiness.value.state !== BusinessStateE.HISTORICAL,
disabled: !isAllowedToFile(FilingTypes.AGM_LOCATION_CHANGE),
label: t('button.tombstone.menuAction.requestAgmLocationChange'),
click: () => {
// TO-DO: redirect to https://dev.business.bcregistry.gov.bc.ca/{identifier}/agm-location-chg
goToBusinessDashboard(`/${currentBusiness.value.identifier}/agm-location-chg`, param)
},
tooltip:
!isAllowedToFile(FilingTypes.AGM_EXTENSION)
? t('tooltip.tombstone.menuAction.requirementsForRequestAgmLocationChange')
: t('tooltip.tombstone.menuAction.requestAgmLocationChange')
: t('tooltip.tombstone.menuAction.requestAgmLocationChange'),
name: 'requestAgmLocationChange'
},
{ // <!-- Amalgamate -->
showButton: currentBusiness.value.state !== BusinessStateE.HISTORICAL,
disabled: !isAllowedToFile(FilingTypes.AGM_LOCATION_CHANGE),
label: t('button.tombstone.menuAction.amalgamate'),
click: () => {
// TO-DO: redirect to https://dev.business.bcregistry.gov.bc.ca/{identifier}/amalgamation-selection
goToBusinessDashboard(`/${currentBusiness.value.identifier}/amalgamation-selection`)
},
tooltip:
currentBusiness.value.adminFreeze
? t('tooltip.tombstone.menuAction.isNotFrozenForAmalgamate')
: t('tooltip.tombstone.menuAction.amalgamate')
: t('tooltip.tombstone.menuAction.amalgamate'),
name: 'amalgamate'
}]
})
Expand All @@ -109,7 +121,7 @@ const actions: ComputedRef<Array<Array<MenuActionItem>>> = computed(() => {
:items="actions"
:popper="{ placement: 'bottom-start' }"
:ui="{
container: 'bg-blue-500 w-auto'
container: 'w-auto'
}"
padding="p3"
data-cy="button.moreActions"
Expand All @@ -130,7 +142,13 @@ const actions: ComputedRef<Array<Array<MenuActionItem>>> = computed(() => {
arrow: true
}"
>
<UButton variant="ghost" :label="item.label" class="w-full text-nowrap" @click="item.click" />
<UButton
variant="ghost"
:label="item.label"
:data-cy="'button.' + item.name"
class="w-full text-nowrap"
@click="item.click"
/>
</BcrosTooltip>
<div v-else class="w-full">
<UButton variant="ghost" :label="item.label" class="w-full text-nowrap" @click="item.click" />
Expand Down
Loading

0 comments on commit 9d41e70

Please sign in to comment.