File tree 2 files changed +38
-5
lines changed
2 files changed +38
-5
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ def glances_webserver():
74
74
75
75
76
76
@pytest .fixture (scope = "session" )
77
- def firefox_browser ():
77
+ def web_browser ():
78
78
"""Init Firefox browser."""
79
79
opt = ChromeOptions ()
80
80
opt .add_argument ("--headless" )
Original file line number Diff line number Diff line change 11
11
12
12
import os
13
13
import tempfile
14
+ import time
14
15
15
16
import pytest
16
17
from selenium .webdriver .common .by import By
17
18
19
+ SCREENSHOT_RESOLUTIONS = [
20
+ # PC
21
+ (640 , 480 ),
22
+ (800 , 600 ),
23
+ (1024 , 768 ),
24
+ (1600 , 900 ),
25
+ (1280 , 1024 ),
26
+ (1600 , 1200 ),
27
+ (1920 , 1200 ),
28
+ # IPHONE
29
+ (750 , 1334 ), # 8
30
+ (1080 , 1920 ), # 8 Plus
31
+ (1242 , 2208 ), # XS
32
+ (1125 , 2436 ), # 11 Pro
33
+ (1179 , 2556 ), # 15
34
+ (1320 , 2868 ), # 16 Pro Max
35
+ # PIXEL Phone
36
+ (1080 , 2400 ), # Pixel 7
37
+ ]
38
+
18
39
19
40
@pytest .fixture (scope = "module" )
20
- def glances_homepage (firefox_browser ):
21
- firefox_browser .get ("http://localhost:61234" )
22
- firefox_browser .save_screenshot (os .path .join (tempfile .gettempdir (), "glances.png" ))
23
- return firefox_browser
41
+ def glances_homepage (web_browser ):
42
+ time .sleep (3 )
43
+ web_browser .get ("http://localhost:61234" )
44
+ return web_browser
45
+
46
+
47
+ def test_screenshot (glances_webserver , glances_homepage ):
48
+ """
49
+ Test Glances home page screenshot.
50
+ """
51
+ glances_webserver is not None
52
+ for resolution in SCREENSHOT_RESOLUTIONS :
53
+ glances_homepage .set_window_size (* resolution )
54
+ glances_homepage .save_screenshot (
55
+ os .path .join (tempfile .gettempdir (), f"glances-{ '-' .join (map (str , list (resolution )))} .png" )
56
+ )
24
57
25
58
26
59
def test_loading_time (glances_webserver , glances_homepage ):
You can’t perform that action at this time.
0 commit comments