From 52e1a2001482e13e41e7b6697d578de4629e71f0 Mon Sep 17 00:00:00 2001 From: Maurice Makaay Date: Wed, 21 Apr 2021 13:58:10 +0200 Subject: [PATCH] Added a test plan to the documentation. I use this test plan to check for regression, before releasing new versions of the code. --- doc/example.yaml | 9 +++--- doc/testplan.md | 72 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 5 deletions(-) create mode 100644 doc/testplan.md diff --git a/doc/example.yaml b/doc/example.yaml index ffefd90..dd0ad7e 100644 --- a/doc/example.yaml +++ b/doc/example.yaml @@ -138,15 +138,14 @@ output: id: ${id_front_panel_illumination} # Binary sensors can be created for handling front panel touch / release -# events. To specify what part of the front panel to look at, the "part" -# parameter can be set to: "any" (i.e. the default), "POWER_BUTTON", -# "COLOR_BUTTON" or "SLIDER". +# events. To specify what part of the front panel to look at, the "for" +# parameter can be set to: "POWER_BUTTON", "COLOR_BUTTON" or "SLIDER". binary_sensor: # When tapping the power button, toggle the light. # When holding the power button, turn on night light mode. - platform: xiaomi_bslamp2 id: ${id_power_button} - part: POWER_BUTTON + for: POWER_BUTTON on_multi_click: - timing: - ON for at most 0.8s @@ -166,7 +165,7 @@ binary_sensor: # When holding the color button, activate the next preset group. - platform: xiaomi_bslamp2 id: ${id_color_button} - part: COLOR_BUTTON + for: COLOR_BUTTON on_multi_click: - timing: - ON for at most 0.6s diff --git a/doc/testplan.md b/doc/testplan.md new file mode 100644 index 0000000..5e6ad4a --- /dev/null +++ b/doc/testplan.md @@ -0,0 +1,72 @@ +# Testplan + +This is the test plan that I follow for every release. +I use it to ensure that no regression has been introduced. + + +## Step 1: Preparation - build and flash the firmware + +* Use the latest stable release for ESPHome (to make sure that my code + builds and works with that release). In my clone I make sure that I + checked out the master branch and that it's up-to-date with the origin. + +* Remove the cached framework package: + `/bin/rm -fR ~/.platformio/packages/framework-arduinoespressif32` + +* Copy `doc/example.yaml` to a clean build directory, and update the + first two sections for the local setup (substitutions, wifi, api, ota). + +* Use `esphome example.yaml compile` to build the code. + +* Upload this code to the lamp. + + +## Step 2: Perform the tests + +* Touch the power button --> the light must turn on. + +* Touch the power button again --> the light must turn off. + +* Touch the slider at any level --> the light must turn on, using the + level at which the slider was touched as the brightness. The front panel + illumination is turned on and shows the brightness level. + +* Touch the slider at various points and touch the slider while moving your + finger up and down --> the brightness of the light and the brightness + level on the front panel must follow the touches. + +* Touch and hold the power button --> the light must go into "night light" + mode. This means that it will become very dim. The front panel + illumination must be turned off. + +* Touch the slider at a random level --> the light must go back to its + normal brightness levels and the front panel illumination must be turned + on again. + +* Touch the color button a few times in a row --> the light must loop through + the various preset light colors. + +* Touch and hold the color button --> the light must switch to a different + preset group. There are two groups: one with rgb colors and one with white + light colors, and holding the color button will switch between these two. + +* Touch the color button to select a light color, long touch it to switch to + the other preset group, then long touch again to switch the preset group + again -> the lamp must remember what light colors were active within the + preset groups. If the red preset was selected, you switch to the white + light group, select a different white preset and then go back to the rgb + presets, then the light must become red again. + +* Go to Home Assistant and check: + * if you can turn on/off the lamp + * if you can select colors from the RGB color model + * if you can select colors from the white light color temperature model + * if you can set the brightness of the lamp + * if selecting the lowest possible brightness results in the lamp + switching to "night light" mode + + +## Step 3: Release the new version + +Only after performing these tests successfully, the new version can be +released.