Skip to content

Commit df50478

Browse files
authored
Merge branch 'develop' into feat/hamed-charging-site-status-override-3793
2 parents 9e6038e + 83535d3 commit df50478

File tree

11 files changed

+114
-21
lines changed

11 files changed

+114
-21
lines changed

backend/lcfs/tests/final_supply_equipment/test_final_supply_equipment_repo.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,42 @@ async def test_check_overlap_within_current_report_only(repo, fake_db):
411411
assert result is True # Should detect overlap within current report
412412

413413

414+
@pytest.mark.anyio
415+
async def test_check_overlap_different_charging_site_not_blocked(repo, fake_db):
416+
"""
417+
Test that same serial number at a different Charging site (different postal_code/lat/lon)
418+
does not trigger an overlap — the query must scope to the same location.
419+
The mock returns False, simulating no match found when location differs.
420+
"""
421+
from lcfs.web.api.final_supply_equipment.schema import (
422+
FinalSupplyEquipmentCreateSchema,
423+
)
424+
from datetime import date
425+
426+
fse_record = FinalSupplyEquipmentCreateSchema(
427+
compliance_report_id=400,
428+
supply_from_date=date(2024, 1, 1),
429+
supply_to_date=date(2024, 12, 31),
430+
serial_nbr="RELOCATED_SERIAL",
431+
postal_code="V8V 1V1", # different site
432+
latitude=48.425,
433+
longitude=-123.365,
434+
manufacturer="Test Manufacturer",
435+
level_of_equipment="Level 2",
436+
intended_use_types=["Public charging"],
437+
intended_user_types=["Test"],
438+
street_address="789 New Site Rd",
439+
city="Victoria",
440+
organization_name="Test Org",
441+
)
442+
443+
# Simulate no overlap found because location conditions filter it out
444+
fake_db.execute.return_value = FakeResult([False])
445+
446+
result = await repo.check_overlap_of_fse_row(fse_record)
447+
assert result is False # Different Charging site — should not be blocked
448+
449+
414450
@pytest.mark.anyio
415451
async def test_get_fse_reporting_list_paginated(repo, fake_db):
416452
"""Test getting paginated FSE reporting list"""

backend/lcfs/web/api/final_supply_equipment/repo.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,9 @@ async def check_overlap_of_fse_row(
494494
FinalSupplyEquipment.supply_to_date >= row.supply_from_date,
495495
),
496496
FinalSupplyEquipment.serial_nbr == row.serial_nbr,
497+
FinalSupplyEquipment.postal_code == row.postal_code,
498+
FinalSupplyEquipment.latitude == row.latitude,
499+
FinalSupplyEquipment.longitude == row.longitude,
497500
]
498501

499502
if row.final_supply_equipment_id is not None:

backend/lcfs/web/api/final_supply_equipment/validation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async def check_equipment_uniqueness_and_overlap(
4848
is_overlapping = await self.fse_repo.check_overlap_of_fse_row(data)
4949
if is_overlapping:
5050
raise ValueError(
51-
f"Date range overlap found for equipment with serial number {data.serial_nbr} at the same or different location."
51+
f"Date range overlap found for equipment with serial number {data.serial_nbr} at the same Charging site."
5252
)
5353

5454
return True # If no duplicates or overlaps found

frontend/cypress/e2e/accessibility.cy.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('Accessibility Tests for LCFS', () => {
2121
Cypress.env('ADMIN_IDIR_USERNAME'),
2222
Cypress.env('ADMIN_IDIR_PASSWORD')
2323
)
24-
cy.wait(5000)
24+
cy.get('.main-layout-navbar', { timeout: 30000 }).should('be.visible')
2525
cy.injectAxe() // Injects the axe-core library
2626
cy.checkA11y(null, null, terminalLog)
2727
})
@@ -36,9 +36,8 @@ describe('Accessibility Tests for LCFS', () => {
3636
Cypress.env('ADMIN_IDIR_USERNAME'),
3737
Cypress.env('ADMIN_IDIR_PASSWORD')
3838
)
39-
cy.wait(5000)
39+
cy.getByDataTest('bc-navbar', { timeout: 30000 }).should('be.visible')
4040
cy.injectAxe() // Injects the axe-core library
41-
cy.getByDataTest('bc-navbar').should('exist')
4241
cy.getByDataTest('bc-navbar').within(() => {
4342
cy.checkA11y(null, null, terminalLog)
4443
})

frontend/cypress/e2e/admin.cy.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,12 @@ describe('Admin view happy paths', () => {
3131
]
3232

3333
cy.visit('/admin/users', { timeout: 30000 })
34+
cy.getByDataTest('bc-grid-container', { timeout: 30000 }).should('exist')
3435

3536
tabs.forEach(({ label, path, panelIndex }) => {
36-
cy.contains('[role="tab"]', label, { timeout: 10000 }).click()
37+
cy.contains('[role="tab"]', label, { timeout: 10000 })
38+
.should('be.visible')
39+
.click()
3740
cy.location('pathname', { timeout: 30000 }).should('eq', path)
3841
cy.get(
3942
`#full-width-AdminTabPanel-${panelIndex} [data-test="bc-grid-container"]`,

frontend/cypress/e2e/charging_equipment_and_fse_reporting.cy.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,12 @@ describe('ChargingEquipment create/edit/list filters/download', () => {
214214
cy.wait(['@orgNames', '@equipmentList'])
215215

216216
cy.contains('.filter-toolbar', 'Show FSE for:', { timeout: 30000 })
217+
.should('be.visible')
217218
.find('input')
218219
.first()
220+
.should('be.visible')
219221
.type('LCFS Org 2')
220-
cy.contains('li', 'LCFS Org 2', { timeout: 30000 }).click()
222+
cy.contains('li', 'LCFS Org 2', { timeout: 30000 }).should('be.visible').click()
221223
cy.wait('@equipmentListFiltered').its('request.body.organization_id').should('eq', 1002)
222224

223225
cy.getByDataTest('download-fse-excel', { timeout: 30000 }).click()
@@ -357,10 +359,12 @@ describe('FSE Reporting grid interactions + save flow', () => {
357359
'be.visible'
358360
)
359361

360-
cy.get('#site-selector input', { timeout: 30000 }).type(
361-
'Cypress Charging Site'
362-
)
363-
cy.contains('li', 'Cypress Charging Site', { timeout: 30000 }).click()
362+
cy.get('#site-selector input', { timeout: 30000 })
363+
.should('be.visible')
364+
.type('Cypress Charging Site')
365+
cy.contains('li', 'Cypress Charging Site', { timeout: 30000 })
366+
.should('be.visible')
367+
.click()
364368
cy.wait('@fseReportingListFiltered')
365369

366370
cy.contains('.ag-row', 'REG-8001', { timeout: 30000 })

frontend/cypress/e2e/charging_sites_fse_workflows.cy.js

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -396,19 +396,30 @@ describe('Charging Site and FSE supplier workflows', () => {
396396
cy.visit('/compliance-reporting/fse', { timeout: 30000 })
397397
cy.wait('@chargingEquipmentList')
398398

399-
cy.contains('button', 'Select all Draft/Updated', { timeout: 30000 }).click()
400-
cy.contains('button', 'Submit selected').click()
399+
cy.contains('button', 'Select all Draft/Updated', { timeout: 30000 })
400+
.should('be.visible')
401+
.click()
402+
cy.contains('button', 'Submit selected', { timeout: 30000 })
403+
.should('be.visible')
404+
.click()
405+
// Click the confirmation button in the modal
401406
cy.contains('button', 'Submit selected', { timeout: 30000 }).last().click()
402407
cy.wait('@bulkSubmit')
403-
cy.getByDataTest('alert-box').should('contain', 'submitted')
408+
cy.getByDataTest('alert-box', { timeout: 30000 }).should('contain', 'submitted')
404409

405-
cy.contains('button', 'Select all Validated', { timeout: 30000 }).click()
406-
cy.contains('button', 'Set to Decommissioned').first().click()
410+
cy.contains('button', 'Select all Validated', { timeout: 30000 })
411+
.should('be.visible')
412+
.click()
413+
cy.contains('button', 'Set to Decommissioned', { timeout: 30000 })
414+
.should('be.visible')
415+
.first()
416+
.click()
417+
// Click the confirmation button in the modal
407418
cy.contains('button', 'Set to Decommissioned', { timeout: 30000 })
408419
.last()
409420
.click()
410421
cy.wait('@bulkDecommission')
411-
cy.getByDataTest('alert-box').should('contain', 'decommissioned')
422+
cy.getByDataTest('alert-box', { timeout: 30000 }).should('contain', 'decommissioned')
412423
})
413424
})
414425

@@ -499,13 +510,18 @@ describe('FSE processing and map workflows (IDIR)', () => {
499510
cy.contains('h5, h6', 'Charging site/FSE processing', {
500511
timeout: 30000
501512
}).should('be.visible')
502-
cy.contains('button', 'Select all submitted').click()
503-
cy.contains('button', 'Set selected as validated').click()
513+
cy.contains('button', 'Select all submitted', { timeout: 30000 })
514+
.should('be.visible')
515+
.click()
516+
cy.contains('button', 'Set selected as validated', { timeout: 30000 })
517+
.should('be.visible')
518+
.click()
519+
// Click the confirmation button in the modal
504520
cy.contains('button', 'Validate Equipment', { timeout: 30000 })
505521
.last()
506522
.click()
507523
cy.wait('@bulkValidate')
508-
cy.getByDataTest('alert-box').should('contain', 'Validated')
524+
cy.getByDataTest('alert-box', { timeout: 30000 }).should('contain', 'Validated')
509525
})
510526

511527
it('renders the FSE map view and supports interactions', () => {

frontend/cypress/e2e/dashboard.cy.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ describe('Dashboard view coverage', () => {
1717
cy.getByDataTest('dashboard-admin-links-card', {
1818
timeout: 30000
1919
}).should('be.visible')
20-
cy.getByDataTest('admin-link-admin-users').click()
20+
cy.getByDataTest('admin-link-admin-users', { timeout: 30000 })
21+
.should('be.visible')
22+
.click()
2123
cy.location('pathname', { timeout: 30000 }).should('eq', '/admin/users')
2224
})
2325

frontend/cypress/e2e/notifications.cy.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ describe('Notifications view flows', () => {
6565
cy.getByDataTest('select-all').click()
6666
cy.getByDataTest('select-all').click()
6767

68+
// Note: data-test="mark-as-unread" is actually the delete button
6869
cy.getByDataTest('mark-as-unread').should('not.be.disabled').click()
6970
cy.wait('@deleteNotifications')
7071
.its('request.body')

frontend/package-lock.json

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)