Skip to content

Commit

Permalink
ci: Add screenshot validation and navigation bar test
Browse files Browse the repository at this point in the history
* Introduced screenshot validation using `Remote Weston Capture Screenshot`
  and `Remote Weston Check Screenshot` keywords.
* Implemented a new test: `Test Check Navigation Bar` to verify navigation
  bar transitions using screenshots.
* Updated dependencies in `keywords_common.robot` to include `DocTest.VisualTest`.
  • Loading branch information
psaavedra committed Jan 22, 2025
1 parent 79ff756 commit 8a80e83
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 1 deletion.
Binary file added .ci/robot_framework/images/home-screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .ci/robot_framework/images/init-screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .ci/robot_framework/images/search-screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 16 additions & 1 deletion .ci/robot_framework/tests/keywords_common.robot
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
*** Variables ***
${BASELINE_IMAGES_PATH} /app/robot_framework/images/

*** Settings ***
Library Collections
Library DocTest.VisualTest
Library OperatingSystem
Library ../libs/TestUtils.py

Expand Down Expand Up @@ -31,6 +35,18 @@ Get Remote Memory Used
${value}= Evaluate float(${stdout}[0])
RETURN ${value}

Remote Weston Capture Screenshot
[Arguments] ${capture_name}

${TEST_BOARD_IP} Get Environment Variable TEST_BOARD_IP
SSH Command ${TEST_BOARD_IP} rm -rf wayland-screenshot-*.png && export XDG_RUNTIME_DIR=/run/user/1000 WAYLAND_DISPLAY=wayland-1 && weston-screenshooter
Run scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@%{TEST_BOARD_IP}:~/wayland-screenshot-*.png ${capture_name}

Remote Weston Check Screenshot
[Arguments] ${image}
Remote Weston Capture Screenshot ${image}
Compare Images ${BASELINE_IMAGES_PATH}/${image} ${image} threshold=0.0100

Webdriver Remote Start
[Arguments] @{other_params}
[Timeout] 2 minutes
Expand All @@ -57,4 +73,3 @@ Webdriver Remote Stop
Close All Browsers
SSH Webdriver Remote Stop ${TEST_BOARD_IP}
SSH Force Kill ${TEST_BOARD_IP} cog

54 changes: 54 additions & 0 deletions .ci/robot_framework/tests/tests_011_navigation_bar.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
*** Variables ***
${INIT_SCREEN_IMAGE} init-screen.png
${HOME_SCREEN_IMAGE} home-screen.png
${SEARCH_SCREEN_IMAGE} search-screen.png
${SEARCH_NAVIGATION_SCREEN_IMAGE} search-navigation-screen.png

*** Settings ***
Test Timeout 60 seconds

Library ../libs/TestUtils.py

Resource variables.robot
Resource keywords_common.robot

*** Test Cases ***
Test Check Navigation Bar
[Tags] ignoreonfail
${TEST_BOARD_IP} Get Environment Variable TEST_BOARD_IP

SSH Command ${TEST_BOARD_IP} sed -i 's|ExecStart=/usr/bin/weston --continue-without-input --modules=systemd-notify.so|ExecStart=/usr/bin/weston --continue-without-input --modules=systemd-notify.so --debug|' /lib/systemd/system/weston.service
SSH Command ${TEST_BOARD_IP} systemctl daemon-reload && systemctl restart weston
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${INIT_SCREEN_IMAGE}

# Open Home
SSH Command ${TEST_BOARD_IP} /root/scripts/touch-one-finger-gesture.py --duration 1 --steps 1 --delay-on-touch-up 0 215 15 215 15
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${HOME_SCREEN_IMAGE}

# Open Search
SSH Command ${TEST_BOARD_IP} /root/scripts/touch-one-finger-gesture.py --duration 1 --steps 1 --delay-on-touch-up 0 275 15 275 15
Sleep 10s
SSH Command ${TEST_BOARD_IP} /root/scripts/touch-one-finger-gesture.py --duration 0.2 --steps 2 --delay-on-touch-up 0 90 300 90 300
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${SEARCH_SCREEN_IMAGE}

# Click
SSH Command ${TEST_BOARD_IP} /root/scripts/touch-one-finger-gesture.py --duration 0.2 --steps 2 --delay-on-touch-up 0 90 90 90 90
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${SEARCH_NAVIGATION_SCREEN_IMAGE}

# Navigation Back
SSH Command ${TEST_BOARD_IP} /root/scripts/touch-one-finger-gesture.py --duration 1 --steps 1 --delay-on-touch-up 0 345 15 345 15
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${SEARCH_SCREEN_IMAGE}

# Navigation Forward
SSH Command ${TEST_BOARD_IP} /root/scripts/touch-one-finger-gesture.py --duration 1 --steps 1 --delay-on-touch-up 0 400 15 400 15
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${SEARCH_NAVIGATION_SCREEN_IMAGE}

# Reload
SSH Command ${TEST_BOARD_IP} /root/scripts/touch-one-finger-gesture.py --duration 1 --steps 1 --delay-on-touch-up 0 470 15 470 15
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${SEARCH_NAVIGATION_SCREEN_IMAGE}

# Terminate browser
SSH Command ${TEST_BOARD_IP} /root/scripts/touch-one-finger-gesture.py --duration 1 --steps 1 --delay-on-touch-up 0 595 15 595 15
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${INIT_SCREEN_IMAGE}

0 comments on commit 8a80e83

Please sign in to comment.