Skip to content

Commit

Permalink
removing cypress waits and adding known identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
Mehradml authored and tecimovic committed Mar 21, 2022
1 parent 8c49502 commit e41b553
Show file tree
Hide file tree
Showing 19 changed files with 299 additions and 270 deletions.
19 changes: 11 additions & 8 deletions cypress/integration/attribute_validations/bitmap8.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@ describe('Testing BITMAP8 type validation', () => {
cy.visit(data.baseurl)
})
cy.gotoAttributePage('Billing Unit (0x0203)', 'General')
cy.wait(1000)
})
it('getting an attribute with BITMAP8 type and change defualt amount', () => {
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(
'getting an attribute with BITMAP8 type and change defualt 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'
Expand Down
17 changes: 10 additions & 7 deletions cypress/integration/attribute_validations/boolean.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ Cypress.on('uncaught:exception', (err, runnable) => {
})

describe('Testing BOOLEAN 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')
cy.wait(1000)
})
it(
'create a new endpoint and click on configure to open attributes of endpoint',
{ retries: { runMode: 2, openMode: 2 } },
() => {
cy.fixture('baseurl').then((data) => {
cy.visit(data.baseurl)
})
cy.gotoAttributePage('Billing Unit (0x0203)', 'General')
}
)
it('getting an attribute with BOOLEAN type and change defualt amount', () => {
cy.get(
':nth-child(15) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > input'
Expand Down
17 changes: 10 additions & 7 deletions cypress/integration/attribute_validations/enum8.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ Cypress.on('uncaught:exception', (err, runnable) => {
})

describe('Testing ENUM8 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')
cy.wait(1000)
})
it(
'create a new endpoint and click on configure to open attributes of endpoint',
{ retries: { runMode: 2, openMode: 2 } },
() => {
cy.fixture('baseurl').then((data) => {
cy.visit(data.baseurl)
})
cy.gotoAttributePage('Billing Unit (0x0203)', 'General')
}
)
it('getting an attribute with ENUM8 type and change defualt amount', () => {
cy.get(
':nth-child(8) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > input'
Expand Down
32 changes: 19 additions & 13 deletions cypress/integration/attribute_validations/int16.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,30 @@ Cypress.on('uncaught:exception', (err, runnable) => {
})

describe('Testing INT16U 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')
cy.wait(1000)
})
it(
'create a new endpoint and click on configure to open attributes of endpoint',
{ retries: { runMode: 2, openMode: 2 } },
() => {
cy.fixture('baseurl').then((data) => {
cy.visit(data.baseurl)
})
cy.gotoAttributePage('Billing Unit (0x0203)', 'General')
}
)
it('getting an attribute with INT16U type and change defualt amount', () => {
cy.get(
':nth-child(19) > [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.wait(1000)
cy.get(
':nth-child(19) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__bottom > .q-field__messages > div'
).should('exist')
})
it(
'check if validation works properly',
{ retries: { runMode: 2, openMode: 2 } },
() => {
cy.get(
':nth-child(19) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__bottom > .q-field__messages > div'
).should('exist')
}
)
})
17 changes: 10 additions & 7 deletions cypress/integration/attribute_validations/int8.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ Cypress.on('uncaught:exception', (err, runnable) => {
})

describe('Testing INT8U 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')
cy.wait(1000)
})
it(
'create a new endpoint and click on configure to open attributes of endpoint',
{ retries: { runMode: 2, openMode: 2 } },
() => {
cy.fixture('baseurl').then((data) => {
cy.visit(data.baseurl)
})
cy.gotoAttributePage('Billing Unit (0x0203)', 'General')
}
)
it('getting an attribute with INT8U type and change defualt amount', () => {
cy.get(
':nth-child(1) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > input'
Expand Down
33 changes: 18 additions & 15 deletions cypress/integration/attributes/check-required-attributes.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,23 @@ describe('Testing disabling enabled attributes', () => {
cy.visit(data.baseurl)
})
cy.gotoAttributePage('Billing Unit (0x0203)', 'General')
cy.wait(1000)
})
it('getting enabled attribute and disable it', () => {
cy.get(
'#qvs_116 > :nth-child(1) > :nth-child(2) > .q-mt-xs > .q-toggle__inner'
).click()
cy.get(
'#qvs_116 > :nth-child(1) > :nth-child(2) > .q-mt-xs > .q-toggle__inner'
).should('be.visible')
cy.get(
'#qvs_116 > :nth-child(1) > :nth-child(2) > .q-mt-xs > .q-toggle__inner'
).click()
cy.contains(
'#qvs_116 > :nth-child(1) > :nth-child(2) > .q-mt-xs > .q-toggle__inner'
).should('not.exist')
})
it(
'getting enabled attribute and disable it',
{ retries: { runMode: 2, openMode: 2 } },
() => {
cy.get(
'.table_body:first > :nth-child(2) > .q-mt-xs > .q-toggle__inner'
).click()
cy.get(
'.table_body:first > :nth-child(2) > .q-mt-xs > .q-toggle__inner'
).should('be.visible')
cy.get(
'.table_body:first > :nth-child(2) > .q-mt-xs > .q-toggle__inner'
).click()
cy.contains(
'.table_body:first > :nth-child(2) > .q-mt-xs > .q-toggle__inner'
).should('not.exist')
}
)
})
17 changes: 10 additions & 7 deletions cypress/integration/attributes/check-search.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ describe('Testing attribute search', () => {
cy.visit(data.baseurl)
})
cy.gotoAttributePage('Billing Unit (0x0203)', 'General')
cy.wait(1000)
})
it('check existance of ZCL version and application version', () => {
cy.get('tbody')
.children()
.should('contain', 'ZCL version')
.and('contain', 'application version')
})
it(
'check existance of ZCL version and application version',
{ retries: { runMode: 2, openMode: 2 } },
() => {
cy.get('tbody')
.children()
.should('contain', 'ZCL version')
.and('contain', 'application version')
}
)
it('Search for application', () => {
cy.get(
'.q-py-none > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > input'
Expand Down
31 changes: 17 additions & 14 deletions cypress/integration/attributes/check-validation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,24 @@ describe('Testing attribute validation', () => {
cy.visit(data.baseurl)
})
cy.gotoAttributePage('Billing Unit (0x0203)', 'General')
cy.wait(2000)
})
it('change default input to a wrong amount', () => {
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('99999', { force: true })
.then(() => {
cy.get('#qvs_116 > :nth-child(1) > [style="min-width: 180px;"]').should(
'contain',
'Out of range'
)
})
})
it(
'change default input to a wrong 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('99999', { 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', () => {
cy.get(
':nth-child(1) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > input'
Expand Down
46 changes: 24 additions & 22 deletions cypress/integration/check_summary/enabled-attributes.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,29 @@ Cypress.on('uncaught:exception', (err, runnable) => {
})

describe('Testing enabled attributes amount', () => {
it('create a new endpoint and get amount of enabled attributes', () => {
cy.fixture('baseurl').then((data) => {
cy.visit(data.baseurl)
})
cy.addEndpoint('Billing Unit (0x0203)', 'General')
cy.wait(2000)
cy.get(':nth-child(7) > .text-right').then(($div) => {
const num1 = parseFloat($div.text())
cy.gotoAttributePage('', 'General')
cy.get(
'#qvs_116 > :nth-child(2) > :nth-child(2) > .q-mt-xs > .q-toggle__inner'
).click()
cy.get('.router-link-active')
.contains('Back')
.click()
.then(() => {})
cy.wait(2000)
cy.get(':nth-child(7) > .text-right').then(($div2) => {
const num2 = parseFloat($div2.text())
expect(num2).to.eq(17)
it(
'create a new endpoint and get amount of enabled attributes',
{ retries: { runMode: 2, openMode: 2 } },
() => {
cy.fixture('baseurl').then((data) => {
cy.visit(data.baseurl)
})
})
})
cy.addEndpoint('Billing Unit (0x0203)', 'General')
cy.get(':nth-child(7) > .text-right').then(($div) => {
const num1 = parseFloat($div.text())
cy.gotoAttributePage('', 'General')
cy.get(
'.table_body:eq(2) > :nth-child(2) > .q-mt-xs > .q-toggle__inner'
).click()
cy.get('.router-link-active')
.contains('Back')
.click()
.then(() => {})
cy.get(':nth-child(7) > .text-right').then(($div2) => {
const num2 = parseFloat($div2.text())
expect(num2).to.eq(17)
})
})
}
)
})
46 changes: 28 additions & 18 deletions cypress/integration/check_summary/enabled-clusters.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,35 @@ Cypress.on('uncaught:exception', (err, runnable) => {
})

describe('Testing enabled attributes amount', () => {
it('create a new endpoint and get amount of enabled attributes', () => {
cy.fixture('baseurl').then((data) => {
cy.visit(data.baseurl)
})
cy.addEndpoint('Billing Unit (0x0203)', 'General')
cy.wait(2000)
cy.get(':nth-child(6) > .text-right').then(($div) => {
const num1 = parseFloat($div.text())
cy.get('.q-page-container > div').children().should('contain', 'General')
cy.get('div').contains('General').click()
cy.get('div').children().contains('Not Enabled').first().click()
cy.get('.q-virtual-scroll__content > :nth-child(3)')
.contains('Server')
.click()
cy.wait(1000)
it(
'create a new endpoint and get amount of enabled attributes',
{ retries: { runMode: 2, openMode: 2 } },
() => {
cy.fixture('baseurl').then((data) => {
cy.visit(data.baseurl)
})
cy.addEndpoint('Billing Unit (0x0203)', 'General')
cy.get(':nth-child(6) > .text-right').then(($div) => {
const num1 = parseFloat($div.text())
cy.get('.q-page-container > div')
.children()
.should('contain', 'General')
cy.get('div').contains('General').click()
cy.get('div').children().contains('Not Enabled').first().click()
cy.get('.q-virtual-scroll__content > :nth-child(3)')
.contains('Server')
.click()
})
}
)
it(
'checks if number is updated',
{ retries: { runMode: 2, openMode: 2 } },
() => {
cy.get(':nth-child(6) > .text-right').then(($div2) => {
const num2 = parseFloat($div2.text())
expect(num2).to.eq(num1 + 1)
expect(num2).to.eq(6)
})
})
})
}
)
})
Loading

0 comments on commit e41b553

Please sign in to comment.