Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2991: E2E tests, workflow and bench control (v0.1) #2141

Draft
wants to merge 149 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
149 commits
Select commit Hold shift + click to select a range
b4bc91f
2991: first part of integrating e2e tests, needs gitignore and new wo…
doomwastaken Dec 16, 2022
8842b0d
Merge branch 'dev' into doom/2991-e2e-runner
Jan 19, 2023
e38c5a0
Merge branch 'dev' into doom/2991-e2e-runner
doomwastaken Feb 9, 2023
78a369d
added protobuf_py submodule to scripts/flippigator
doomwastaken Feb 9, 2023
9220211
Repair for tests (RC 0.77)
Hellitron Feb 10, 2023
826415b
Fixed NFC tests (new pict, new menu items)
Hellitron Feb 10, 2023
ca6338f
Add skipping bench test and recognition lists
Hellitron Feb 14, 2023
a18793e
Added cards and tests for NFC with bench
Hellitron Feb 16, 2023
d0ee5d5
Fix tests for RC 0.78.1
Hellitron Feb 28, 2023
bd2f5f9
Merge branch 'dev' into doom/2991-e2e-runner
Mar 1, 2023
382bcaf
Added keyboard implementation
Mar 2, 2023
128f69d
smoke_tests.yml basic version for validation
Mar 13, 2023
007eac4
Merge branch 'dev' into doom/2991-e2e-runner
Mar 13, 2023
5ee030c
Merge branch 'doom/2991-e2e-runner' of github.com:flipperdevices/flip…
Mar 13, 2023
69212c8
black and isort, triggering smoke re-run
Mar 13, 2023
0eeb8bd
removed comments, fixed name, added pwd to blank steps
Mar 13, 2023
dcaf774
fixed requirements for black / fixed submodule
Mar 13, 2023
d24aef7
experimenting with requirements: numpy for protobuf and opencv for fi…
Mar 13, 2023
dbe40c8
upgraded numpy version for python 3.11.2 support in fbt, protobuf_py …
Mar 13, 2023
5120ee7
removed pyreadline, since it is windows only requirement for protobuf
Mar 13, 2023
142e48c
conflict in pyreadline version
Mar 13, 2023
ca1812a
conflict in pyreadline version2
Mar 13, 2023
b068eed
pyreadline==1.7.1
Mar 13, 2023
74715b9
removed pyreadline, restoring toolchain
Mar 13, 2023
f440fe5
fixing restoration of toolchain
Mar 13, 2023
3006ee4
changed venv for code, fixed requirements for python 3.10.2 (minimal)…
Mar 14, 2023
f20e690
added temp fix for fbt and added deactivation of the fbt python env
Mar 14, 2023
14fe516
removed env entirely
Mar 14, 2023
4ead236
fixed pytest run command
Mar 14, 2023
0fbaec0
changed protobuf version, removed gui from pytest command
Mar 14, 2023
619d786
added headless version of opencv and fixed yml
Mar 14, 2023
c236de5
trying adding readline
Mar 14, 2023
c87d961
Added Wiegand reader implementation
Hellitron Mar 16, 2023
24b9106
added dockerfile example
Mar 20, 2023
99f1b73
merged dev
Mar 20, 2023
72b3650
fixed docker requirements, fixed docker folder
Mar 20, 2023
d674c67
removed autouse from pytest and added temporary image name for docker
Mar 20, 2023
6a9c667
removed usb bus and privileged docker mode, tests working now
Mar 20, 2023
0c774f1
removed interactive mode from docker
Mar 20, 2023
cebe55b
Added tests of NFC emulation with reader
Hellitron Mar 21, 2023
85b7436
optimized smoke_test.yml, fixed branch in dockerfile
doomwastaken Mar 22, 2023
d37ceb2
removed -r pytest flag and fixed serial of the programmer
doomwastaken Mar 22, 2023
d814507
fixed tty/acm0 typo
doomwastaken Mar 22, 2023
a08a839
Merge branch 'dev' into doom/2991-e2e-runner
doomwastaken Mar 22, 2023
03067cf
added new decontamination and added different device passthrough
doomwastaken Mar 22, 2023
9e43fb0
debug output for dockerfile
doomwastaken Mar 22, 2023
73edfcc
copying all folders, since tests are not collecting
doomwastaken Mar 22, 2023
310ecb9
dockerfile blind test, add instead of copy, even though it should be …
doomwastaken Mar 22, 2023
a7849e2
forgot -- @port, I need to sleep more
doomwastaken Mar 22, 2023
782616a
expanded smoke workflow, added flashing ext, build cleanup, timeouts,…
doomwastaken Mar 22, 2023
1f1a2be
Merge branch 'dev' into doom/2991-e2e-runner
doomwastaken Mar 22, 2023
0715f0d
added reboot before flashing
doomwastaken Mar 22, 2023
0e23738
Merge branch 'doom/2991-e2e-runner' of github.com:flipperdevices/flip…
doomwastaken Mar 22, 2023
d444b15
Repaired tests, added browser implement
Hellitron Mar 22, 2023
6619fa8
Merge branch 'doom/2991-e2e-runner' of https://github.com/flipperdevi…
Hellitron Mar 22, 2023
9af8226
Removed card formatting from start up
Hellitron Mar 22, 2023
c14b692
Fixed wrong IButton Class name
Hellitron Mar 22, 2023
aca1c2d
linter and gitignore for testing framework
doomwastaken Mar 22, 2023
991fc8a
removed redundant restart and changed decontamination version
doomwastaken Mar 22, 2023
b07b218
updating protobuf
doomwastaken Mar 22, 2023
5c97915
Merge branch 'dev' into doom/2991-e2e-runner
doomwastaken Mar 22, 2023
ddca35d
another protobuf_py update, removed pylint to pass linter check
doomwastaken Mar 22, 2023
a05ff20
increased run_smoke step timeout to 10 minutes, current tests 5+ minu…
doomwastaken Mar 23, 2023
6f6c9ce
NFC tests works via file browser
Hellitron Mar 23, 2023
6bad98e
Merge remote-tracking branch 'origin/doom/2991-e2e-runner' into doom/…
Hellitron Mar 24, 2023
bde1d6e
format_py, removed failed / recognition failed images and expanded gi…
Mar 24, 2023
bd9362b
refactored application test and updated BTIcon to prevent false reads
Mar 24, 2023
7494900
Add RFID tests with reader, fix detect corners visualization
Hellitron Mar 24, 2023
a89e59a
new mark for smoke tests, minor refactor example, added trigger on de…
Mar 27, 2023
dcfa8b4
Add EM4100 and HID cards to RFID tests
Hellitron Mar 28, 2023
07eb2a3
Merge branch 'dev' into doom/2991-e2e-runner
doomwastaken Mar 30, 2023
afb191a
Merge branch 'dev' into doom/2991-e2e-runner
skotopes Apr 6, 2023
9886590
added AVR flasher reference to application tests
Apr 6, 2023
687012a
Merge branch 'dev' into doom/2991-e2e-runner
doomwastaken Apr 6, 2023
3d8cd84
Merge branch 'dev' into doom/2991-e2e-runner
Apr 10, 2023
9338e78
Fixed smoke tests
Hellitron Apr 12, 2023
15d0504
Ibutton bench test infrastructure draft
Hellitron Apr 12, 2023
e2473b6
IButton implementation
Hellitron Apr 13, 2023
ec77535
Merge branch 'dev' into doom/2991-e2e-runner
Apr 25, 2023
0d679a9
IButton keys and fixes
Hellitron Apr 25, 2023
6ca1f6a
merged branches, added two different reader types and relay, minor re…
Apr 25, 2023
f72e3b9
fixed typos and merge conflicts, removed recognition images according…
Apr 25, 2023
e6bd06f
Added logging, removed prints
May 5, 2023
dd44747
Repair logs, moved some debug to info logs
Hellitron May 18, 2023
4596f9d
merged branches, now has logging and removed termcolor
May 18, 2023
5cfebc4
Merge branch 'dev' into doom/2991-e2e-runner
May 18, 2023
9d525dd
typo in rfid
May 18, 2023
eac7b96
Added "Honeywell Nextwatch" to RFID-Add Manually menu
Hellitron May 30, 2023
50c67a1
Merge remote-tracking branch 'origin/doom/2991-e2e-runner' into doom/…
Hellitron May 30, 2023
35c3e92
Added new NFC->Extra actions. Removed exception "recognition timeout"…
Hellitron Jun 8, 2023
2a94ec3
Merge branch 'dev' into doom/2991-e2e-runner
Jun 29, 2023
ba08bb3
increased timeouts, again, again and again
Jun 29, 2023
3295850
minor tweaks
Jun 29, 2023
bea5786
lint changes and typo
Jun 29, 2023
78589cf
Updated test for RC 0.86.0
Hellitron Jul 3, 2023
84a2209
Merge remote-tracking branch 'origin/doom/2991-e2e-runner' into doom/…
Hellitron Jul 3, 2023
af06983
Update to last Dev, added script for creating all NFC cards from "Add…
Hellitron Jul 10, 2023
2d40ab0
Some minor fixes for Windows
Hellitron Jul 28, 2023
d420475
lint python + dev merge
Jul 31, 2023
f84e3ad
added protobuf, forgotten during dev merge
Jul 31, 2023
71ba38e
fixed subghz test and apps test
Jul 31, 2023
a07a97b
minor typos
Jul 31, 2023
5c65c86
Changed Apps icon reference, small change in test applications, remov…
ImagineVagon333 Aug 7, 2023
41e101f
Merge branch 'dev' into doom/2991-e2e-runner
Aug 7, 2023
20098b0
increased timeouts, merged dev
Aug 7, 2023
d85e065
merged dev
Aug 24, 2023
b6bd764
Merge branch 'dev' into doom/2991-e2e-runner
Sep 4, 2023
cf75d44
Fix "Apps" ref
Hellitron Sep 21, 2023
193d113
Merge branch 'dev' into doom/2991-e2e-runner
Sep 25, 2023
3f9354f
Revert "Fix "Apps" ref"
Sep 25, 2023
3bf60f6
Merge remote-tracking branch 'origin/dev' into doom/2991-e2e-runner
Sep 26, 2023
0be323d
Merge branch 'dev' into doom/2991-e2e-runner
Oct 3, 2023
8e19907
Merge branch 'dev' into doom/2991-e2e-runner
Oct 4, 2023
4a6dcb9
added proxmark3 support, added nfc test and nfc/readme.md for nfc team
Oct 6, 2023
d6971a4
changes to pm3 wrapper and code example, some of it is deprecated and…
Oct 6, 2023
c31f733
fixed tests and removed unnecessary data
Oct 6, 2023
76a7fc4
Merge branch 'doom/2991-e2e-runner' of https://github.com/flipperdevi…
Oct 10, 2023
f63ffd7
added browser favorites
Oct 10, 2023
2a26c1d
saving temp changes. ntag and mfc are under work. parser for pm3 need…
Oct 12, 2023
b4b00b7
temp changes to mfc, will need to update menu navigation further
Oct 16, 2023
8089229
fixed navigation in saved, needs refactor
Oct 16, 2023
739138b
added additional refs, more mfc tests, update to ntag tests
Oct 17, 2023
8f5acb1
minor mfc refactor
Oct 17, 2023
dd5e407
Merge branch 'doom/2991-e2e-runner' of https://github.com/flipperdevi…
Oct 18, 2023
1c81a8b
wrapper for windows instead of -c, fixture update for ntag reset
Oct 19, 2023
5aeef23
Merge branch 'doom/2991-e2e-runner' of github.com:flipperdevices/flip…
Oct 19, 2023
e1a5ea5
added 100 more ntag tests, isort and unused imports cleanup
Oct 19, 2023
0a774d5
Merge branch 'dev' into doom/2991-e2e-runner
Oct 25, 2023
7a94cdb
added test canvas for ultralight, not yet ready
Oct 25, 2023
c19ef53
Add basic text generation
Hellitron Oct 31, 2023
456d42d
Added basic implementation of text generation and test with it
Hellitron Nov 2, 2023
a2162c1
Add forgotten files
Hellitron Nov 2, 2023
2bcdbcf
go_to implemented with generation of refs
Hellitron Nov 3, 2023
01b4319
Rewrite some tests on text generation rails. Minor fixes of text gene…
Hellitron Nov 8, 2023
54353aa
Rewrite all tests on text generation. Removed unnecessary refs
Hellitron Nov 10, 2023
66be0cf
Add mifare classic emulation tests
Astrrra Nov 15, 2023
9b2df24
Minor changes and fixes
Hellitron Nov 15, 2023
6bb1e3f
Migration on text generation done
Hellitron Nov 16, 2023
da45fae
Merge branch 'dev' into doom/2991-e2e-runner
Dec 4, 2023
599a274
Merge remote-tracking branch 'origin/dev' into astra/3614-mfc-unit-tests
gornekich Dec 27, 2023
3956777
Added autoupdate via ufbt in conftest
Hellitron Dec 27, 2023
348cac7
Merge branch 'dev' into doom/2991-e2e-runner
Jan 10, 2024
6a7bafc
Merge branch 'astra/3614-mfc-unit-tests' into doom/2991-e2e-runner
Jan 10, 2024
da8aacd
Merge branch 'hellitron/font-recog' into doom/2991-e2e-runner
Jan 10, 2024
2ce6087
Merge branch 'hellitron/e2e_bench_autoupdate' into doom/2991-e2e-runner
Jan 10, 2024
67c5ba7
merged all branches together, formatted code, additional cleanup of c…
Jan 10, 2024
e459bb9
deleted unwanted font files from hellitron branch
Jan 10, 2024
12f282c
[WIP] new async protopy client, rewrite from sync to async
glebmashanov Apr 8, 2024
909a0c5
rework to async
glebmashanov Apr 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 123 additions & 0 deletions .github/workflows/smoke_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: 'Smoke tests'

on:
push:
branches:
- "release*"

env:
TARGETS: f7
DEFAULT_TARGET: f7
FBT_TOOLCHAIN_PATH: /opt

jobs:
run_smoke_on_bench:
runs-on: [self-hosted, FlipperZeroIntegrationTest]
steps:
- name: 'Wipe workspace'
run: find ./ -mount -maxdepth 1 -exec rm -rf {} \;

- name: Checkout code
timeout-minutes: 0.5
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: 'Install submodules'
timeout-minutes: 0.5
run:
git submodule update --init --recursive --force

- name: 'Get flipper from device manager (mock)'
id: device
timeout-minutes: 0.5
run: |
echo "flipper=/dev/ttyACM1" >> $GITHUB_OUTPUT
echo "stlink=49FF75065182575513201587" >> $GITHUB_OUTPUT

- name: 'Flash firmware and upload all applications'
id: flashing
if: success()
timeout-minutes: 7
run: |
./fbt flash_usb_full PORT=${{steps.device.outputs.flipper}} FORCE=1

- name: 'Wait for flipper'
id: await_flipper
if: steps.flashing.outcome == 'success'
timeout-minutes: 3
run: |
source scripts/toolchain/fbtenv.sh
python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}}

- name: 'Run smoke tests'
id: run_smoke
if: steps.await_flipper.outcome == 'success'
timeout-minutes: 15
run: |
cd scripts/flippigator
docker buildx build -t pytest-runner .
docker run --rm --device ${{steps.device.outputs.flipper}}:/dev/ttyACM0 pytest-runner

- name: 'Generate allure reports'
id: generate_allure_reports
if: steps.run_smoke.outcome == 'success'
timeout-minutes: 0.5
run: |
pwd

- name: 'Upload allure reports'
id: upload_allure_reports
if: steps.generate_allure_reports.outcome == 'success'
timeout-minutes: 0.5
run: |
pwd

- name: 'Wait for flipper and format ext after tests'
id: format_ext
if: always()
timeout-minutes: 3
run: |
source scripts/toolchain/fbtenv.sh
python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}}
python3 scripts/storage.py -p ${{steps.device.outputs.flipper}} format_ext
python3 scripts/power.py -p ${{steps.device.outputs.flipper}} reboot
python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}}

- name: 'Get last release tag if flipper not responding'
id: release_tag
if: steps.format_ext.outcome == 'failure'
run: |
echo "tag=$(git tag -l --sort=-version:refname | grep -v "rc\|RC" | head -1)" >> $GITHUB_OUTPUT

- name: 'Wipe workspace'
run: find ./ -mount -maxdepth 1 -exec rm -rf {} \;

- name: 'Checkout latest release'
uses: actions/checkout@v3
if: steps.format_ext.outcome == 'failure'
with:
fetch-depth: 1
ref: ${{ steps.release_tag.outputs.tag }}

- name: 'Flash last release'
id: fbt_flash_with_serial
if: steps.format_ext.outcome == 'failure'
run: |
./fbt flash OPENOCD_ADAPTER_SERIAL=${{steps.device.outputs.stlink}} FORCE=1

- name: 'Wait for flipper and format ext'
if: steps.format_ext.outcome == 'failure'
timeout-minutes: 3
run: |
source scripts/toolchain/fbtenv.sh
python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}}
python3 scripts/storage.py -p ${{steps.device.outputs.flipper}} format_ext
python3 scripts/power.py -p ${{steps.device.outputs.flipper}} reboot
python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}}

- name: 'Check GDB output if we failed to flash'
if: steps.fbt_flash_with_serial.outcome == 'failure'
run: |
./fbt gdb_trace_all OPENOCD_ADAPTER_SERIAL=2A0906016415303030303032 FIRMWARE_APP_SET=unit_tests FORCE=1
6 changes: 6 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: 'Unit tests'

on:
push:
branches:
- dev
- "release*"
tags:
- '*'
pull_request:

env:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/updater_test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: 'Updater test'

on:
push:
branches:
- dev
- "release*"
tags:
- '*'
pull_request:

env:
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ openocd.log
PVS-Studio.log
*.PVS-Studio.*

# Test framework
flipperzero-firmware/scripts/flippigator/flipperzero_protobuf_py
scripts/flippigator/img/failed.bmp
scripts/flippigator/img/recognitionFailPic.bmp
scripts/flippigator/img/saved1.jpg
scripts/flippigator/img/saved2.png
scripts/flippigator/img/saved3.bmp

.gdbinit

/fbt_options_local.py
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
[submodule "lib/cxxheaderparser"]
path = lib/cxxheaderparser
url = https://github.com/robotpy/cxxheaderparser.git
[submodule "applications/external/dap_link/lib/free-dap"]
path = applications/external/dap_link/lib/free-dap
url = https://github.com/ataradov/free-dap.git
[submodule "scripts/flippigator/flipperzero_protobuf_py"]
path = scripts/flippigator/flipperzero_protobuf_py
url = https://github.com/flipperdevices/flipperzero_protobuf_py.git
[submodule "lib/heatshrink"]
path = lib/heatshrink
url = https://github.com/flipperdevices/heatshrink.git
Expand Down
2 changes: 1 addition & 1 deletion assets/protobuf
2 changes: 1 addition & 1 deletion lib/littlefs
Submodule littlefs updated 68 files
+0 −4 .gitattributes
+3 −8 .github/workflows/post-release.yml
+64 −125 .github/workflows/release.yml
+4 −49 .github/workflows/status.yml
+247 −645 .github/workflows/test.yml
+5 −25 .gitignore
+104 −513 Makefile
+1 −19 README.md
+11 −90 SPEC.md
+0 −662 bd/lfs_emubd.c
+0 −233 bd/lfs_emubd.h
+75 −18 bd/lfs_filebd.c
+11 −2 bd/lfs_filebd.h
+28 −16 bd/lfs_rambd.c
+4 −2 bd/lfs_rambd.h
+303 −0 bd/lfs_testbd.c
+142 −0 bd/lfs_testbd.h
+0 −270 benches/bench_dir.toml
+0 −95 benches/bench_file.toml
+0 −56 benches/bench_superblock.toml
+219 −637 lfs.c
+6 −47 lfs.h
+6 −4 lfs_util.h
+0 −2,051 runners/bench_runner.c
+0 −131 runners/bench_runner.h
+0 −2,778 runners/test_runner.c
+0 −127 runners/test_runner.h
+0 −1,430 scripts/bench.py
+0 −181 scripts/changeprefix.py
+226 −649 scripts/code.py
+0 −828 scripts/cov.py
+323 −0 scripts/coverage.py
+225 −646 scripts/data.py
+383 −0 scripts/explode_asserts.py
+0 −1,344 scripts/perf.py
+0 −1,276 scripts/perfbd.py
+0 −1,592 scripts/plot.py
+0 −1,262 scripts/plotmpl.py
+61 −0 scripts/prefix.py
+0 −452 scripts/prettyasserts.py
+15 −47 scripts/readmdir.py
+331 −636 scripts/stack.py
+260 −581 scripts/structs.py
+245 −795 scripts/summary.py
+0 −177 scripts/tailpipe.py
+0 −73 scripts/teepipe.py
+800 −1,424 scripts/test.py
+0 −1,002 scripts/tracebd.py
+0 −265 scripts/watch.py
+114 −178 tests/test_alloc.toml
+19 −31 tests/test_attrs.toml
+76 −95 tests/test_badblocks.toml
+0 −248 tests/test_bd.toml
+0 −1,453 tests/test_compat.toml
+95 −280 tests/test_dirs.toml
+28 −59 tests/test_entries.toml
+49 −67 tests/test_evil.toml
+117 −157 tests/test_exhaustion.toml
+116 −146 tests/test_files.toml
+23 −49 tests/test_interspersed.toml
+188 −270 tests/test_move.toml
+28 −181 tests/test_orphans.toml
+39 −82 tests/test_paths.toml
+0 −185 tests/test_powerloss.toml
+68 −106 tests/test_relocations.toml
+37 −60 tests/test_seek.toml
+31 −103 tests/test_superblocks.toml
+84 −144 tests/test_truncate.toml
2 changes: 1 addition & 1 deletion lib/mbedtls
Submodule mbedtls updated 1264 files
2 changes: 1 addition & 1 deletion lib/stm32wb_copro
Submodule stm32wb_copro updated 223 files
10 changes: 10 additions & 0 deletions scripts/flippigator/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# syntax=docker/dockerfile-upstream:master-labs
FROM python:3.10 as builder

COPY . /build

WORKDIR /build

RUN pip3 install -r requirements-headless.txt

CMD pytest -v --gui=0 --port=/dev/ttyACM0 -m smoke
47 changes: 47 additions & 0 deletions scripts/flippigator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# flipperzero-e2e-py
```
.-._ _ _ _ _ _ _ _ _
.-''-.__.-'00 '-' ' ' ' ' ' ' ' '-.
'.___ ' . .--_'-' '-' '-' _'-' '._
V: V 'vv-' '_ '. .' _..' '.'.
'=.____.=_.--' :_.__.__:_ '. : :
(((____.-' '-. / : :
(((-'\ .' /
_____..' .'
'-._____.-'
```
Internal tool for hardware e2e testing of flipperzero on pytest.


### Running the tests
To run use the following command:
```
pytest
```
Additionally, you can specify port:
```
pytest --p COM3
```
Or you can run tests for specific module:
```
pytest --m nfc
```
Or you can search for a test or a test class:
```
pytest -k TestNfc
```
You can also write allure report:
```
pytest -p COM3 --alluredir=allure-report
```
And finally you can serve allure report if you have allure installed:
```
allure serve allure-report
```

### Writing tests
All tests should be placed in testing folder, specified by the module
in case of changes, write task ID into docstring of the test class, so we can know what made you do the changes.

### Running tests in parallel
To run tests in parallel, you need to install pytest-xdist and we need to finish writing device manager :)
Empty file.
Empty file.
138 changes: 138 additions & 0 deletions scripts/flippigator/async_protopy/clients/application_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
from async_protopy.commands.application_commands import (
ApplicationButtonReleaseRequestCommand,
ApplicationDataExchangeRequestCommand,
ApplicationButtonPressRequestCommand,
ApplicationLockStatusRequestCommand,
ApplicationLoadFileRequestCommand,
ApplicationGetErrorRequestCommand,
ApplicationStartRequestCommand,
ApplicationExitRequestCommand,
)
from async_protopy.clients.base_client import FlipperBaseProtoClient
from async_protopy.flipperzero_protobuf_compiled import flipper_pb2


class FlipperApplicationProtoClient(FlipperBaseProtoClient):
"""The application flipper protobuf client.

Inherits from FlipperBaseProtoClient.
"""
async def lock_status_request(self, wait_for_response: bool = True) -> flipper_pb2.Main:
"""Requests the application lock status.

Args:
wait_for_response: bool
A flag used to wait for the response data or return after the command is sent (default is True)

Returns:
A request response message.
"""
return await self.request(
ApplicationLockStatusRequestCommand(), wait_for_response=wait_for_response, to_validate=True
)

async def start_request(self, name: str, args: str, wait_for_response: bool = True) -> flipper_pb2.Main:
"""Requests the application start/run command.

Args:
name: str
A name of the application.
args:
A path to the application. # TODO: check it out
wait_for_response: bool
A flag used to wait for the response data or return after the command is sent (default is True)

Returns:
A request response message.
"""
return await self.request(
ApplicationStartRequestCommand(name=name, args=args), wait_for_response=wait_for_response, to_validate=True
)

async def exit_request(self, wait_for_response: bool = True) -> flipper_pb2.Main:
"""Requests the exit command to the application.

Args:
wait_for_response: bool
A flag used to wait for the response data or return after the command is sent (default is True)

Returns:
A request response message.
"""
return await self.request(
ApplicationExitRequestCommand(), wait_for_response=wait_for_response, to_validate=True
)

async def load_file_request(self, path: str, wait_for_response: bool = True) -> flipper_pb2.Main:
"""Requests the load file command to the application.

Args:
path: str # TODO: get to know
wait_for_response: bool
A flag used to wait for the response data or return after the command is sent (default is True)

Returns:
A request response message.
"""
return await self.request(
ApplicationLoadFileRequestCommand(path=path), wait_for_response=wait_for_response, to_validate=True
)

async def button_press_request(self, args: str, wait_for_response: bool = True) -> flipper_pb2.Main:
"""Requests the button press command to the application.

Args:
wait_for_response: bool
A flag used to wait for the response data or return after the command is sent (default is True)

Returns:
A request response message.
"""
return await self.request(
ApplicationButtonPressRequestCommand(args=args), wait_for_response=wait_for_response, to_validate=True
)

async def button_release_request(self, wait_for_response: bool = True) -> flipper_pb2.Main:
"""Requests the button release command to the application.

Args:
wait_for_response: bool
A flag used to wait for the response data or return after the command is sent (default is True)

Returns:
A request response message.
"""
return await self.request(
ApplicationButtonReleaseRequestCommand(), wait_for_response=wait_for_response, to_validate=True
)

async def get_error_request(self, wait_for_response: bool = True) -> flipper_pb2.Main:
"""Requests the get error command to the application.

Args:
wait_for_response: bool
A flag used to wait for the response data or return after the command is sent (default is True)

Returns:
A request response message.
"""
return await self.request(
ApplicationGetErrorRequestCommand(), wait_for_response=wait_for_response, to_validate=True
)

async def data_exchange_request(self, data: bytes, wait_for_response: bool = True) -> flipper_pb2.Main:
"""Requests the data exchange command to the application.

Args:
wait_for_response: bool
A flag used to wait for the response data or return after the command is sent (default is True)

Returns:
A request response message.
"""
return await self.request(
ApplicationDataExchangeRequestCommand(data=data), wait_for_response=wait_for_response, to_validate=True
)

async def data_exchange_receive(self) -> flipper_pb2.Main:
raise NotImplementedError() # TODO: implement it
Loading
Loading