Manual Test Procedure#

pw_console: Multi-purpose pluggable interactive console for dev & manufacturing

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.

Run in Test Mode#

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

touch /tmp/empty.yaml
env PW_CONSOLE_CONFIG_FILE='/tmp/empty.yaml' pw console --test-mode

Test Sections#

Log Pane: Basic Actions#

#

Test Action

Expected Result

1

Click the Fake Device window title

Log pane is focused

2

In the main menu enable [File] > Log Table View > Hide Date

The time column shows only the time. E.g. 09:34:53.

3

In the main menu turn off [File] > Log Table View > Hide Date

The time column shows the date and time. E.g. 20220208 09:34:53.

4

Click Search on the log toolbar

The search bar appears
The cursor should appear after the /

5

Press Ctrl-c

The search bar disappears

6

Click Follow on the log toolbar

Logs stop following

7

Click Table on the log toolbar

Table mode is disabled

8

Click Wrap on the log toolbar

Line wrapping is enabled

9

Click Clear on the log toolbar

All log lines are erased
Follow mode is on
New lines start appearing

10

Mouse drag across a few log messages
Entire logs are highlighted and a dialog
box appears in the upper right

11

Without scrolling mouse drag across a set
of different log messages.
The old selection disappears leaving only the new selection.

12

Click the Cancel button
in the selection dialog box.
The selection and the dialog box disappears.

13

Mouse drag across a few log messages and
click the Save as File button.
The save as file dialog appears with the
[x] Selected Lines Only opion checked.

14

Press Cancel
The save dialog closes

15

Click the Save button on the log toolbar.
A dialog appears prompting for a file.
The current working directory should be pre-filled.

16

Check [x] Table Formatting
Uncheck [ ] Selected Lines Only
Add /log.txt to the end and press Enter
Click the menu [File] > Exit
In the terminal run cat log.txt to verify logs
were saved correctly.

Log Pane: Search and Filtering#

#

Test Action

Expected Result

1

Click the Fake Device window title

Log pane is focused

2

Press /

The search bar appears
The cursor should appear after the /

3

Type lorem
Press Enter
Logs stop following
Lorem words are highlighted in cyan
The cursor on the first log message
The search toolbar is un-focused and displays:
Match 1 / 10 where the second number (the total match count)
increases once every 10 seconds when new logs arrive.

4

Press Ctrl-f

The search bar is focused
The cursor should appear after /Lorem

5

Press Ctrl-c

The search bar disappears
Lorem words are no longer highlighted

6

Press /

The search bar appears and is empty
The cursor should appear after /

7

Click Matcher: once

Matcher:STRING is shown

8

Type [=
Press Enter
All instances of [= should be highlighted
The cursor should be on log message 2

7

Press /

The search bar is focused
The cursor should appear after the /[=

8

Press Ctrl-c

The search bar disappears
[= matches are no longer highlighted

9

Press /

The search bar appears and is empty
The cursor should appear after /

10

Press Up

The text [= should appear in the search input field

11

Click Search Enter

All instances of [= should be highlighted
The cursor should be on log message 12

12

Click Add Filter

A Filters toolbar will appear
showing the new filter: <\[= (X)>.
Only log messages matching [= appear in the logs.
Follow mode is enabled

13

Press /
The search bar appears and is empty
The cursor should appear after /

14

Type # 1 and press Enter
Click Add Filter
The Filters toolbar shows a new filter: <\#\ 1 (X)>.
Only log messages matching both filters will appear in the logs.

15

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.*

16

Click Clear Filters

The Filters toolbar will disappear.
All log messages will be shown in the log window.

17

Press /
Type BAT
Click Column until Column:Module is shown
Press Enter
Logs stop following
BAT is highlighted in cyan
The cursor on the 3rd log message
The search toolbar is un-focused and displays:
Match 1 / 10 where the second number (the total match count)

18

Press n

BAT is highlighted in cyan
The cursor on the 7th log message and is in the center of the
log window (not the bottom).

19

Click Jump to new matches

Jump to new matches is checked and every 5 seconds
the cursor jumps to the latest matching log message.

20

Click Follow

Jump to new matches is unchecked
The cursor jumps to every new log message once a second.

21

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

22

Click Clear Filters

The Filters toolbar will disappear.
All log messages will be shown in the log window.

23

Press /
Type BAT
Click Invert

[x] Invert setting is shown

24

Press Enter then click Add Filter
The Filters toolbar appears
One filter is shown: <NOT module BAT (X)>
Only logs with Modules other than BAT appear.

Help Windows#

#

Test Action

Expected Result

1

Click the [Help] > User Guide

Window appears showing the user guide with
RST formatting and syntax highlighting

2

Press q

Window is hidden

3

Click the [Help] > Keyboard Shortcuts

Window appears showing the keybind list

4

Press F1

Window is hidden

5

Click the [Help] > Console Test Mode Help

Window appears showing help with content
Welcome to the Pigweed Console Test Mode!

6

Click the Close q button.

Window is hidden

Floating Windows#

#

Test Action

Expected Result

1

Start pw-console --test-mode press Ctrl-p

The Menu Items command runner dialog appears.

2

Type exit and press enter.

The console exits.

3

Restart pw-console but without the --test-mode option.

Console starts up with ONLY the Python Results and Repl windows.

4

Press Ctrl-p

The Menu Items command runner dialog appears.

Window Management#

#

Test Action

Expected Result

1

Click the Fake Device window title

Log pane is focused

2

Click the menu Windows > #: Fake Device…
Click Duplicate pane
3 panes are visible:
Log pane on top
Repl pane in the middle
Log pane on the bottom

3

Click the Python Repl window title

Python Repl pane is focused

4

Click the View > Move Window Down

3 panes are visible:
Log pane on top
Log pane in the middle
Repl pane on the bottom

5

Click the View > Move Window Down again

Nothing changes
Windows remain in the same order

6

Click the View > Move Window Up

3 panes are visible:
Log pane on top
Repl pane in the middle
Log pane on the bottom

7

Click the menu Windows > #: Fake Device…
Click Remove pane
2 panes are visible:
Repl pane on the top
Log pane on bottom

8

Click the Python Repl
window title

Repl pane is focused

9

Hold the keys Alt- -
Alt and Minus

Repl pane shrinks

10

Hold the keys Alt-=

Repl pane enlarges

11

Click the menu Windows > 1: Logs fake_device.1
Click Duplicate pane
3 panes are visible:
2 Log panes on the left
Repl pane on the right

12

Click the left top Logs window title

Log pane is focused

13

Click the View > Move Window Right

3 panes are visible:
1 Log panes on the left
1 Log and Repl pane on the right

14

Click the menu Windows > Column 2 View Modes
Then click [ ] 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

15

On the right side tab bar
Click 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

Mouse Window Resizing#

#

Test Action

Expected Result

1

Click the Fake Device window

Log pane is focused

2

Left click and hold the -==- of that window
Drag the mouse up and down

This log pane is resized

3

Left click and hold the -==-
of the PwConsole Debug window
Drag the mouse up and down
The PwConsole Debug should NOT be focused
The window should be resized as expected

4

Click the View > Move Window Right

Fake Device should appear in a right side split

5

Left click and hold anywhere on the vertical separator
Drag the mouse left and right
The window splits should be resized as expected

6

Click the View > Balance Window Sizes

Window split sizes should reset to equal widths

7

Focus on the Python Repl window
Click the View > Move Window Left
Python Repl should appear in a left side split
There should be 3 vertical splits in total

8

Left click and hold anywhere on the vertical separator
between the first two splits (Python Repl and the middle split)
Drag the mouse left and right
The first two window splits should be resized.
The 3rd split size should not change.

Copy Paste#

#

Test Action

Expected Result

1

Click the Fake Device window title

Log pane is focused

2

Mouse drag across a few log messages
A dialog appears in the upper right showing
the number of lines selected and
buttons for Cancel, Select All,
Save as File, and Copy.

3

Click the Copy button
Try pasting into a separate text editor
Log lines like this should be pasted:
20:07:25  INF  APP    Log message [    =     ] # 25
20:07:25  INF  RADIO  Log message [     =    ] # 26

4

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

5

Press Enter

This appears in Python Results:
In [1]: print('copy paste test!')
copy paste test!

6

Click 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.

7

Click the Python Results window title

Python Results is focused with cursor
appearing below the last line

8

Click and drag over copy paste text
highlighting won’t appear until
after the mouse button is released
copy paste text is highlighted

9

Press Ctrl-c
Try pasting into a separate text editor
copy paste text should appear (and is
in the system clipboard)

10

Click the Python Repl window title

Python Repl is focused

11

Type print('hello there') into the Python input.
Mouse drag select that text
Press Ctrl-c
The selection should disappear.
Try pasting into a separate text editor, the paste should
match the text you drag selected.

Incremental Stdout#

#

Test Action

Expected Result

1

Click the Python Repl window title

Python Repl pane is focused

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).

Python Repl & Output#

#

Test Action

Expected Result

1

Click the Logs window title

Log pane is focused

2

Click empty whitespace in the Python Results window

Python Results pane is focused

3

Click empty whitespace in the Python Repl window

Python Repl pane is focused

4

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’

5

Enter the following text and press Enter to run
locals()
The results should appear pretty printed

6

Enter the following text and press Enter to run
zzzz = 'test'
No new results are shown
The previous locals() output does not show 'zzzz': 'test'

7

Enter the following text and press Enter to run
locals()
The output ends with 'zzzz': 'test'}

8

With the cursor over the Python Results,
use the mouse wheel to scroll up and down.
The output window should be able to scroll all
the way to the beginning and end of the buffer.

9

Click empty whitespace in the Python Repl window

Python Repl pane is focused

10

Enter the following text and press Enter to run
!ls
1. Shell output of running the ls command should appear in the
results window.
2. A new log window pane should appear titled Shell Output.
3. The Shell Output window should show the command that was run and the
output:
$ ls
activate.bat
activate.sh

Web Log Viewer#

#

Test Action

Expected Result

1

Start the pw console test mode by
running pw console --test-mode
Console starts up showing an Fake Device window.

2

Focus on Fake Device panel and press Shift-o to enable web log viewer
This should hide log stream in the console and automatically copy the
URL to log viewer to the clipboard

3

Focus on the Fake Keys panel with a filter applied. Then press
Shift-o to enable another web log viewer for that new pane. Open the
new URL in Chrome
This log viewer should have filters pre-applied

4

Press Shift-o again on both log panes to disable web log view
This should re-enable log stream in console and stop streaming logs to
web view

Early Startup#

#

Test Action

Expected Result

1

Start the pw console test mode by
running pw console --test-mode
Console starts up showing an All Logs window.

2

Click the All Logs window title
Press g to jump to the top of the log history
These log messages should be at the top:
DBG Adding plugins...
DBG Starting prompt_toolkit full-screen application...
DBG pw_console test-mode starting...
DBG pw_console.PwConsoleEmbed init complete

Quit Confirmation Dialog#

#

Test Action

Expected Result

1

Press Ctrl-d
The quit dialog appears

2

Press n
The quit dialog disappears

3

Press Ctrl-d
The quit dialog appears

4

Press y
The console exits

5

Restart the console and
Press Ctrl-d twice in quick succession.
The console exits

6

Restart the console and Press F1
The help window appears

7

Press Ctrl-d
The quit dialog appears on top of the help window

8

Press n
The quit dialog disappears and the help window is
back in focus.

9

Press q
The help window disappears and the Python Repl is in focus.

10

Type some text into the Python Repl.
Press Home or move the cursor to the
beginning of the text you just entered.
Press Ctrl-d
Each Ctrl-d press deletes one character

11

Press Ctrl-c to clear the Python Repl text
Press Ctrl-d
The quit dialog appears.

Add note to the commit message#

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

Testing: Log Pane Steps 1-6