Skip to content

Commit e6d18d7

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 e6d18d7

8 files changed

+120
-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,72 @@
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+
*** Keywords ***
15+
Browser Reload
16+
${TEST_BOARD_IP} Get Environment Variable TEST_BOARD_IP
17+
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
18+
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${SEARCH_SCREEN_IMAGE}
19+
20+
Click On Search Link In Home
21+
${TEST_BOARD_IP} Get Environment Variable TEST_BOARD_IP
22+
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
23+
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${SEARCH_SCREEN_IMAGE}
24+
25+
Open Home
26+
${TEST_BOARD_IP} Get Environment Variable TEST_BOARD_IP
27+
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
28+
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${HOME_SCREEN_IMAGE}
29+
30+
Open Search
31+
${TEST_BOARD_IP} Get Environment Variable TEST_BOARD_IP
32+
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
33+
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${SEARCH_SCREEN_IMAGE}
34+
35+
Navigation Back
36+
${TEST_BOARD_IP} Get Environment Variable TEST_BOARD_IP
37+
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
38+
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${HOME_SCREEN_IMAGE}
39+
40+
Navigation Forward
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 400 15 400 15
43+
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${SEARCH_SCREEN_IMAGE}
44+
45+
Terminate Browser
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 595 15 595 15
48+
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${INIT_SCREEN_IMAGE}
49+
50+
*** Test Cases ***
51+
Test Check Navigation Bar
52+
${TEST_BOARD_IP} Get Environment Variable TEST_BOARD_IP
53+
${TEST_WEBSERVER_IP} Get Environment Variable TEST_WEBSERVER_IP
54+
${TEST_WEBSERVER_PORT} Get Environment Variable TEST_WEBSERVER_PORT
55+
${HOME_PAGE} Set Variable http://${TEST_WEBSERVER_IP}:${TEST_WEBSERVER_PORT}/robot_framework/html/home-page.html
56+
${SEARCH_PAGE} Set Variable http://${TEST_WEBSERVER_IP}:${TEST_WEBSERVER_PORT}/robot_framework/html/search-page.html
57+
58+
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
59+
SSH Command ${TEST_BOARD_IP} sed -i 's|https://www.wpewebkit.org|${HOME_PAGE}|g' /usr/bin/demo-wpe-website
60+
SSH Command ${TEST_BOARD_IP} sed -i 's|https://duckduckgo.com/|${SEARCH_PAGE}|g' /usr/bin/demo-wpe-duckduckgo
61+
SSH Command ${TEST_BOARD_IP} systemctl daemon-reload && systemctl restart weston
62+
Wait Until Keyword Succeeds 20x 1000ms Remote Weston Check Screenshot ${HOME_SCREEN_IMAGE}
63+
64+
Terminate Browser
65+
Open Home
66+
Click On Search Link In Home
67+
Navigation Back
68+
Navigation Forward
69+
Browser Reload
70+
Navigation Back
71+
Open Search
72+
Terminate Browser

0 commit comments

Comments
 (0)