Skip to content

Commit d3d8edf

Browse files
committed
ci: Add screenshot validation and navigation bar test
* 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`.
1 parent 79ff756 commit d3d8edf

8 files changed

+113
-1
lines changed
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width,
6+
initial-scale=1.0">
7+
<title>Home Page</title>
8+
</head>
9+
<body>
10+
<h1>Welcome to the Home Page</h1>
11+
<p>Click the link below to go to the search page.</p>
12+
<a href="search-page.html">Go to Search Page</a>
13+
</body>
14+
</html>
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width,
6+
initial-scale=1.0">
7+
<title>Search Page</title>
8+
</head>
9+
<body>
10+
<h1>Welcome to the Search Page</h1>
11+
<form action="/search" method="get">
12+
<label for="query">Search:</label>
13+
<input type="text" id="query"
14+
name="query">
15+
<button type="submit">Search</button>
16+
</form>
17+
</body>
18+
</html>
29.6 KB
Loading
37.3 KB
Loading
27.5 KB
Loading

.ci/robot_framework/tests/keywords_common.robot

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
*** Variables ***
2+
${BASELINE_IMAGES_PATH} /app/robot_framework/images/
3+
14
*** Settings ***
25
Library Collections
6+
Library DocTest.VisualTest
37
Library OperatingSystem
48
Library ../libs/TestUtils.py
59

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

38+
Remote Weston Capture Screenshot
39+
[Arguments] ${capture_name}
40+
41+
${TEST_BOARD_IP} Get Environment Variable TEST_BOARD_IP
42+
SSH Command ${TEST_BOARD_IP} rm -rf wayland-screenshot-*.png && export XDG_RUNTIME_DIR=/run/user/1000 WAYLAND_DISPLAY=wayland-1 && weston-screenshooter
43+
Run scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@%{TEST_BOARD_IP}:~/wayland-screenshot-*.png ${capture_name}
44+
45+
Remote Weston Check Screenshot
46+
[Arguments] ${image}
47+
Remote Weston Capture Screenshot ${image}
48+
Compare Images ${BASELINE_IMAGES_PATH}/${image} ${image} threshold=0.0100
49+
3450
Webdriver Remote Start
3551
[Arguments] @{other_params}
3652
[Timeout] 2 minutes
@@ -57,4 +73,3 @@ Webdriver Remote Stop
5773
Close All Browsers
5874
SSH Webdriver Remote Stop ${TEST_BOARD_IP}
5975
SSH Force Kill ${TEST_BOARD_IP} cog
60-
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
*** Variables ***
2+
${INIT_SCREEN_IMAGE} init-screen.png
3+
${HOME_SCREEN_IMAGE} home-screen.png
4+
${SEARCH_SCREEN_IMAGE} search-screen.png
5+
6+
*** Settings ***
7+
Test Timeout 60 seconds
8+
9+
Library ../libs/TestUtils.py
10+
11+
Resource variables.robot
12+
Resource keywords_common.robot
13+
14+
*** Test Cases ***
15+
Test Check Navigation Bar
16+
[Tags] ignoreonfail
17+
18+
${TEST_BOARD_IP} Get Environment Variable TEST_BOARD_IP
19+
${TEST_WEBSERVER_IP} Get Environment Variable TEST_WEBSERVER_IP
20+
${TEST_WEBSERVER_PORT} Get Environment Variable TEST_WEBSERVER_PORT
21+
${HOME_PAGE} Set Variable http://${TEST_WEBSERVER_IP}:${TEST_WEBSERVER_PORT}/robot_framework/html/home-page.html
22+
${SEARCH_PAGE} Set Variable http://${TEST_WEBSERVER_IP}:${TEST_WEBSERVER_PORT}/robot_framework/html/search-page.html
23+
24+
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
25+
SSH Command ${TEST_BOARD_IP} sed -i 's|https://www.wpewebkit.org|${HOME_PAGE}|g' /usr/bin/demo-wpe-website
26+
SSH Command ${TEST_BOARD_IP} sed -i 's|https://duckduckgo.com/|${SEARCH_PAGE}|g' /usr/bin/demo-wpe-duckduckgo
27+
SSH Command ${TEST_BOARD_IP} systemctl daemon-reload && systemctl restart weston
28+
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${HOME_SCREEN_IMAGE}
29+
30+
# Terminate browser
31+
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
32+
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${INIT_SCREEN_IMAGE}
33+
34+
# Open Home
35+
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
36+
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${HOME_SCREEN_IMAGE}
37+
38+
# Click
39+
SSH Command ${TEST_BOARD_IP} /root/scripts/touch-one-finger-gesture.py --duration 0.2 --steps 2 --delay-on-touch-up 0 90 160 90 160
40+
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${SEARCH_SCREEN_IMAGE}
41+
42+
# Navigation Back
43+
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
44+
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${HOME_SCREEN_IMAGE}
45+
46+
# Navigation Forward
47+
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
48+
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${SEARCH_SCREEN_IMAGE}
49+
50+
# Reload
51+
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
52+
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${SEARCH_SCREEN_IMAGE}
53+
54+
# Navigation Back
55+
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
56+
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${HOME_SCREEN_IMAGE}
57+
58+
# Open Search
59+
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
60+
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${SEARCH_SCREEN_IMAGE}
61+
62+
# Terminate browser
63+
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
64+
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${INIT_SCREEN_IMAGE}
65+

0 commit comments

Comments
 (0)