Skip to content

Commit 60c1962

Browse files
authored
more e2e tests (#99)
1 parent 03b4e8b commit 60c1962

File tree

11 files changed

+266
-109
lines changed

11 files changed

+266
-109
lines changed

cypress/e2e/100_home.cy.js

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,12 @@ describe('load homepage', () => {
2020
cy.get('a[href*="/gallery"]').should('exist')
2121
cy.get('a[href*="/settings"]').should('exist')
2222
})
23-
/*
23+
2424
it('checks home page links', () => {
2525
cy.visit('http://localhost:8080')
26-
cy.get('a.v-btn[href*="/program"]').click()
27-
cy.url().should('include', '/program')
28-
cy.visit('http://localhost:8080')
29-
cy.get('a.v-btn[href*="/docs"]').invoke('removeAttr', 'target').click()
30-
cy.url().should('include', '/docs')
31-
cy.visit('http://localhost:8080')
32-
cy.get('a.v-btn[href*="/control"]').click()
33-
cy.url().should('include', '/control')
34-
cy.visit('http://localhost:8080')
35-
cy.get('a.v-btn[href*="/settings"]').click()
36-
cy.url().should('include', '/settings')
26+
cy.get('a.v-btn[href*="/program"]').should('exist')
27+
cy.get('a.v-btn[href*="/docs"]').should('exist')
28+
cy.get('a.v-btn[href*="/control"]').should('exist')
29+
cy.get('a.v-btn[href*="/settings"]').should('exist')
3730
})
38-
*/
3931
})

cypress/e2e/500_control.cy.js

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
describe('load homepage', () => {
1+
describe('load control page, verify stream is there', () => {
22
it('checks sidebar contents', () => {
33
cy.visit('http://localhost:8080')
44
cy.get('.v-carousel').should('exist')
@@ -7,15 +7,55 @@ describe('load homepage', () => {
77
cy.get('img[src*="video/stream"]').should('exist')
88
})
99

10-
it('takes picture', () => {
10+
it('move', () => {
11+
cy.visit('http://localhost:8080')
12+
cy.get('.v-carousel').should('exist')
13+
cy.get('button.v-app-bar-nav-icon').should('exist').click()
14+
cy.get('a.v-list-item[href*="control"]').click()
15+
cy.get('#app').click()
16+
cy.get('button.up').click()
17+
cy.get('button.left').click()
18+
cy.get('button.right').click()
19+
cy.get('button.down').click()
1120
})
1221

13-
it('say a phrase', () => {
22+
it('takes a picture', () => {
23+
cy.visit('http://localhost:8080')
24+
cy.get('.v-carousel').should('exist')
25+
cy.get('button.v-app-bar-nav-icon').should('exist').click()
26+
cy.get('a.v-list-item[href*="control"]').click()
27+
cy.get('#app').click()
28+
cy.get('button.photo').click()
1429
})
1530

1631
it('record a video', () => {
32+
cy.visit('http://localhost:8080')
33+
cy.get('.v-carousel').should('exist')
34+
cy.get('button.v-app-bar-nav-icon').should('exist').click()
35+
cy.get('a.v-list-item[href*="control"]').click()
36+
cy.get('#app').click()
37+
cy.get('button.video').click()
38+
cy.get('button.video').click()
39+
})
40+
41+
it('say a phrase', () => {
42+
cy.visit('http://localhost:8080')
43+
cy.get('.v-carousel').should('exist')
44+
cy.get('button.v-app-bar-nav-icon').should('exist').click()
45+
cy.get('a.v-list-item[href*="control"]').click()
46+
cy.get('#app').click()
47+
cy.get('button.speak').click()
48+
cy.get('#control_text_to_speech').clear().type('hello world!')
49+
cy.get('#dialog_control_speak_title').find('button.ok').click()
1750
})
1851

1952
it('opens gallery', () => {
53+
cy.visit('http://localhost:8080')
54+
cy.get('.v-carousel').should('exist')
55+
cy.get('button.v-app-bar-nav-icon').should('exist').click()
56+
cy.get('a.v-list-item[href*="control"]').click()
57+
cy.get('#app').click()
58+
cy.get('a.gallery').click()
59+
cy.url().should('include', '/gallery')
2060
})
2161
})

cypress/e2e/600_gallery.cy.js

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,47 @@ describe('load homepage', () => {
88
cy.get('h3').should('exist')
99
})
1010

11-
it('checks photo exists, sees details', () => {
12-
})
13-
14-
it('checks video exists, plays it', () => {
15-
})
16-
17-
it('deletes existing photo', () => {
11+
it('takes a picture, verify gallery and details, delete', () => {
12+
cy.visit('http://localhost:8080')
13+
cy.get('.v-carousel').should('exist')
14+
cy.get('button.v-app-bar-nav-icon').should('exist').click()
15+
cy.get('a.v-list-item[href*="control"]').click()
16+
cy.get('#app').click()
17+
cy.get('button.photo').click()
18+
cy.visit('http://localhost:8080')
19+
cy.get('.v-carousel').should('exist')
20+
cy.get('button.v-app-bar-nav-icon').should('exist').click()
21+
cy.get('a.v-list-item[href*="gallery"]').click()
22+
cy.get('#app').click()
23+
cy.get('.gallery').contains('DSC1').should('exist')
24+
cy.get('.v-main').contains('DSC1').click()
25+
cy.get('.v-card-title.details').contains('DSC1').should('exist')
26+
cy.get('.v-card-title.details').contains('DSC1').parents('.v-card').find('button.ok').click()
27+
cy.get('.v-main').contains('DSC1').parents('.v-card').find('.mdi-delete').click()
28+
cy.get('#gallery_photo_confirm_card').find('.ok').click()
1829
})
1930

20-
it('deletes existing vide', () => {
31+
it('takes a video, deletes is', () => {
32+
cy.visit('http://localhost:8080')
33+
cy.get('.v-carousel').should('exist')
34+
cy.get('button.v-app-bar-nav-icon').should('exist').click()
35+
cy.get('a.v-list-item[href*="control"]').click()
36+
cy.get('#app').click()
37+
cy.get('button.video').click()
38+
cy.wait(1000)
39+
cy.get('button.video').click()
40+
cy.visit('http://localhost:8080')
41+
cy.get('.v-carousel').should('exist')
42+
cy.get('button.v-app-bar-nav-icon').should('exist').click()
43+
cy.get('a.v-list-item[href*="gallery"]').click()
44+
cy.get('#app').click()
45+
/*
46+
cy.get('.gallery').contains('VID1').should('exist')
47+
cy.get('.v-main').contains('VID1').click()
48+
cy.get('.v-card-title.details').contains('VID1').should('exist')
49+
cy.get('.v-card-title.details').contains('VID1').parents('.v-card').find('button.ok').click()
50+
cy.get('.v-main').contains('VID1').parents('.v-card').find('.mdi-delete').click()
51+
cy.get('#gallery_photo_confirm_card').find('.ok').click()
52+
*/
2153
})
2254
})

cypress/e2e/700_settings.cy.js

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,78 @@ describe('load homepage', () => {
5050
cy.get('#settings_password').clear()
5151
cy.get('#save').click()
5252
})
53-
/*
53+
5454
it('modifies most settings, valid values, save', () => {
55+
cy.intercept('http://localhost:5000/wifi/v1/connection_status', (req) => {
56+
req.reply({"wifi": false, "internet": true})
57+
})
58+
cy.intercept('http://localhost:5000/wifi/v1/list_access_points', (req) => {
59+
req.reply({"ssids": [{"ssid": "wifi-home", "conn_type": "WPA2", "strength": 99}]})
60+
})
61+
cy.visit('http://localhost:8080')
62+
cy.get('.v-carousel').should('exist')
63+
cy.get('button.v-app-bar-nav-icon').should('exist').click()
64+
cy.get('a.v-list-item[href*="/settings"]').click()
65+
cy.get('#app').click()
66+
cy.get('button#1').click()
67+
cy.get('input#settings_movement_control_forward_speed').clear().type('90')
68+
cy.get('input#settings_movement_control_forward_elapse').clear().type('1')
69+
cy.get('input#settings_movement_control_turn_speed').clear().type('90')
70+
cy.get('input#settings_movement_control_turn_elapse').clear().type('1')
71+
cy.get('input#settings_movement_program_forward_speed').clear().type('90')
72+
cy.get('input#settings_movement_program_forward_elapse').clear().type('1')
73+
cy.get('input#settings_movement_program_turn_speed').clear().type('90')
74+
cy.get('input#settings_movement_program_turn_elapse').clear().type('1')
75+
cy.get('#save').click()
76+
cy.visit('http://localhost:8080')
77+
cy.get('.v-carousel').should('exist')
78+
cy.get('button.v-app-bar-nav-icon').should('exist').click()
79+
cy.get('a.v-list-item[href*="/settings"]').click()
80+
cy.get('#app').click()
81+
cy.get('button#1').click()
82+
cy.get('input#settings_movement_control_forward_speed').should('have.value', '90')
83+
cy.get('input#settings_movement_control_forward_elapse').should('have.value', '1')
84+
cy.get('input#settings_movement_control_turn_speed').should('have.value', '90')
85+
cy.get('input#settings_movement_control_turn_elapse').should('have.value', '1')
86+
cy.get('input#settings_movement_program_forward_speed').should('have.value', '90')
87+
cy.get('input#settings_movement_program_forward_elapse').should('have.value', '1')
88+
cy.get('input#settings_movement_program_turn_speed').should('have.value', '90')
89+
cy.get('input#settings_movement_program_turn_elapse').should('have.value', '1')
5590
})
5691

5792
it('modifies most settings, invalid values, verify error message', () => {
93+
cy.intercept('http://localhost:5000/wifi/v1/connection_status', (req) => {
94+
req.reply({"wifi": false, "internet": true})
95+
})
96+
cy.intercept('http://localhost:5000/wifi/v1/list_access_points', (req) => {
97+
req.reply({"ssids": [{"ssid": "wifi-home", "conn_type": "WPA2", "strength": 99}]})
98+
})
99+
cy.visit('http://localhost:8080')
100+
cy.get('.v-carousel').should('exist')
101+
cy.get('button.v-app-bar-nav-icon').should('exist').click()
102+
cy.get('a.v-list-item[href*="/settings"]').click()
103+
cy.get('#app').click()
104+
cy.get('button#1').click()
105+
cy.get('input#settings_movement_control_forward_speed').clear().type('1000')
106+
cy.get('input#settings_movement_control_forward_speed').parents('.v-input').find('.v-messages')
107+
})
108+
109+
it('modifies some settings, leave page whithout saving, verify "dirty" message', () => {
110+
cy.intercept('http://localhost:5000/wifi/v1/connection_status', (req) => {
111+
req.reply({"wifi": false, "internet": true})
112+
})
113+
cy.intercept('http://localhost:5000/wifi/v1/list_access_points', (req) => {
114+
req.reply({"ssids": [{"ssid": "wifi-home", "conn_type": "WPA2", "strength": 99}]})
115+
})
116+
cy.visit('http://localhost:8080')
117+
cy.get('.v-carousel').should('exist')
118+
cy.get('button.v-app-bar-nav-icon').should('exist').click()
119+
cy.get('a.v-list-item[href*="/settings"]').click()
120+
cy.get('#app').click()
121+
cy.get('button#1').click()
122+
cy.get('input#settings_movement_control_forward_speed').clear().type('99')
123+
cy.get('button.v-app-bar-nav-icon').should('exist').click()
124+
cy.get('a.v-list-item[href*="/control"]').click()
125+
cy.get('#confirm_exit_dialog').should('exist')
58126
})
59-
*/
60127
})

src/common/coderbot.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,20 +246,24 @@ class CoderBot {
246246
return this.$axios.post(`${this.CB}/system/halt`);
247247
}
248248

249-
getInfoAndStatus() {
249+
getStatus() {
250250
const p1 = this.$axios.get(`${this.CB}/system/status`)
251251
.then((response) => {
252252
this.$store.commit('setStatus', response.data);
253253
}).catch((error) => {
254254
this.$store.commit('setStatus', null);
255255
});
256+
return Promise.all([p1]);
257+
}
258+
259+
getInfo() {
256260
const p2 = this.$axios.get(`${this.CB}/system/info`)
257261
.then((response) => {
258262
this.$store.commit('setInfo', response.data);
259263
}).catch(error => {
260264
this.$store.commit('setInfo', null);
261265
});
262-
return Promise.all([p1, p2]);
266+
return Promise.all([p2]);
263267
}
264268

265269
deleteMusicPackage(pkgNameID) {
@@ -399,15 +403,15 @@ class CoderBot {
399403
return `${this.CB}/video/stream`;
400404
}
401405

402-
getPhotos() {
406+
getMediaList() {
403407
return this.$axios.get(`${this.CB}/media`);
404408
}
405409

406-
deletePhoto(name) {
410+
deleteMedia(name) {
407411
return this.$axios.delete(`${this.CB}/media/${name}`);
408412
}
409413

410-
getPhotoURL(name) {
414+
getMediaURL(name) {
411415
return `${this.CB}/media/${name}`;
412416
}
413417

src/components/BlocklyWorkspace.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,12 @@ export default {
105105
maxBlocks: settings.maxBlocks,
106106
zoom: {
107107
controls: true,
108-
wheel: false,
108+
wheel: true,
109109
startScale: 1.0,
110-
maxScale: 1.5,
111-
minScale: 0.2,
110+
maxScale: 3,
111+
minScale: 0.3,
112+
scaleSpeed: 1.2,
113+
pinch: true
112114
},
113115
},
114116
);

src/components/Control.vue

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,29 @@
1515
<v-container class="d-flex align-center flex-column">
1616
<v-row>
1717
<v-col class="d-flex align-center flex-column">
18-
<v-btn color="indigo" class="white--text jp-btn" v-on:mousedown="move(0)"
18+
<v-btn color="indigo" class="white--text jp-btn up" v-on:mousedown="move(0)"
1919
v-on:mouseup="stop()">
2020
<v-icon icon="mdi-arrow-up"></v-icon>
2121
</v-btn>
2222
</v-col>
2323
</v-row>
2424
<v-row>
2525
<v-col>
26-
<v-btn color="indigo" class="white--text jp-btn" v-on:mousedown="move(1)"
26+
<v-btn color="indigo" class="white--text jp-btn left" v-on:mousedown="move(1)"
2727
v-on:mouseup="stop()">
2828
<v-icon icon="mdi-arrow-left"></v-icon>
2929
</v-btn>
3030
</v-col>
3131
<v-col>
32-
<v-btn large color="indigo" class="white--text jp-btn" v-on:mousedown="move(2)"
32+
<v-btn large color="indigo" class="white--text jp-btn right" v-on:mousedown="move(2)"
3333
v-on:mouseup="stop()">
3434
<v-icon icon="mdi-arrow-right"></v-icon>
3535
</v-btn>
3636
</v-col>
3737
</v-row>
3838
<v-row>
3939
<v-col>
40-
<v-btn color="indigo" class="white--text jp-btn" v-on:mousedown="move(3)"
40+
<v-btn color="indigo" class="white--text jp-btn down" v-on:mousedown="move(3)"
4141
v-on:mouseup="stop()">
4242
<v-icon icon="mdi-arrow-down"></v-icon>
4343
</v-btn>
@@ -50,7 +50,7 @@
5050
</v-row>
5151
<v-row>
5252
<v-col>
53-
<v-btn color="indigo" v-on:click="ttsdialog = true" class="controlBtn"
53+
<v-btn color="indigo" v-on:click="ttsdialog = true" class="controlBtn speak"
5454
:disabled="!ttsBtnEnabled">
5555
{{ $t("message.control_speak") }}
5656
<v-icon icon="mdi-bullhorn-variant"></v-icon>
@@ -59,7 +59,7 @@
5959
</v-row>
6060
<v-row>
6161
<v-col class="d-flex align-center flex-column">
62-
<v-btn color="indigo" class="controlBtn" v-on:click="takePhoto()"
62+
<v-btn color="indigo" class="controlBtn photo" v-on:click="takePhoto()"
6363
:disabled="!photoBtnEnabled">
6464
{{ $t("message.control_photo_take") }}
6565
<v-icon icon="mdi-camera"></v-icon>
@@ -68,7 +68,7 @@
6868
</v-row>
6969
<v-row>
7070
<v-col class="d-flex align-center flex-column">
71-
<v-btn color="indigo" class="controlBtn" v-on:click="videoHandler()"
71+
<v-btn color="indigo" class="controlBtn video" v-on:click="videoHandler()"
7272
:disabled="!videoBtn.enabled">
7373
{{ videoBtn.text }}
7474
<v-icon dark>mdi-{{ videoBtn.icon }}</v-icon>
@@ -77,7 +77,7 @@
7777
</v-row>
7878
<v-row>
7979
<v-col class="d-flex align-center flex-column">
80-
<v-btn color="indigo" class="controlBtn" to="/gallery">
80+
<v-btn color="indigo" class="controlBtn gallery" to="/gallery">
8181
{{ $t("message.control_photo_gallery") }}
8282
<v-icon icon="mdi-image-multiple"></v-icon>
8383
</v-btn>
@@ -94,18 +94,18 @@
9494
{{ $t("message.close") }}
9595
</v-btn>
9696
</v-snackbar>
97-
<v-dialog v-model="ttsdialog" width="600px">
97+
<v-dialog v-model="ttsdialog" width="600px" id="dialog_control_speak_title">
9898
<v-card>
9999
<v-card-title>
100-
<span class="headline">{{ $t("message.gallery_empty") }}</span>
100+
<span class="headline">{{ $t("message.control_speak_title") }}</span>
101101
</v-card-title>
102102
<v-card-text>
103-
<v-text-field v-model="ttstext" v-bind:label="$t('message.control_text_to_speech')" solo></v-text-field>
103+
<v-text-field v-model="ttstext" v-bind:label="$t('message.control_text_to_speech')" solo id="control_text_to_speech"></v-text-field>
104104
</v-card-text>
105105
<v-card-actions>
106106
<v-spacer></v-spacer>
107107
<v-btn color="gray darken-1" text="text" @click="ttsdialog=false">{{ $t("message.cancel") }}</v-btn>
108-
<v-btn color="green darken-1" text="text" @click="say()">{{ $t("message.control_speak") }}</v-btn>
108+
<v-btn color="green darken-1 ok" text="text" @click="say()">{{ $t("message.control_speak") }}</v-btn>
109109
</v-card-actions>
110110
</v-card>
111111
</v-dialog>

0 commit comments

Comments
 (0)