Skip to content

Commit 9509655

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 1fc4456 commit 9509655

8 files changed

+124
-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

+17-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,19 @@ 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+
Log <img src="${capture_name}" width="50%" /> html
45+
46+
Remote Weston Check Screenshot
47+
[Arguments] ${image}
48+
Remote Weston Capture Screenshot ${image}
49+
Compare Images ${BASELINE_IMAGES_PATH}/${image} ${image} threshold=0.0050
50+
3451
Webdriver Remote Start
3552
[Arguments] @{other_params}
3653
[Timeout] 2 minutes
@@ -57,4 +74,3 @@ Webdriver Remote Stop
5774
Close All Browsers
5875
SSH Webdriver Remote Stop ${TEST_BOARD_IP}
5976
SSH Force Kill ${TEST_BOARD_IP} cog
60-
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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+
Suite Setup Configure Mockup Pages
10+
11+
Library ../libs/TestUtils.py
12+
13+
Resource variables.robot
14+
Resource keywords_common.robot
15+
16+
*** Keywords ***
17+
Browser Reload
18+
${TEST_BOARD_IP} Get Environment Variable TEST_BOARD_IP
19+
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
20+
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${SEARCH_SCREEN_IMAGE}
21+
22+
Click On Search Link In Home
23+
${TEST_BOARD_IP} Get Environment Variable TEST_BOARD_IP
24+
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
25+
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${SEARCH_SCREEN_IMAGE}
26+
27+
Configure Mockup Pages
28+
${TEST_BOARD_IP} Get Environment Variable TEST_BOARD_IP
29+
${TEST_WEBSERVER_IP} Get Environment Variable TEST_WEBSERVER_IP
30+
${TEST_WEBSERVER_PORT} Get Environment Variable TEST_WEBSERVER_PORT
31+
${HOME_PAGE} Set Variable http://${TEST_WEBSERVER_IP}:${TEST_WEBSERVER_PORT}/robot_framework/html/home-page.html
32+
${SEARCH_PAGE} Set Variable http://${TEST_WEBSERVER_IP}:${TEST_WEBSERVER_PORT}/robot_framework/html/search-page.html
33+
34+
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
35+
SSH Command ${TEST_BOARD_IP} sed -i 's|https://www.wpewebkit.org|${HOME_PAGE}|g' /usr/bin/demo-wpe-website
36+
SSH Command ${TEST_BOARD_IP} sed -i 's|https://duckduckgo.com/|${SEARCH_PAGE}|g' /usr/bin/demo-wpe-duckduckgo
37+
SSH Command ${TEST_BOARD_IP} systemctl daemon-reload && systemctl restart weston
38+
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${HOME_SCREEN_IMAGE}
39+
40+
Open Home
41+
${TEST_BOARD_IP} Get Environment Variable TEST_BOARD_IP
42+
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
43+
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${HOME_SCREEN_IMAGE}
44+
45+
Open Search
46+
${TEST_BOARD_IP} Get Environment Variable TEST_BOARD_IP
47+
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
48+
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${SEARCH_SCREEN_IMAGE}
49+
50+
Navigation Back
51+
${TEST_BOARD_IP} Get Environment Variable TEST_BOARD_IP
52+
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
53+
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${HOME_SCREEN_IMAGE}
54+
55+
Navigation Forward
56+
${TEST_BOARD_IP} Get Environment Variable TEST_BOARD_IP
57+
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
58+
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${SEARCH_SCREEN_IMAGE}
59+
60+
Terminate Browser
61+
${TEST_BOARD_IP} Get Environment Variable TEST_BOARD_IP
62+
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
63+
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${INIT_SCREEN_IMAGE}
64+
65+
*** Test Cases ***
66+
Test Check Navigation Bar
67+
Terminate Browser
68+
Open Home
69+
Click On Search Link In Home
70+
Navigation Back
71+
Navigation Forward
72+
Browser Reload
73+
Navigation Back
74+
Open Search
75+
Terminate Browser

0 commit comments

Comments
 (0)