Skip to content

Commit

Permalink
Side accordions for addresses, directors, partners and proprietors (#6)
Browse files Browse the repository at this point in the history
* set up basic dashboard template and UI for address accordion

* update AddressAccordion

* update i18n text

* set up current directors accordion

* Side accordions for directors, partners, and proprietors

* fix AddressDisplay unit test

* cypress tests

---------

Co-authored-by: Patrick Wang <root@NI502169.idir.BCGOV>
  • Loading branch information
patrickpeinanw and Patrick Wang authored Jun 24, 2024
1 parent 96a5422 commit 7475402
Show file tree
Hide file tree
Showing 33 changed files with 1,117 additions and 37 deletions.
2 changes: 2 additions & 0 deletions cypress/e2e/accessibility/business-dash.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ context('Accessibility -> Business Dashboard', () => {
})

it('check page passes accessibility after initial page load', () => {
cy.getOfficeAddresses()
cy.getDirectorParties()
cy.get('[data-cy="business-dashboard"]').should('exist')
cy.checkA11y('[data-cy="business-dashboard"]')
})
Expand Down
38 changes: 38 additions & 0 deletions cypress/e2e/components/addresses.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
context('Business dashboard -> Address side component', () => {
beforeEach(() => {
cy.visitBusinessDash()
})

it('Address accordion is rendered for Registered Office and Record Office', () => {
cy.getOfficeAddresses()

// the accordion exists
cy.get('[data-cy="accordion_officeAddresses"]').should('exist')

// accordion headers exist
cy.get('[data-cy="accordion_item_button_officeAddresses0"]').contains('Registered Office').should('be.visible')
cy.get('[data-cy="accordion_item_button_officeAddresses1"]').contains('Records Office').should('be.visible')

// the first accordion item is expanded by default and it contain address information
cy.get('[data-cy="officeAddresses_0"]').contains('Delivery Address').should('be.visible')
cy.get('[data-cy="officeAddresses_0"]').contains('Mailing Address').should('be.visible')
cy.get('[data-cy="officeAddresses_1"]').contains('Delivery Address').should('not.be.visible')
cy.get('[data-cy="officeAddresses_1"]').contains('Mailing Address').should('not.be.visible')

// expand the second item
cy.get('[data-cy="accordion_item_button_officeAddresses1"]').click()

// Note: the current config allow only one item to be expanded
// This is different from the behavior of the old dashboard.
cy.get('[data-cy="officeAddresses_0"]').contains('Delivery Address').should('not.be.visible')
cy.get('[data-cy="officeAddresses_0"]').contains('Mailing Address').should('not.be.visible')
cy.get('[data-cy="officeAddresses_1"]').contains('Delivery Address').should('be.visible')
cy.get('[data-cy="officeAddresses_1"]').contains('Mailing Address').should('be.visible')
})

it('Business Addresses section is rendered for SP and GP', () => {
cy.getBusinessAddresses()
cy.get('[data-cy="accordion_officeAddresses"]').should('not.exist')
cy.get('[data-cy="businessAddresses"]').should('exist')
})
})
23 changes: 23 additions & 0 deletions cypress/e2e/components/parties.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
context('Business dashboard -> Parties side components', () => {
beforeEach(() => {
cy.visitBusinessDash()
})

it('Directors accordion is rendered', () => {
cy.getDirectorParties()
cy.get('[data-cy="accordion_directors"]').should('exist')
cy.get('[data-cy="accordion_directors"]').children().eq(0).children().should('have.length', 5)
})

it('Partners accordion is rendered', () => {
cy.getPartnerParties()
cy.get('[data-cy="accordion_partners"]').should('exist')
cy.get('[data-cy="accordion_partners"]').children().eq(0).children().should('have.length', 3)
})

it('Proprietors accordion is rendered', () => {
cy.getProprietorParties()
cy.get('[data-cy="accordion_proprietors"]').should('exist')
cy.get('[data-cy="accordion_proprietors"]').children().eq(0).children().should('have.length', 1)
})
})
50 changes: 50 additions & 0 deletions cypress/fixtures/address.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"recordsOffice": {
"deliveryAddress": {
"addressCity": "Vancouver",
"addressCountry": "CA",
"addressRegion": "BC",
"addressType": "delivery",
"deliveryInstructions": "",
"id": 2716699,
"postalCode": "V6J 5L2",
"streetAddress": "201-1768 8th Ave W",
"streetAddressAdditional": ""
},
"mailingAddress": {
"addressCity": "Vancouver",
"addressCountry": "CA",
"addressRegion": "BC",
"addressType": "mailing",
"deliveryInstructions": "",
"id": 2716698,
"postalCode": "V6J 5L2",
"streetAddress": "201-1768 8th Ave W",
"streetAddressAdditional": ""
}
},
"registeredOffice": {
"deliveryAddress": {
"addressCity": "Vancouver",
"addressCountry": "CA",
"addressRegion": "BC",
"addressType": "delivery",
"deliveryInstructions": "",
"id": 2716701,
"postalCode": "V6J 5L2",
"streetAddress": "201-1768 8th Ave W",
"streetAddressAdditional": ""
},
"mailingAddress": {
"addressCity": "Vancouver",
"addressCountry": "CA",
"addressRegion": "BC",
"addressType": "mailing",
"deliveryInstructions": "",
"id": 2716700,
"postalCode": "V6J 5L2",
"streetAddress": "201-1768 8th Ave W",
"streetAddressAdditional": ""
}
}
}
26 changes: 26 additions & 0 deletions cypress/fixtures/addressSFandGF.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"businessOffice": {
"deliveryAddress": {
"addressCity": "Prince Rupert",
"addressCountry": "CA",
"addressRegion": "BC",
"addressType": "delivery",
"deliveryInstructions": null,
"id": 2776826,
"postalCode": "V8J 4C5",
"streetAddress": "153 Alpine Dr",
"streetAddressAdditional": ""
},
"mailingAddress": {
"addressCity": "Prince Rupert",
"addressCountry": "CA",
"addressRegion": "BC",
"addressType": "mailing",
"deliveryInstructions": null,
"id": 2776825,
"postalCode": "V8J 4C5",
"streetAddress": "153 Alpine Dr",
"streetAddressAdditional": ""
}
}
}
184 changes: 184 additions & 0 deletions cypress/fixtures/directorParties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
{
"parties": [
{
"deliveryAddress": {
"addressCity": "Oakville",
"addressCountry": "CA",
"addressRegion": "ON",
"deliveryInstructions": "",
"id": 2841040,
"postalCode": "L6M 4M6",
"streetAddress": "23-1489 Heritage Way",
"streetAddressAdditional": ""
},
"mailingAddress": {
"addressCity": "Oakville",
"addressCountry": "CA",
"addressRegion": "ON",
"deliveryInstructions": "",
"id": 2841041,
"postalCode": "L6M 4M6",
"streetAddress": "23-1489 Heritage Way",
"streetAddressAdditional": ""
},
"officer": {
"email": null,
"firstName": "SD",
"id": 578627,
"lastName": "S",
"partyType": "person"
},
"roles": [
{
"appointmentDate": "2024-04-02",
"cessationDate": null,
"roleType": "Director"
}
]
},
{
"deliveryAddress": {
"addressCity": "Oakville",
"addressCountry": "CA",
"addressRegion": "ON",
"deliveryInstructions": null,
"id": 2841026,
"postalCode": "L6M 4M6",
"streetAddress": "34-1489 Heritage Way",
"streetAddressAdditional": ""
},
"mailingAddress": {
"addressCity": "Oakville",
"addressCountry": "CA",
"addressRegion": "ON",
"deliveryInstructions": null,
"id": 2841027,
"postalCode": "L6M 4M6",
"streetAddress": "34-1489 Heritage Way",
"streetAddressAdditional": ""
},
"officer": {
"email": null,
"firstName": "SDF",
"id": 581750,
"lastName": "ASDF",
"partyType": "person"
},
"roles": [
{
"appointmentDate": "2024-04-02",
"cessationDate": null,
"roleType": "Director"
}
]
},
{
"deliveryAddress": {
"addressCity": "Oakville",
"addressCountry": "CA",
"addressRegion": "ON",
"deliveryInstructions": "",
"id": 2841036,
"postalCode": "L6M 4M6",
"streetAddress": "34-1489 Heritage Way",
"streetAddressAdditional": ""
},
"mailingAddress": {
"addressCity": "Oakville",
"addressCountry": "CA",
"addressRegion": "ON",
"deliveryInstructions": "",
"id": 2841037,
"postalCode": "L6M 4M6",
"streetAddress": "34-1489 Heritage Way",
"streetAddressAdditional": ""
},
"officer": {
"email": null,
"firstName": "KIAL",
"id": 581751,
"lastName": "TEST",
"partyType": "person"
},
"roles": [
{
"appointmentDate": "2024-04-02",
"cessationDate": null,
"roleType": "Director"
}
]
},
{
"deliveryAddress": {
"addressCity": "Edmonton",
"addressCountry": "CA",
"addressRegion": "AB",
"deliveryInstructions": null,
"id": 2841030,
"postalCode": "T6L 7G9",
"streetAddress": "324-5211 25 Ave NW",
"streetAddressAdditional": ""
},
"mailingAddress": {
"addressCity": "Edmonton",
"addressCountry": "CA",
"addressRegion": "AB",
"deliveryInstructions": null,
"id": 2841031,
"postalCode": "T6L 7G9",
"streetAddress": "324-5211 25 Ave NW",
"streetAddressAdditional": ""
},
"officer": {
"email": null,
"firstName": "SD",
"id": 581752,
"lastName": "S",
"partyType": "person"
},
"roles": [
{
"appointmentDate": "2024-04-02",
"cessationDate": null,
"roleType": "Director"
}
]
},
{
"deliveryAddress": {
"addressCity": "Pitt Meadows",
"addressCountry": "CA",
"addressRegion": "BC",
"deliveryInstructions": null,
"id": 2841034,
"postalCode": "V3Y 1T2",
"streetAddress": "34-19032 Advent Rd",
"streetAddressAdditional": ""
},
"mailingAddress": {
"addressCity": "Pitt Meadows",
"addressCountry": "CA",
"addressRegion": "BC",
"deliveryInstructions": null,
"id": 2841035,
"postalCode": "V3Y 1T2",
"streetAddress": "34-19032 Advent Rd",
"streetAddressAdditional": ""
},
"officer": {
"email": null,
"firstName": "DF",
"id": 581753,
"lastName": "ADF",
"partyType": "person"
},
"roles": [
{
"appointmentDate": "2024-04-02",
"cessationDate": null,
"roleType": "Director"
}
]
}
]
}
Loading

0 comments on commit 7475402

Please sign in to comment.