From 09932a676d5637b3e51f01a3ed83a576e9ab0ac3 Mon Sep 17 00:00:00 2001 From: Paul Regan Date: Thu, 6 Feb 2025 11:06:21 -0500 Subject: [PATCH 1/9] return GUI data for selected endpoint and not just the first one in the list --- src-electron/rest/user-data.js | 3 ++- src/util/editable-attributes-mixin.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src-electron/rest/user-data.js b/src-electron/rest/user-data.js index 6e5978a9ae..ee567e6dca 100644 --- a/src-electron/rest/user-data.js +++ b/src-electron/rest/user-data.js @@ -389,6 +389,7 @@ function httpPostAttributeUpdate(db) { let { action, endpointTypeIdList, + selectedEndpoint, id, value, listType, @@ -438,7 +439,7 @@ function httpPostAttributeUpdate(db) { // send latest value to frontend to update UI let eptAttr = await queryZcl.selectEndpointTypeAttribute( db, - endpointTypeIdList[0], + selectedEndpoint, id, clusterRef ) diff --git a/src/util/editable-attributes-mixin.js b/src/util/editable-attributes-mixin.js index 5cfbb62501..b6c374d171 100644 --- a/src/util/editable-attributes-mixin.js +++ b/src/util/editable-attributes-mixin.js @@ -213,6 +213,7 @@ export default { let editContext = { action: 'boolean', endpointTypeIdList: this.endpointTypeIdList, + selectedEndpoint: this.selectedEndpointTypeId, id: attributeData.id, value: addedValue, listType: listType, From 98ef23a1785a543aceee54cc4631866f8bda7da7 Mon Sep 17 00:00:00 2001 From: Paul Regan Date: Thu, 6 Feb 2025 11:16:16 -0500 Subject: [PATCH 2/9] remove await because it was not the root cause fix --- src/util/editable-attributes-mixin.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/editable-attributes-mixin.js b/src/util/editable-attributes-mixin.js index b6c374d171..e657a31d9f 100644 --- a/src/util/editable-attributes-mixin.js +++ b/src/util/editable-attributes-mixin.js @@ -191,7 +191,7 @@ export default { } this.$store.dispatch('zap/updateSelectedAttribute', editContext) }, - async toggleAttributeSelection(list, listType, attributeData, clusterId) { + toggleAttributeSelection(list, listType, attributeData, clusterId) { // We determine the ID that we need to toggle within the list. // This ID comes from hashing the base ZCL attribute and cluster data. let indexOfValue = list.indexOf( @@ -223,7 +223,7 @@ export default { reportMaxInterval: attributeData.reportMaxInterval } // Wait for the first dispatch to complete - await this.$store.dispatch('zap/updateSelectedAttribute', editContext) + this.$store.dispatch('zap/updateSelectedAttribute', editContext) if ( addedValue && @@ -231,7 +231,7 @@ export default { attributeData.isReportable ) { editContext.listType = 'selectedReporting' - await this.$store.dispatch('zap/updateSelectedAttribute', editContext) + this.$store.dispatch('zap/updateSelectedAttribute', editContext) } }, From b6fbd78c09e12571f909b77b7c7aa9385f1e9c61 Mon Sep 17 00:00:00 2001 From: Paul Regan Date: Thu, 6 Feb 2025 13:21:45 -0500 Subject: [PATCH 3/9] fix validating endpoint too --- src-electron/rest/user-data.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-electron/rest/user-data.js b/src-electron/rest/user-data.js index ee567e6dca..f01f2e5284 100644 --- a/src-electron/rest/user-data.js +++ b/src-electron/rest/user-data.js @@ -449,7 +449,7 @@ function httpPostAttributeUpdate(db) { // endpointTypeId doesn't matter since all attributes are the seame. let validationData = await validation.validateAttribute( db, - endpointTypeIdList[0], + selectedEndpoint, id, clusterRef, request.zapSessionId From fde272a1f352300cb995bccffc7b7331850c8ad8 Mon Sep 17 00:00:00 2001 From: Paul Regan Date: Thu, 6 Feb 2025 14:02:29 -0500 Subject: [PATCH 4/9] fixing other instances where this method is called --- src-electron/rest/user-data.js | 2 -- src-electron/validation/validation.js | 1 + src/util/editable-attributes-mixin.js | 2 ++ 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src-electron/rest/user-data.js b/src-electron/rest/user-data.js index f01f2e5284..cb23702431 100644 --- a/src-electron/rest/user-data.js +++ b/src-electron/rest/user-data.js @@ -399,7 +399,6 @@ function httpPostAttributeUpdate(db) { reportMaxInterval, reportableChange } = request.body - if (!Array.isArray(endpointTypeIdList) || !endpointTypeIdList.length) { return response.status(StatusCodes.BAD_REQUEST).json() } @@ -435,7 +434,6 @@ function httpPostAttributeUpdate(db) { ) ) ) - // send latest value to frontend to update UI let eptAttr = await queryZcl.selectEndpointTypeAttribute( db, diff --git a/src-electron/validation/validation.js b/src-electron/validation/validation.js index 015501470f..1a8f30960a 100644 --- a/src-electron/validation/validation.js +++ b/src-electron/validation/validation.js @@ -46,6 +46,7 @@ async function validateAttribute( clusterRef, zapSessionId ) { + console.log(endpointTypeId) let endpointAttribute = await queryZcl.selectEndpointTypeAttribute( db, endpointTypeId, diff --git a/src/util/editable-attributes-mixin.js b/src/util/editable-attributes-mixin.js index e657a31d9f..3cc7b16343 100644 --- a/src/util/editable-attributes-mixin.js +++ b/src/util/editable-attributes-mixin.js @@ -132,6 +132,7 @@ export default { let editContext = { action: 'boolean', endpointTypeIdList: this.endpointTypeIdList, + selectedEndpoint: this.selectedEndpointTypeId, id: attributeData.id, value: enable, listType: listType, @@ -181,6 +182,7 @@ export default { let editContext = { action: 'text', endpointTypeIdList: this.endpointTypeIdList, + selectedEndpoint: this.selectedEndpointTypeId, id: attributeData.id, value: newValue, listType: listType, From f1f8ab54b7578af199f6ccb47a364e933ce220e2 Mon Sep 17 00:00:00 2001 From: Paul Regan Date: Thu, 6 Feb 2025 14:04:55 -0500 Subject: [PATCH 5/9] cleanup --- src-electron/validation/validation.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src-electron/validation/validation.js b/src-electron/validation/validation.js index 1a8f30960a..015501470f 100644 --- a/src-electron/validation/validation.js +++ b/src-electron/validation/validation.js @@ -46,7 +46,6 @@ async function validateAttribute( clusterRef, zapSessionId ) { - console.log(endpointTypeId) let endpointAttribute = await queryZcl.selectEndpointTypeAttribute( db, endpointTypeId, From 120da8f664d851d1d7d75dea0d881980af02fd2d Mon Sep 17 00:00:00 2001 From: Paul Regan Date: Wed, 12 Feb 2025 16:47:35 -0500 Subject: [PATCH 6/9] add cypress test --- .../e2e/attribute_validations/reporting.cy.js | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 cypress/e2e/attribute_validations/reporting.cy.js diff --git a/cypress/e2e/attribute_validations/reporting.cy.js b/cypress/e2e/attribute_validations/reporting.cy.js new file mode 100644 index 0000000000..67649fc587 --- /dev/null +++ b/cypress/e2e/attribute_validations/reporting.cy.js @@ -0,0 +1,44 @@ +/// + +Cypress.on('uncaught:exception', (err, runnable) => { + // returning false here prevents Cypress from + // failing the test + return false +}) + +describe('Add multiple clusters and search', () => { + it('create two endpoints and validate basic information', () => { + cy.fixture('baseurl').then((data) => { + cy.visit(data.baseurl) + }) + cy.setZclProperties() + + // Create and validate the first endpoint + cy.fixture('data').then((data) => { + cy.addEndpoint(data.endpoint4, data.cluster1) + }) + cy.get('.flex > strong').should('contain', '#1') + + // Select the "Power Configuration" cluster for the second endpoint + cy.fixture('data').then((data) => { + cy.gotoAttributePage(data.endpoint1, data.cluster1) + cy.contains('.q-item__section .q-item__label', 'General', { + timeout: 10000 + }) + .should('be.visible') + .click() + }) + + // Check the "Attribute Reporting" tab for the second endpoint + cy.fixture('data').then((data) => { + cy.contains('.q-tab__content .q-tab__label', 'Attribute Reporting', { + timeout: 10000 + }) + .should('be.visible') + .click() + }) + cy.get( + '.q-virtual-scroll__content > :nth-child(1) > :nth-child(2) > .q-toggle > .q-toggle__inner > .q-toggle__thumb' + ).click() + }) +}) From cecbae0317dd416a2bcd3862e75a86bc06fb772b Mon Sep 17 00:00:00 2001 From: Paul Regan Date: Wed, 12 Feb 2025 16:50:51 -0500 Subject: [PATCH 7/9] make sure still visible --- cypress/e2e/attribute_validations/reporting.cy.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cypress/e2e/attribute_validations/reporting.cy.js b/cypress/e2e/attribute_validations/reporting.cy.js index 67649fc587..822437b07e 100644 --- a/cypress/e2e/attribute_validations/reporting.cy.js +++ b/cypress/e2e/attribute_validations/reporting.cy.js @@ -40,5 +40,9 @@ describe('Add multiple clusters and search', () => { cy.get( '.q-virtual-scroll__content > :nth-child(1) > :nth-child(2) > .q-toggle > .q-toggle__inner > .q-toggle__thumb' ).click() + // Check to make sure the button is still visible after clicking + cy.get( + '.q-virtual-scroll__content > :nth-child(1) > :nth-child(2) > .q-toggle > .q-toggle__inner > .q-toggle__thumb' + ).should('be.visible') }) }) From b3174e1207aac7050cc3cd49aafc1f154ace54e1 Mon Sep 17 00:00:00 2001 From: Paul Regan Date: Fri, 14 Feb 2025 11:38:21 -0500 Subject: [PATCH 8/9] handle test that is specific to zigbee --- .../e2e/attribute_validations/reporting.cy.js | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/cypress/e2e/attribute_validations/reporting.cy.js b/cypress/e2e/attribute_validations/reporting.cy.js index 822437b07e..00b3bbb0b8 100644 --- a/cypress/e2e/attribute_validations/reporting.cy.js +++ b/cypress/e2e/attribute_validations/reporting.cy.js @@ -1,13 +1,33 @@ /// Cypress.on('uncaught:exception', (err, runnable) => { - // returning false here prevents Cypress from - // failing the test + // returning false here prevents Cypress from failing the test return false }) describe('Add multiple clusters and search', () => { - it('create two endpoints and validate basic information', () => { + // This will hold the fixture data and the flag for skipping the tests + let skipTest = false + + before(function () { + // Load the fixture data before running any tests + cy.fixture('data').then((data) => { + this.data = data + // If mode is "matter", set skipTest flag to true + if (this.data.mode === 'matter') { + skipTest = true + } + }) + }) + + it('create two endpoints and validate basic information', function () { + // Skip the test if the flag is true (mode is "matter") + if (skipTest) { + cy.log('Skipping test because mode is "matter"') + return // Skip the test if mode is 'matter' + } + + // Continue with the test if the mode is not "matter" cy.fixture('baseurl').then((data) => { cy.visit(data.baseurl) }) From 3eda6eb3db3412052c5f8fb492c068526cfbc497 Mon Sep 17 00:00:00 2001 From: Paul Regan Date: Fri, 14 Feb 2025 15:48:11 -0500 Subject: [PATCH 9/9] change to skip if not zigbee in case other protocols are added --- cypress/e2e/attribute_validations/reporting.cy.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/attribute_validations/reporting.cy.js b/cypress/e2e/attribute_validations/reporting.cy.js index 00b3bbb0b8..181d872377 100644 --- a/cypress/e2e/attribute_validations/reporting.cy.js +++ b/cypress/e2e/attribute_validations/reporting.cy.js @@ -14,7 +14,7 @@ describe('Add multiple clusters and search', () => { cy.fixture('data').then((data) => { this.data = data // If mode is "matter", set skipTest flag to true - if (this.data.mode === 'matter') { + if (this.data.mode !== 'zigbee') { skipTest = true } }) @@ -23,7 +23,7 @@ describe('Add multiple clusters and search', () => { it('create two endpoints and validate basic information', function () { // Skip the test if the flag is true (mode is "matter") if (skipTest) { - cy.log('Skipping test because mode is "matter"') + cy.log('Skipping test because mode is not "zigbee"') return // Skip the test if mode is 'matter' }