Skip to content

Commit 6811824

Browse files
Improve ui-test video
1 parent f1a2ae1 commit 6811824

File tree

4 files changed

+34
-57
lines changed

4 files changed

+34
-57
lines changed

src/spec/demoVideo.ts

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { disconnect } from './scenarios/disconnect'
1212
import { publishTopic } from './scenarios/publishTopic'
1313
import { SceneBuilder } from './SceneBuilder'
1414
import { showAdvancedConnectionSettings } from './scenarios/showAdvancedConnectionSettings'
15-
import { showJsonFormatting } from './scenarios/showJsonFormatting'
1615
import { showJsonPreview } from './scenarios/showJsonPreview'
1716
import { showMenu } from './scenarios/showMenu'
1817
import { showNumericPlot } from './scenarios/showNumericPlot'
@@ -59,11 +58,11 @@ async function doStuff() {
5958
const scenes = new SceneBuilder()
6059
await scenes.record('connect', async () => {
6160
await connectTo('127.0.0.1', browser)
62-
await sleep(2000)
61+
await sleep(1000)
6362
})
6463

6564
await scenes.record('numeric_plots', async () => {
66-
await showText('Plot topic history', 2000, browser)
65+
await showText('Plot topic history', 1500, browser)
6766
await showNumericPlot(browser)
6867
await sleep(2000)
6968
})
@@ -80,20 +79,14 @@ async function doStuff() {
8079
})
8180

8281
await scenes.record('publish_topic', async () => {
83-
await showText('Publish topics', 2000, browser, 'top')
82+
await showText('Publish topics', 1500, browser, 'top')
8483
await clickOnHistory(browser)
8584
await publishTopic(browser)
8685
await sleep(1000)
8786
})
8887

89-
await scenes.record('json_formatting_publish', async () => {
90-
await showText('Write JSON with ease', 2000, browser, 'top')
91-
await showJsonFormatting(browser)
92-
await sleep(1000)
93-
})
94-
9588
await scenes.record('clipboard', async () => {
96-
await showText('Copy to Clipboard', 2000, browser)
89+
await showText('Copy to Clipboard', 1500, browser)
9790
await copyTopicToClipboard(browser)
9891
await hideText(browser)
9992
await copyValueToClipboard(browser)
@@ -112,25 +105,25 @@ async function doStuff() {
112105

113106
await scenes.record('delete_retained_topics', async () => {
114107
await hideText(browser)
115-
await showText('Delete retained topics', 0, browser)
108+
await showText('Delete retained topics', 5000, browser)
116109
await clearOldTopics(browser)
117110
await hideText(browser)
118111
})
119112

120113
await scenes.record('settings', async () => {
121-
await showText('Display Options', 2000, browser)
114+
await showText('Settings', 1500, browser)
122115
await showMenu(browser)
123116
})
124117

125118
await scenes.record('customize_subscriptions', async () => {
126119
await sleep(2000)
127120
await disconnect(browser)
128-
await showText('Customize Subscriptions', 1000, browser, 'top')
121+
await showText('Customize Subscriptions', 1500, browser, 'top')
129122
await showAdvancedConnectionSettings(browser)
130123
})
131124

132125
await scenes.record('keyboard_shortcuts', async () => {
133-
await showText('Keyboard shortcuts', 1750, browser, 'middle')
126+
await showText('Keyboard shortcuts', 1500, browser, 'middle')
134127
await sleep(1750)
135128
await showZoomLevel(browser)
136129
})

src/spec/mock-mqtt.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ function generateData(client: mqtt.MqttClient) {
5252
retain: true,
5353
qos: 0,
5454
})
55-
intervals.push(setInterval(() => client.publish('livingroom/temperature', temperature()), 1000))
55+
intervals.push(
56+
setInterval(() => client.publish('livingroom/temperature', temperature(), { retain: true, qos: 0 }), 1000)
57+
)
5658
intervals.push(setInterval(() => client.publish('livingroom/humidity', temperature(60, -2, 0)), 1000))
5759

5860
client.publish('livingroom/lamp-1/state', 'on', { retain: true, qos: 0 })
@@ -72,7 +74,7 @@ function generateData(client: mqtt.MqttClient) {
7274
if (topic === 'kitchen/lamp/set') {
7375
setTimeout(
7476
() =>
75-
client.publish('kitchen/lamp/state', payload, {
77+
client.publish('kitchen/lamp/state', JSON.parse(payload.toString()).state, {
7678
retain: true,
7779
qos: 0,
7880
}),
@@ -96,8 +98,12 @@ function generateData(client: mqtt.MqttClient) {
9698
}, 1500)
9799
)
98100

99-
intervals.push(setInterval(() => client.publish('kitchen/temperature', temperature()), 1500))
100-
intervals.push(setInterval(() => client.publish('kitchen/humidity', temperature(60, -5, 0)), 1800))
101+
intervals.push(
102+
setInterval(() => client.publish('kitchen/temperature', temperature(), { retain: true, qos: 0 }), 1500)
103+
)
104+
intervals.push(
105+
setInterval(() => client.publish('kitchen/humidity', temperature(60, -5, 0), { retain: true, qos: 0 }), 1800)
106+
)
101107

102108
client.publish('garden/pump/state', 'off', { retain: true, qos: 0 })
103109
client.publish('garden/water/level', '70%', { retain: true, qos: 0 })

src/spec/scenarios/publishTopic.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,27 @@ export async function publishTopic(browser: Browser) {
1717
await writeText('set', browser, 300)
1818

1919
const payloadInput = await browser.$('//*[contains(@class, "ace_text-input")]')
20-
await payloadInput.setValue('o')
21-
await sleep(300)
22-
await payloadInput.setValue('n')
23-
await sleep(700)
20+
await writeTextPayload(payloadInput, '{"action": "setState", "state": "on" }')
21+
22+
await sleep(500)
23+
const formatJsonButton = await browser.$('#sidebar-publish-format-json')
24+
await clickOn(formatJsonButton, browser)
2425

2526
const publishButton = await browser.$('#publish-button')
2627
await moveToCenterOfElement(publishButton, browser)
2728
await showText('Lamp turns on', 1000, browser, 'top')
2829
await sleep(500)
2930

3031
await clickOn(publishButton, browser)
32+
33+
const sidebarDrawer = await browser.$('#Sidebar')
34+
await sidebarDrawer.scrollIntoView()
35+
}
36+
37+
async function writeTextPayload(payloadInput: any, text: string) {
38+
const chars = text.split('')
39+
for (const char of chars) {
40+
await payloadInput.setValue(char)
41+
await sleep(10)
42+
}
3143
}

src/spec/scenarios/showJsonFormatting.ts

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)