@@ -27,7 +27,7 @@ def upload_icomoon(self, icomoon_json_path: str):
2727 :param icomoon_json_path: a path to the iconmoon.json.
2828 :raises TimeoutException: happens when elements are not found.
2929 """
30- print ("Uploading icomoon.json file..." )
30+ print ("Uploading icomoon.json file..." , file = self . log_output )
3131
3232 # find the file input and enter the file path
3333 import_btn = self .driver .find_element_by_css_selector (
@@ -44,15 +44,15 @@ def upload_icomoon(self, icomoon_json_path: str):
4444 raise Exception ("Cannot find the confirm button when uploading the icomoon.json" \
4545 "Ensure that the icomoon.json is in the correct format for Icomoon.io" )
4646
47- print ("JSON file uploaded." )
47+ print ("JSON file uploaded." , file = self . log_output )
4848
4949 def upload_svgs (self , svgs : List [str ], screenshot_folder : str ):
5050 """
5151 Upload the SVGs provided in svgs. This will upload the
5252 :param svgs: a list of svg Paths that we'll upload to icomoon.
5353 :param screenshot_folder: the name of the screenshot_folder.
5454 """
55- print ("Uploading SVGs..." )
55+ print ("Uploading SVGs..." , file = self . log_output )
5656
5757 import_btn = self .driver .find_element_by_css_selector (
5858 SeleniumRunner .SET_IMPORT_BUTTON_CSS
@@ -63,7 +63,7 @@ def upload_svgs(self, svgs: List[str], screenshot_folder: str):
6363 err_messages = []
6464 for i in range (len (svgs )):
6565 import_btn .send_keys (svgs [i ])
66- print (f"Uploading { svgs [i ]} " )
66+ print (f"Uploading { svgs [i ]} " , file = self . log_output )
6767
6868 # see if there are stroke messages or replacing icon message
6969 # there should be none of the second kind
@@ -83,8 +83,9 @@ def upload_svgs(self, svgs: List[str], screenshot_folder: str):
8383 raise Exception (f"Unexpected alert found: { alert } " )
8484
8585 self .edit_svg ()
86- print (f"Finished editing icon." )
86+ print (f"Finished editing icon." , file = self . log_output )
8787
88+ print ("Finished uploading all files." , file = self .log_output )
8889 if err_messages != []:
8990 message = "BuildSeleniumRunner - Issues found when uploading SVGs:\n "
9091 raise Exception (message + '\n ' .join (err_messages ))
@@ -94,9 +95,9 @@ def upload_svgs(self, svgs: List[str], screenshot_folder: str):
9495 self .switch_toolbar_option (IcomoonOptionState .SELECT )
9596 self .select_all_icons_in_top_set ()
9697 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 )
9899
99- print ("Finished uploading the svgs..." )
100+ print ("Finished uploading the svgs..." , file = self . log_output )
100101
101102 def take_icon_screenshot (self , screenshot_folder : str ):
102103 """
@@ -105,16 +106,19 @@ def take_icon_screenshot(self, screenshot_folder: str):
105106 :param screenshot_folder: the name of the screenshot_folder.
106107 """
107108 # take pictures
108- print ("Taking screenshot of the new icons..." )
109+ print ("Taking screenshot of the new icons..." , file = self . log_output )
109110 self .go_to_generate_font_page ()
110111
111112 # take an overall screenshot of the icons that were just added
112113 # also include the glyph count
113114 new_icons_path = str (Path (screenshot_folder , "new_icons.png" ).resolve ())
114115 main_content_xpath = "/html/body/div[4]/div[2]/div/div[1]"
115116 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 )
116120 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 )
118122
119123 def go_to_generate_font_page (self ):
120124 """
@@ -137,7 +141,7 @@ def download_icomoon_fonts(self, zip_path: Path):
137141 what the icons look like.
138142 :param zip_path: the path to the zip file after it's downloaded.
139143 """
140- print ("Downloading Font files..." )
144+ print ("Downloading Font files..." , file = self . log_output )
141145 if self .current_page != IcomoonPage .SELECTION :
142146 self .go_to_page (IcomoonPage .SELECTION )
143147
@@ -149,7 +153,7 @@ def download_icomoon_fonts(self, zip_path: Path):
149153 )
150154 download_btn .click ()
151155 if self .wait_for_zip (zip_path ):
152- print ("Font files downloaded." )
156+ print ("Font files downloaded." , file = self . log_output )
153157 else :
154158 raise TimeoutError (f"Couldn't find { zip_path } after download button was clicked." )
155159
0 commit comments