aboutsummaryrefslogtreecommitdiff
path: root/pw_console/testing.rst
blob: 6b615810e384c8f36feb3dcd9088e7f87654f8e4 (plain)
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
.. _module-pw_console-testing:

Manual Test Procedure
=====================

``pw_console`` is a Terminal based user interface which is difficult to
completely test in an automated fashion. Unit tests that don't depend on the
user interface are preferred but not always possible. For those situations
manual tests should be added here to validate expected behavior.

.. contents::
  :local:

Run in Test Mode
----------------

Begin each section below by running the console in test mode:

.. code-block:: shell

  pw console --test-mode

Test Sections
-------------

Log Pane: Basic Actions
^^^^^^^^^^^^^^^^^^^^^^^

.. list-table::
   :widths: 5 45 45 5
   :header-rows: 1

   * - #
     - Test Action
     - Expected Result
     - ✅

   * - 1
     - Click the ``Logs`` window title
     - Log pane is focused
     - |checkbox|

   * - 2
     - Click ``Search`` on the log toolbar
     - | The search bar appears
       | The cursor should appear after the ``/``
     - |checkbox|

   * - 3
     - Press ``Ctrl-c``
     - The search bar disappears
     - |checkbox|

   * - 4
     - Click ``Follow`` on the log toolbar
     - Logs stop following
     - |checkbox|

   * - 5
     - Click ``Table`` on the log toolbar
     - Table mode is disabled
     - |checkbox|

   * - 6
     - Click ``Wrap`` on the log toolbar
     - Line wrapping is enabled
     - |checkbox|

   * - 7
     - Click ``Clear`` on the log toolbar
     - | All log lines are erased
       | Follow mode is on
       | New lines start appearing
     - |checkbox|

Log Pane: Search and Filtering
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. list-table::
   :widths: 5 45 45 5
   :header-rows: 1

   * - #
     - Test Action
     - Expected Result
     - ✅

   * - 1
     - | Click the ``Logs``
       | window title
     - Log pane is focused
     - |checkbox|

   * - 2
     - Press ``/``
     - | The search bar appears
       | The cursor should appear after the ``/``
     - |checkbox|

   * - 3
     - | Type ``lorem``
       | Press ``Enter``
     - | Logs stop following
       | The previous ``Lorem`` word is highlighted in yellow
       | All other ``Lorem`` words are highlighted in cyan
     - |checkbox|

   * - 4
     - Press ``Ctrl-f``
     - | The search bar appears
       | The cursor should appear after the ``/``
     - |checkbox|

   * - 5
     - Click ``Matcher:`` once
     - ``Matcher:STRING`` is shown
     - |checkbox|

   * - 6
     - | Type ``[=``
       | Press ``Enter``
     - All instances of ``[=`` should be highlighted
     - |checkbox|

   * - 7
     - Press ``/``
     - | The search bar appears
       | The cursor should appear after the ``/``
     - |checkbox|

   * - 8
     - Press ``Up``
     - The text ``[=`` should appear in the search input field
     - |checkbox|

   * - 9
     - Click ``Add Filter``
     - | A ``Filters`` toolbar will appear
       | showing the new filter: ``<\[= (X)>``.
       | Only log messages matching ``[=`` appear in the logs.
     - |checkbox|

   * - 10
     - | Press ``/``
       | Type ``# 1``
       | Click ``Add Filter``
     - | The ``Filters`` toolbar shows a new filter: ``<\#\ 1 (X)>``.
       | Only log messages matching both filters will appear in the logs.
     - |checkbox|

   * - 11
     - | Click the first ``(X)``
       | in the filter toolbar.
     - | The ``Filters`` toolbar shows only one filter: ``<\#\ 1 (X)>``.
       | More log messages will appear in the log window
       | Lines all end in: ``# 1.*``
     - |checkbox|

   * - 12
     - Click ``Clear Filters``
     - | The ``Filters`` toolbar will disappear.
       | All log messages will be shown in the log window.
     - |checkbox|

   * - 13
     - | Press ``/``
       | Type ``BAT``
       | Click ``Column``
     - ``Column:Module`` is shown
     - |checkbox|

   * - 14
     - | Click ``Add Filter``
     - | The Filters toolbar appears with one filter: ``<module BAT (X)>``
       | Only logs with Module matching ``BAT`` appear.
     - |checkbox|

   * - 15
     - Click ``Clear Filters``
     - | The ``Filters`` toolbar will disappear.
       | All log messages will be shown in the log window.
     - |checkbox|

   * - 16
     - | Press ``/``
       | Type ``BAT``
       | Click ``Invert``
     - ``[x] Invert`` setting is shown
     - |checkbox|

   * - 17
     - | Click ``Add Filter``
     - | The Filters toolbar appears
       | One filter is shown: ``<NOT module BAT (X)>``
       | Only logs with Modules other than ``BAT`` appear.
     - |checkbox|

Help Windows
^^^^^^^^^^^^

.. list-table::
   :widths: 5 45 45 5
   :header-rows: 1

   * - #
     - Test Action
     - Expected Result
     - ✅

   * - 1
     - Click the :guilabel:`Help > User Guide`
     - | Window appears showing the user guide with
       | RST formatting and syntax highlighting
     - |checkbox|

   * - 2
     - Press :guilabel:`q`
     - Window is hidden
     - |checkbox|

   * - 3
     - Click the :guilabel:`Help > Keyboard Shortcuts`
     - Window appears showing the keybind list
     - |checkbox|

   * - 4
     - Press :guilabel:`q`
     - Window is hidden
     - |checkbox|

   * - 5
     - Click the :guilabel:`Help > Console Test Mode Help`
     - | Window appears showing help with content
       | ``Welcome to the Pigweed Console Test Mode!``
     - |checkbox|

   * - 6
     - Press :guilabel:`q`
     - Window is hidden
     - |checkbox|

Window Management
^^^^^^^^^^^^^^^^^

.. list-table::
   :widths: 5 45 45 5
   :header-rows: 1

   * - #
     - Test Action
     - Expected Result
     - ✅

   * - 1
     - | Click the :guilabel:`Logs` window title
     - Log pane is focused
     - |checkbox|

   * - 2
     - | Click the menu :guilabel:`Windows > 1: Logs fake_device.1`
       | Click :guilabel:`Duplicate pane`
     - | 3 panes are visible:
       | Log pane on top
       | Repl pane in the middle
       | Log pane on the bottom
     - |checkbox|

   * - 3
     - | Click the :guilabel:`Python Input` window title
     - Python Input pane is focused
     - |checkbox|

   * - 4
     - Click the :guilabel:`View > Move Window Down`
     - | 3 panes are visible:
       | Log pane on top
       | Log pane in the middle
       | Repl pane on the bottom
     - |checkbox|

   * - 5
     - Click the :guilabel:`View > Move Window Down` again
     - | Nothing changes
       | Windows remain in the same order
     - |checkbox|

   * - 6
     - Click the :guilabel:`View > Move Window Up`
     - | 3 panes are visible:
       | Log pane on top
       | Repl pane in the middle
       | Log pane on the bottom
     - |checkbox|

   * - 7
     - | Click the menu :guilabel:`Windows > 1: Logs fake_device.1`
       | Click :guilabel:`Remove pane`
     - | 2 panes are visible:
       | Repl pane on the top
       | Log pane on bottom
     - |checkbox|

   * - 8
     - | Click the :guilabel:`Python Input`
       | window title
     - Repl pane is focused
     - |checkbox|

   * - 9
     - | Hold the keys :guilabel:`Alt- -`
       | `Alt` and `Minus`
     - Repl pane shrinks
     - |checkbox|

   * - 10
     - Hold the keys :guilabel:`Alt-=`
     - Repl pane enlarges
     - |checkbox|

   * - 11
     - | Click the menu :guilabel:`Windows > 1: Logs fake_device.1`
       | Click :guilabel:`Duplicate pane`
     - | 3 panes are visible:
       | 2 Log panes on the left
       | Repl pane on the right
     - |checkbox|

   * - 12
     - | Click the left top :guilabel:`Logs` window title
     - Log pane is focused
     - |checkbox|

   * - 13
     - Click the :guilabel:`View > Move Window Right`
     - | 3 panes are visible:
       | 1 Log panes on the left
       | 1 Log and Repl pane on the right
     - |checkbox|

   * - 14
     - | Click the menu :guilabel:`Windows > Column 2 View Modes`
       | Then click :guilabel:`[ ] Tabbed Windows`
     - | 2 panes are visible:
       | 1 Log panes on the left
       | 1 Log panes on the right
       | A tab bar on the top of the right side
       | `Logs fake_device.1` is highlighted
     - |checkbox|

   * - 15
     - | On the right side tab bar
       | Click :guilabel:`Python Repl`
     - | 2 panes are visible:
       | 1 Log pane on the left
       | 1 Repl pane on the right
       | `Python Repl` is highlighted
       | on the tab bar
     - |checkbox|

Copy Paste
^^^^^^^^^^

.. list-table::
   :widths: 5 45 45 5
   :header-rows: 1

   * - #
     - Test Action
     - Expected Result
     - ✅

   * - 1
     - | Click the :guilabel:`Logs` window title
     - Log pane is focused
     - |checkbox|

   * - 2
     - | Click the menu
       | :guilabel:`[Edit] > Copy visible lines from active window`
       | Try pasting into a separate text editor
     - | Log lines like this:
       | ``20210729 18:31:32  INF  USB Log message ...``
       | Are in the system clipboard
     - |checkbox|

   * - 3
     - | Copy this text in your browser or
       | text editor to the system clipboard:
       | ``print('copy paste test!')``
     - | Click the :guilabel:`Python Input` window title
       | Press :guilabel:`Ctrl-v`
       | ``print('copy paste test!')`` appears
       | after the prompt.
     - |checkbox|

   * - 4
     - Press :guilabel:`Enter`
     - | This appears in Python Results:
       | ``In [1]: print('copy paste test!')``
       | ``copy paste test!``
     - |checkbox|

   * - 5
     - | Click :guilabel:`Ctrl-Alt-c -> Copy Output`
       | on the Python Results toolbar
       | Try pasting into a separate text editor
     - | The contents of the Python Results
       | are in the system clipboard.
     - |checkbox|

   * - 6
     - Click the :guilabel:`Python Results` window title
     - | Python Results is focused with cursor
       | appearing below the last line
     - |checkbox|

   * - 7
     - | Click and drag over ``copy paste text``
       | highlighting won't appear until
       | after the mouse button is released
     - | ``copy paste text`` is highlighted
     - |checkbox|

   * - 8
     - | Press :guilabel:`Ctrl-c`
       | Try pasting into a separate text editor
     - | ``copy paste text`` should appear (and is
       | in the system clipboard)
     - |checkbox|

   * - 9
     - Click the :guilabel:`Python Input` window title
     - Python Input is focused
     - |checkbox|

Incremental Stdout
^^^^^^^^^^^^^^^^^^

.. list-table::
   :widths: 5 45 45 5
   :header-rows: 1

   * - #
     - Test Action
     - Expected Result
     - ✅

   * - 1
     - | Click the :guilabel:`Python Input` window title
     - Python Input pane is focused
     - |checkbox|

   * - 2
     - | Enter the following text and hit enter twice
       | ``import time``
       | ``for i in range(10):``
       | ``print(i); time.sleep(1)``
     - | ``Running...`` should appear in the python with
       | increasing integers incrementally appearing above
       | (not all at once after a delay).
     - |checkbox|

Python Input & Output
^^^^^^^^^^^^^^^^^^^^^

.. list-table::
   :widths: 5 45 45 5
   :header-rows: 1

   * - #
     - Test Action
     - Expected Result
     - ✅

   * - 1
     - Click the ``Python Input`` window title
     - Python Input pane is focused
     - |checkbox|

   * - 2
     - | Enter the following text and press enter to run
       | ``[i for i in __builtins__ if not i.startswith('_')]``
     - | The results should appear pretty printed
       | with each list element on it's own line:
       |
       |   >>> [i for i in __builtins__ if not i.startswith('_')]
       |   [ 'abs',
       |     'all',
       |     'any',
       |     'ascii'
       |
     - |checkbox|

Add note to the commit message
------------------------------

Add a ``Testing:`` line to your commit message and mention the steps
executed. For example:

.. code-block:: text

   Testing: Log Pane Steps 1-6

.. |checkbox| raw:: html

    <input type="checkbox">