@@ -27,7 +27,7 @@ def upload_icomoon(self, icomoon_json_path: str):
27
27
:param icomoon_json_path: a path to the iconmoon.json.
28
28
:raises TimeoutException: happens when elements are not found.
29
29
"""
30
- print ("Uploading icomoon.json file..." )
30
+ print ("Uploading icomoon.json file..." , file = self . log_output )
31
31
32
32
# find the file input and enter the file path
33
33
import_btn = self .driver .find_element_by_css_selector (
@@ -44,15 +44,15 @@ def upload_icomoon(self, icomoon_json_path: str):
44
44
raise Exception ("Cannot find the confirm button when uploading the icomoon.json" \
45
45
"Ensure that the icomoon.json is in the correct format for Icomoon.io" )
46
46
47
- print ("JSON file uploaded." )
47
+ print ("JSON file uploaded." , file = self . log_output )
48
48
49
49
def upload_svgs (self , svgs : List [str ], screenshot_folder : str ):
50
50
"""
51
51
Upload the SVGs provided in svgs. This will upload the
52
52
:param svgs: a list of svg Paths that we'll upload to icomoon.
53
53
:param screenshot_folder: the name of the screenshot_folder.
54
54
"""
55
- print ("Uploading SVGs..." )
55
+ print ("Uploading SVGs..." , file = self . log_output )
56
56
57
57
import_btn = self .driver .find_element_by_css_selector (
58
58
SeleniumRunner .SET_IMPORT_BUTTON_CSS
@@ -63,7 +63,7 @@ def upload_svgs(self, svgs: List[str], screenshot_folder: str):
63
63
err_messages = []
64
64
for i in range (len (svgs )):
65
65
import_btn .send_keys (svgs [i ])
66
- print (f"Uploading { svgs [i ]} " )
66
+ print (f"Uploading { svgs [i ]} " , file = self . log_output )
67
67
68
68
# see if there are stroke messages or replacing icon message
69
69
# there should be none of the second kind
@@ -83,8 +83,9 @@ def upload_svgs(self, svgs: List[str], screenshot_folder: str):
83
83
raise Exception (f"Unexpected alert found: { alert } " )
84
84
85
85
self .edit_svg ()
86
- print (f"Finished editing icon." )
86
+ print (f"Finished editing icon." , file = self . log_output )
87
87
88
+ print ("Finished uploading all files." , file = self .log_output )
88
89
if err_messages != []:
89
90
message = "BuildSeleniumRunner - Issues found when uploading SVGs:\n "
90
91
raise Exception (message + '\n ' .join (err_messages ))
@@ -94,9 +95,9 @@ def upload_svgs(self, svgs: List[str], screenshot_folder: str):
94
95
self .switch_toolbar_option (IcomoonOptionState .SELECT )
95
96
self .select_all_icons_in_top_set ()
96
97
new_svgs_path = str (Path (screenshot_folder , "new_svgs.png" ).resolve ())
97
- self .driver .save_screenshot (new_svgs_path );
98
+ self .driver .save_screenshot (new_svgs_path )
98
99
99
- print ("Finished uploading the svgs..." )
100
+ print ("Finished uploading the svgs..." , file = self . log_output )
100
101
101
102
def take_icon_screenshot (self , screenshot_folder : str ):
102
103
"""
@@ -105,16 +106,19 @@ def take_icon_screenshot(self, screenshot_folder: str):
105
106
:param screenshot_folder: the name of the screenshot_folder.
106
107
"""
107
108
# take pictures
108
- print ("Taking screenshot of the new icons..." )
109
+ print ("Taking screenshot of the new icons..." , file = self . log_output )
109
110
self .go_to_generate_font_page ()
110
111
111
112
# take an overall screenshot of the icons that were just added
112
113
# also include the glyph count
113
114
new_icons_path = str (Path (screenshot_folder , "new_icons.png" ).resolve ())
114
115
main_content_xpath = "/html/body/div[4]/div[2]/div/div[1]"
115
116
main_content = self .driver .find_element_by_xpath (main_content_xpath )
117
+
118
+ # wait a bit for all the icons to load before we take a pic
119
+ time .sleep (SeleniumRunner .MED_WAIT_IN_SEC )
116
120
main_content .screenshot (new_icons_path )
117
- print ("Saved screenshot of the new icons..." )
121
+ print ("Saved screenshot of the new icons..." , file = self . log_output )
118
122
119
123
def go_to_generate_font_page (self ):
120
124
"""
@@ -137,7 +141,7 @@ def download_icomoon_fonts(self, zip_path: Path):
137
141
what the icons look like.
138
142
:param zip_path: the path to the zip file after it's downloaded.
139
143
"""
140
- print ("Downloading Font files..." )
144
+ print ("Downloading Font files..." , file = self . log_output )
141
145
if self .current_page != IcomoonPage .SELECTION :
142
146
self .go_to_page (IcomoonPage .SELECTION )
143
147
@@ -149,7 +153,7 @@ def download_icomoon_fonts(self, zip_path: Path):
149
153
)
150
154
download_btn .click ()
151
155
if self .wait_for_zip (zip_path ):
152
- print ("Font files downloaded." )
156
+ print ("Font files downloaded." , file = self . log_output )
153
157
else :
154
158
raise TimeoutError (f"Couldn't find { zip_path } after download button was clicked." )
155
159
0 commit comments