-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path700_settings.cy.js
More file actions
134 lines (130 loc) · 6.25 KB
/
700_settings.cy.js
File metadata and controls
134 lines (130 loc) · 6.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
describe('load homepage', () => {
it('checks tabs', () => {
cy.intercept('http://localhost:5000/wifi/v1/connection_status', (req) => {
req.reply({"wifi": false, "internet": true})
})
cy.intercept('http://localhost:5000/wifi/v1/list_access_points', (req) => {
req.reply({"ssids": [{"ssid": "wifi-home", "conn_type": "WPA2", "strength": 99}]})
})
cy.visit('http://localhost:8080')
cy.get('.v-carousel').should('exist')
cy.get('button.v-app-bar-nav-icon').should('exist').click()
cy.get('a.v-list-item[href*="/settings"]').click()
cy.get('#app').click()
cy.get('button#0').should('exist')
cy.get('button#1').should('exist')
cy.get('button#2').should('exist')
cy.get('button#3').should('exist')
cy.get('button#4').should('exist')
cy.get('button#5').should('exist')
cy.get('button#6').should('exist')
cy.get('button#7').should('exist')
cy.get('button#8').should('exist')
})
it('checks password', () => {
cy.intercept('http://localhost:5000/wifi/v1/connection_status', (req) => {
req.reply({"wifi": false, "internet": true})
})
cy.intercept('http://localhost:5000/wifi/v1/list_access_points', (req) => {
req.reply({"ssids": [{"ssid": "wifi-home", "conn_type": "WPA2", "strength": 99}]})
})
cy.visit('http://localhost:8080')
cy.get('.v-carousel').should('exist')
cy.get('button.v-app-bar-nav-icon').should('exist').click()
cy.get('a.v-list-item[href*="/settings"]').click()
cy.get('#app').click()
cy.get('button#0').should('exist')
cy.get('button#0').click()
cy.wait(500)
cy.get('#settings_password').should('exist')
cy.get('#settings_password').type('secret')
cy.get('#save').should('exist')
cy.get('#save').click()
cy.get('.v-snackbar__content').should('exist')
cy.visit('http://localhost:8080')
cy.get('.v-carousel').should('exist')
cy.get('button.v-app-bar-nav-icon').should('exist').click()
cy.get('a.v-list-item[href*="/settings"]').click()
cy.get('#settings_password_verify').should('exist')
cy.get('#settings_password_verify').type('secret')
cy.get('#settings_password_verify_ok').click()
cy.get('#app').click()
cy.get('button#0').should('exist')
cy.get('button#0').click()
cy.wait(500)
cy.get('#settings_password').clear()
cy.get('#save').click()
cy.get('.v-snackbar__content').should('exist')
})
it('modifies most settings, valid values, save', () => {
cy.intercept('http://localhost:5000/wifi/v1/connection_status', (req) => {
req.reply({"wifi": false, "internet": true})
})
cy.intercept('http://localhost:5000/wifi/v1/list_access_points', (req) => {
req.reply({"ssids": [{"ssid": "wifi-home", "conn_type": "WPA2", "strength": 99}]})
})
cy.visit('http://localhost:8080')
cy.get('.v-carousel').should('exist')
cy.get('button.v-app-bar-nav-icon').should('exist').click()
cy.get('a.v-list-item[href*="/settings"]').click()
cy.get('#app').click()
cy.get('button#1').click()
cy.get('input#settings_movement_control_forward_speed').clear().type('90')
cy.get('input#settings_movement_control_forward_elapse').clear().type('1')
cy.get('input#settings_movement_control_turn_speed').clear().type('90')
cy.get('input#settings_movement_control_turn_elapse').clear().type('1')
cy.get('input#settings_movement_program_forward_speed').clear().type('90')
cy.get('input#settings_movement_program_forward_elapse').clear().type('1')
cy.get('input#settings_movement_program_turn_speed').clear().type('90')
cy.get('input#settings_movement_program_turn_elapse').clear().type('1')
cy.get('#save').click()
cy.visit('http://localhost:8080')
cy.get('.v-carousel').should('exist')
cy.get('button.v-app-bar-nav-icon').should('exist').click()
cy.get('a.v-list-item[href*="/settings"]').click()
cy.get('#app').click()
cy.get('button#1').click()
cy.get('input#settings_movement_control_forward_speed').should('have.value', '90')
cy.get('input#settings_movement_control_forward_elapse').should('have.value', '1')
cy.get('input#settings_movement_control_turn_speed').should('have.value', '90')
cy.get('input#settings_movement_control_turn_elapse').should('have.value', '1')
cy.get('input#settings_movement_program_forward_speed').should('have.value', '90')
cy.get('input#settings_movement_program_forward_elapse').should('have.value', '1')
cy.get('input#settings_movement_program_turn_speed').should('have.value', '90')
cy.get('input#settings_movement_program_turn_elapse').should('have.value', '1')
})
it('modifies most settings, invalid values, verify error message', () => {
cy.intercept('http://localhost:5000/wifi/v1/connection_status', (req) => {
req.reply({"wifi": false, "internet": true})
})
cy.intercept('http://localhost:5000/wifi/v1/list_access_points', (req) => {
req.reply({"ssids": [{"ssid": "wifi-home", "conn_type": "WPA2", "strength": 99}]})
})
cy.visit('http://localhost:8080')
cy.get('.v-carousel').should('exist')
cy.get('button.v-app-bar-nav-icon').should('exist').click()
cy.get('a.v-list-item[href*="/settings"]').click()
cy.get('#app').click()
cy.get('button#1').click()
cy.get('input#settings_movement_control_forward_speed').clear().type('1000')
cy.get('input#settings_movement_control_forward_speed').parents('.v-input').find('.v-messages')
})
it('modifies some settings, leave page whithout saving, verify "dirty" message', () => {
cy.intercept('http://localhost:5000/wifi/v1/connection_status', (req) => {
req.reply({"wifi": false, "internet": true})
})
cy.intercept('http://localhost:5000/wifi/v1/list_access_points', (req) => {
req.reply({"ssids": [{"ssid": "wifi-home", "conn_type": "WPA2", "strength": 99}]})
})
cy.visit('http://localhost:8080')
cy.get('.v-carousel').should('exist')
cy.get('button.v-app-bar-nav-icon').should('exist').click()
cy.get('a.v-list-item[href*="/settings"]').click()
cy.get('#app').click()
cy.get('button#1').click()
cy.get('input#settings_movement_control_forward_speed').clear().type('99')
cy.get('button.v-app-bar-nav-icon').should('exist').click()
cy.get('a.v-list-item[href*="/control"]').click()
cy.get('#confirm_exit_dialog').should('exist')
})
})