Skip to content

Commit

Permalink
feat: convenient copy paste button for edge device ID
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivelin Ivanov authored Aug 16, 2021
2 parents b8ac022 + 68730a7 commit 61f5681
Show file tree
Hide file tree
Showing 37 changed files with 471 additions and 2,312 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,19 @@ jobs:
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files:
./coverage/coverage-final.json,
./coverage/jest/coverage-final.json
root_dir: ./coverage/
fail_ci_if_error: true # optional (default = false)
# path_to_write_report: ./coverage/codecov_report.txt

path_to_write_report: ./coverage/codecov_report.txt
verbose: true
- name: List coverage report files
run: |
ls -alR ./coverage
ls -al ./
- name: Upload test coverage report
uses: actions/upload-artifact@v2
with:
name: test-coverage
path: ./coverage
- name: Build PWA distribution for production
run: |
npm run build --if-present
Expand Down
5 changes: 5 additions & 0 deletions cypress/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"plugin:cypress/recommended"
]
}
12 changes: 6 additions & 6 deletions cypress/integration/ambianic-tests/about.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ context('AboutPage', () => {
})

it('Loads timeline button', () => {
let btn = cy.get('#btn-timeline')
btn.should('have.attr', 'href', '/timeline')
btn.get('.v-btn__content')
cy.get('#btn-timeline')
.should('have.attr', 'href', '/timeline')
.get('.v-btn__content')
.contains('View Timeline', { matchCase: false })
})

it('Loads settings button', () => {
let btn = cy.get('#btn-settings')
btn.should('have.attr', 'href', '/settings')
btn.get('.v-btn__content')
cy.get('#btn-settings')
.should('have.attr', 'href', '/settings')
.get('.v-btn__content')
.contains('Settings', { matchCase: false })
})

Expand Down
6 changes: 3 additions & 3 deletions cypress/integration/ambianic-tests/actions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ context('Actions', () => {
cy.get('#welcome-text')
.should('contain', 'Safer Home via Ambient Intelligence' )
})

it('looks at welcome button', () => {
const btn = cy.get('#btn-setup')
btn.get('.v-btn__content')
cy.get('#btn-setup')
.get('.v-btn__content')
.contains('Begin Setup', { matchCase: false })
})
})
9 changes: 3 additions & 6 deletions cypress/integration/ambianic-tests/feedback.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ context('FeedbackPage', () => {
cy.visit('/feedback')
})


it('Look at page title and subtitle', () => {

cy.get('#feedback-title > .v-list-item__content > .v-list-item__title')
.contains('Send Feedback', { matchCase: false })

Expand All @@ -15,10 +13,9 @@ context('FeedbackPage', () => {
})

it('Check feedback button', () => {
let btn = cy.get('#btn-feedback')
btn.should('have.attr', 'href', 'https://github.com/ambianic/ambianic-ui/issues')
btn.get('.v-btn__content')
cy.get('#btn-feedback')
.should('have.attr', 'href', 'https://github.com/ambianic/ambianic-ui/issues')
.get('.v-btn__content')
.contains('Open Feedback Page', { matchCase: false })
})

})
15 changes: 6 additions & 9 deletions cypress/integration/ambianic-tests/help.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ context('HelpPage', () => {
cy.visit('/help')
})



it('Look at page title and subtitle', () => {
cy.get('#help-title > .v-list-item__content > .v-list-item__title')
.contains('Need Help with Ambianic?', { matchCase: false })
Expand All @@ -15,17 +13,16 @@ context('HelpPage', () => {
})

it('Check docs button', () => {
let btn = cy.get('#btn-docs')
btn.should('have.attr', 'href', 'https://docs.ambianic.ai')
btn.get('.v-btn__content')
cy.get('#btn-docs')
.should('have.attr', 'href', 'https://docs.ambianic.ai')
.get('.v-btn__content')
.contains('Documentation', { matchCase: false })
})

it('Check community button', () => {
let btn = cy.get('#btn-community')
btn.should('have.attr', 'href', 'https://twitter.com/ambianicai')
btn.get('.v-btn__content')
cy.get('#btn-community')
.should('have.attr', 'href', 'https://twitter.com/ambianicai')
.get('.v-btn__content')
.contains('Twitter', { matchCase: false })
})

})
53 changes: 26 additions & 27 deletions cypress/integration/ambianic-tests/home.spec.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
/// <reference types="cypress" />
import {CHANGE_REMOTE_PEER_ID} from '../../../src/store/action-types';
import { CHANGE_REMOTE_PEER_ID } from '../../../src/store/action-types';

context('HomePage', () => {
beforeEach(() => {
cy.visit('/')
})

it('Loads title and subtitle', () => {
cy.get('.v-list-item__subtitle')
.should('contain.text', 'Safer Home via Ambient Intelligence')
})
beforeEach(() => {
cy.visit('/')
})

it('Loads firsttime installation button', () => {
cy.get('#btn-setup > .v-btn__content')
.should('contain.text', 'Begin Setup')
.click()
.url().should('include', '/onboarding')
})
it('Loads title and subtitle', () => {
cy.get('.v-list-item__subtitle')
.should('contain.text', 'Safer Home via Ambient Intelligence')
})

it('Ensures returning users are taken directly to timeline', () => {
cy.window().should('have.property', '__store__')
cy.window().then(win => {
win.__store__.dispatch(CHANGE_REMOTE_PEER_ID, '917d5f0a-6469-4d33-b5c2-efd858118b74')
cy.wait(1000)
it('Loads firsttime installation button', () => {
cy.get('#btn-setup > .v-btn__content')
.should('contain.text', 'Begin Setup')
.click()
.url().should('include', '/onboarding')
})

// reload to use new values for testing
cy.reload()
cy.get('#btn-dashboard > .v-btn__content')
.should('contain.text', 'View Timeline')
.click()
.url().should('include', '/timeline')
})
it('Ensures returning users are taken directly to timeline', () => {
cy.window().should('have.property', '__store__')
cy.window().then((win) => {
win.__store__.dispatch(CHANGE_REMOTE_PEER_ID, '917d5f0a-6469-4d33-b5c2-efd858118b74')
// cy.wait(1000)
// reload to use new values for testing
// cy.reload()
cy.get('#btn-dashboard > .v-btn__content')
.should('contain.text', 'View Timeline')
.click()
.url().should('include', '/timeline')
})
})
})
18 changes: 5 additions & 13 deletions cypress/integration/ambianic-tests/navbar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ context('Check Navbar Items', () => {
cy.visit('http://localhost:8080/about')
})

it('Should be a download off button', () => {
const t = cy.get('[data-cy=download-off]')
expect(t).to.exist
it('Should be a download off button before edge connection', () => {
cy.get('[data-cy=download-off]').should('exist')
})


/** future buttons
it('Should not have a search bar', () => {
cy.get('[data-cy=container').find("#searchbar")
Expand All @@ -28,8 +26,7 @@ context('Check Navbar Items', () => {
*/

it('Should be an about button', () => {
const t = cy.get('[data-cy=about]')
expect(t).to.exist
cy.get('[data-cy=about]').should('exist')
})

it('Should have a five links', () => {
Expand All @@ -39,12 +36,7 @@ context('Check Navbar Items', () => {
})

it('Should have a clickable timeline icon', () => {
const icon = cy.get('[data-cy=timeline-icon]')

icon.should("be.visible")

icon.click()

cy.get('[data-cy=timeline-icon]').should('be.visible').click()
cy.url().should('include', '/timeline')
})
})
})
93 changes: 73 additions & 20 deletions cypress/integration/ambianic-tests/settings.spec.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,86 @@
/// <reference types="cypress" />
import { NEW_REMOTE_PEER_ID, REMOTE_PEER_ID_REMOVED } from '../../../src/store/mutation-types'

context('Settings', () => {
before(() => {
cy.visit('http://localhost:8080/settings')
// cy.get('[data-cy=settings]').click()
})
before(() => {
cy.visit('http://localhost:8080/settings')
// cy.get('[data-cy=settings]').click()
})

it('Should have a title card', () => {
cy.get('[data-cy=titlecard]').contains('Ambianic Edge connection details')
afterEach(() => {
cy.window().then(win => {
// restore Vuex store state
win.__store__.commit(REMOTE_PEER_ID_REMOVED)
})
})

it('Should have a local ambianic edge title card', () => {
cy.get('[data-cy=localtitlecard]').contains('Pair with local Ambianic Edge device')
})
it('Should have a title card', () => {
cy.get('[data-cy=titlecard]').contains('Ambianic Edge connection details')
})

it('Should have a remote ambianic edge title card', () => {
cy.get('[data-cy=remotetitlecard]').contains('Pair with remote Ambianic Edge device')
})
it('Should have a local ambianic edge title card', () => {
cy.get('[data-cy=localtitlecard]').contains('Pair with local Ambianic Edge device')
})

it('Should have a remote ambianic edge title card', () => {
cy.get('[data-cy=remotetitlecard]').contains('Pair with remote Ambianic Edge device')
})

it('Should have remote connection button disabled', () => {
cy.get('[data-cy=sendRemotePeerID]').should('be.disabled')
})

it('Should have remote connection button enabled', () => {
cy.get('[data-cy=remotePeerID]').type('917d5f0a-6469-4d33-b5c2-efd858118b74')
cy.get('[data-cy=sendRemotePeerID]').should('be.enabled')
})

it('Should have a row', () => {
cy.get('[data-cy=template-row]').should('exist')
})

it('Should have remote connection button disabled', () => {
cy.get('[data-cy=sendRemotePeerID]').should('be.disabled')
it('Should display edge device peer ID', () => {
var edgePeerId = '917d5f0a-6469-4d33-b5c2-efd858118b74'
cy.window().then(win => {
cy.get('[data-cy=list-item-edgePeerID]').should('not.exist')
win.__store__.commit(NEW_REMOTE_PEER_ID, edgePeerId)
cy.get('[data-cy=list-item-edgePeerID]').should('exist').within(($listItem) => {
cy.get('[data-cy=input-title]').get('input').should('have.value', edgePeerId)
})
})
})

it('Should have remote connection button enabled', () => {
cy.get('[data-cy=remotePeerID]').type('917d5f0a-6469-4d33-b5c2-efd858118b74')
cy.get('[data-cy=sendRemotePeerID]').should('be.enabled')
it('Should display sensitive text eye icon next to peer edge ID', () => {
cy.window().then(win => {
cy.get('[data-cy=icon-sensitive-on]').should('not.exist')
win.__store__.commit(NEW_REMOTE_PEER_ID, '917d5f0a-6469-4d33-b5c2-efd858118b74')
// tooltip should not be shown without focus on the icon
cy.contains('Show/Hide cleartext').should('not.exist')
cy.get('[data-cy=list-item-edgePeerID]').should('exist').within(($listItem) => {
cy.get('[data-cy=icon-sensitive-on]')
.should('exist')
// focus on the icon to check if a tooltip is shown
.focus()
})
// check if tooltip is shown for the eye icon
cy.contains('Show/Hide cleartext')
})
})

it('Should have a row', () => {
cy.get('[data-cy=template-row]').should('exist')
it('Should display copy paste icon next to peer edge ID', () => {
cy.window().then(win => {
cy.get('[data-cy=icon-copy-on]').should('not.exist')
win.__store__.commit(NEW_REMOTE_PEER_ID, '917d5f0a-6469-4d33-b5c2-efd858118b74')
// tooltip should not be shown without focus on the icon
cy.contains('Copy to clipboard').should('not.exist')
cy.get('[data-cy=list-item-edgePeerID]').should('exist').within(($listItem) => {
cy.get('[data-cy=icon-copy-on]')
.should('exist')
// focus on the icon to check if a tooltip is shown
.focus()
})
// check if tooltip is shown for the eye icon
cy.contains('Copy to clipboard')
})
})
})
})
Loading

0 comments on commit 61f5681

Please sign in to comment.