Skip to content
代码片段 群组 项目
未验证 提交 5e9ec21f 编辑于 作者: Sahar Kargar's avatar Sahar Kargar 提交者: GitHub
浏览文件

Fix enabled clusters test file (#636)

* fix enabled clusters test file

* adding ci for cypress against matter data

* updating cypress.json
上级 d885f0df
No related branches found
No related tags found
无相关合并请求
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Cypress UI tests against matter data
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [16.x]
os: [ubuntu-latest, ubuntu-18.04]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: sudo ./src-script/install-packages-ubuntu
- run: sudo apt-get install --fix-missing xvfb
- run: npm ci
- run: npm run version-stamp
- run: npm rebuild canvas --update-binary
- run: npm rebuild libxmljs --update-binary
- run: npm run build-spa
- run: xvfb-run -a npm run test:e2e-matter-ci
......@@ -6,6 +6,8 @@
"**/file_open.spec.js",
"**/*.test.js",
"**/*.xml",
"**/*.zap"
"**/*.zap",
"**/custom_xml.spec.js",
"**/check-cluster-attributes-singleton-in-zigbee-mode.spec.js"
]
}
......@@ -22,7 +22,7 @@ describe('Testing BITMAP type validation', () => {
cy.fixture('data').then((data) => {
if (data.endpoint1 === 'Matter Bridge (0x000E)') {
cy.get(
'#qvs_61 > :nth-child(6) > :nth-child(2) > .q-mt-xs > .q-toggle__inner'
'[data-cy=Attributes] > .q-table__middle > .q-table > .q-virtual-scroll__content > :nth-child(6) > :nth-child(2) > .q-mt-xs > .q-toggle__inner'
).click({ force: true })
}
cy.get(
......
/// <reference types="cypress" />
Cypress.on('uncaught:exception', (err, runnable) => {
// returning false here prevents Cypress from
// failing the test
return false
})
describe('Testing BITMAP8 type validation', () => {
it('create a new endpoint and click on configure to open attributes of endpoint', () => {
cy.fixture('baseurl').then((data) => {
cy.visit(data.baseurl)
})
cy.gotoAttributePage('Billing Unit (0x0203)', 'General')
})
it(
'getting an attribute with BITMAP8 type and change default amount',
{ retries: { runMode: 2, openMode: 2 } },
() => {
cy.get(
':nth-child(16) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > input'
)
.clear({ force: true })
.type('test', { force: true })
}
)
it('check if validation works properly', () => {
cy.get(
':nth-child(16) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__bottom > .q-field__messages > div'
).should('exist')
})
})
/// <reference types="cypress" />
Cypress.on('uncaught:exception', (err, runnable) => {
// returning false here prevents Cypress from
// failing the test
return false
})
describe('Testing attribute validation', () => {
it('create a new endpoint and click on configure to open attributes of endpoint', () => {
cy.fixture('baseurl').then((data) => {
cy.visit(data.baseurl)
})
cy.fixture('data').then((data) => {
cy.gotoAttributePage(data.endpoint1, data.cluster1)
})
})
it(
'change default input to a wrong amount',
{ retries: { runMode: 2, openMode: 2 } },
() => {
cy.fixture('data').then((data) => {
cy.get(
':nth-child(1) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > input'
)
.clear({ force: true })
.type(data.outOfRangeAmount1, { force: true })
.then(() => {
cy.get('.table_body:first > [style="min-width: 180px;"]').should(
'contain',
'Out of range'
)
})
})
}
)
it(
'change default input to a correct amount',
{ retries: { runMode: 2, openMode: 2 } },
() => {
cy.get(
':nth-child(1) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > input'
)
.clear({ force: true })
.type('111', { force: true })
cy.get(
'[style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__bottom > .q-field__messages > div'
).should('not.exist')
}
)
})
......@@ -8,7 +8,7 @@ Cypress.on('uncaught:exception', (err, runnable) => {
describe('Testing enabled clusters amount', () => {
it(
'create a new endpoint and enable a clusters',
'create a new endpoint and get amount of enabled clusters',
{ retries: { runMode: 2, openMode: 2 } },
() => {
cy.fixture('baseurl').then((data) => {
......@@ -21,22 +21,19 @@ describe('Testing enabled clusters amount', () => {
const num1 = parseFloat($div.text())
cy.fixture('data').then((data) => {
cy.get('.q-page-container > div')
.children()
.should('contain', data.cluster1)
})
cy.get('div').contains('General').click({ force: true })
cy.get('div')
.children()
.contains('Server')
.its('length')
.then((res) => {
if (res > 0) {
cy.get('div').children().contains('Not Enabled').first().click()
cy.get('.q-virtual-scroll__content > :nth-child(3)')
.contains('Server')
.click()
}
})
.should('contain', data.cluster1)
})
cy.get('div').contains('General').click({force: true})
cy.get('div').children().contains('Server').its('length').then(res=>{
if(res > 0){
cy.get('div').children().contains('Not Enabled').first().click()
cy.get('.q-virtual-scroll__content > :nth-child(3)')
.contains('Server')
.click()
}
});
})
}
)
......@@ -50,6 +47,7 @@ describe('Testing enabled clusters amount', () => {
expect(num2).to.eq(Number(data.availableClusters1))
})
})
}
)
})
})
\ No newline at end of file
......@@ -32,6 +32,8 @@
"test:unit:watchAll": "jest --watchAll",
"test:e2e": "node src-script/zap-uitest.js open",
"test:e2e-ci": "node src-script/zap-uitest.js run",
"test:e2e-matter": "node src-script/zap-uitestmatter.js open",
"test:e2e-matter-ci": "node src-script/zap-uitestmatter.js run",
"report": "node src-script/zap-combine-reports.js",
"postinstall": "electron-builder install-app-deps && husky install && npm rebuild canvas --update-binary && npm run version-stamp",
"buildAndPack:win": "npm run build && npm run pack:win",
......@@ -59,6 +61,7 @@
"zaphelp": "node src-script/zap-start.js --help",
"zap-dotdot": "node src-script/zap-start.js --logToStdout --zcl ./zcl-builtin/dotdot/library.xml",
"zap-devserver": "node src-script/zap-start.js server --allowCors --logToStdout --gen ./test/gen-template/zigbee/gen-templates.json --reuseZapInstance",
"matterzap-devserver": "node src-script/zap-start.js server --allowCors ---logToStdout --zcl ./zcl-builtin/matter/zcl.json --gen ./test/resource/meta/gen-test.json --reuseZapInstance",
"server": "node src-script/zap-start.js server --logToStdout --zcl ./zcl-builtin/silabs/zcl.json --zcl ./zcl-builtin/matter/zcl.json --gen ./test/gen-template/zigbee/gen-templates.json --reuseZapInstance",
"stop": "node src-script/zap-start.js stop --reuseZapInstance",
"status": "node src-script/zap-start.js status --reuseZapInstance",
......
#!/usr/bin/env node
/**
*
* Copyright (c) 2020 Silicon Labs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const scriptUtil = require('./script-util.js')
let cypressMode = 'run'
if (process.argv.length > 2) {
cypressMode = process.argv[2]
}
if (cypressMode == '-?') {
console.log(`Usage: zap-uitest.js [ MODE | -? ]
This program executes the Cypress unit tests.
Valid modes:
run - [default] Executes all the Cypress tests in the headless mode. You might need to run via xvfb-run in a headless environment.
open - Executes Cypress UI for manual run of the tests.`)
process.exit(0)
}
let returnCode = 0
let svr = scriptUtil.executeCmd(null, 'npm', ['run', 'matterzap-devserver'])
let cyp = scriptUtil.executeCmd(null, 'npx', [
'start-test',
'quasar dev',
'http-get://localhost:8080',
`npx cypress ${cypressMode} --config fixturesFolder=cypress/matterFixtures`,
])
cyp
.then(() => {
returnCode = 0
scriptUtil.executeCmd(null, 'npm', ['run', 'stop'])
})
.catch(() => {
returnCode = 1
scriptUtil.executeCmd(null, 'npm', ['run', 'stop'])
})
svr.then(() => {
if (returnCode == 0) {
console.log('😎 All done: Cypress tests passed and server shut down.')
process.exit(0)
} else {
console.log('⛔ Error: Cypress tests failed, server shut down.')
process.exit(returnCode)
}
})
\ No newline at end of file
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册