Skip to content

Commit

Permalink
Script checks for visibility before screenshotting
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas-Boi committed Aug 29, 2021
1 parent de8f5aa commit 19a7120
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
18 changes: 12 additions & 6 deletions .github/scripts/build_assets/selenium_runner/PeekSeleniumRunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
from pathlib import Path

from build_assets.selenium_runner.SeleniumRunner import SeleniumRunner
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
from build_assets.selenium_runner.enums import IcomoonPage, IcomoonAlerts

class PeekSeleniumRunner(SeleniumRunner):
Expand Down Expand Up @@ -86,15 +89,18 @@ def peek_icons(self, svgs: List[str], screenshot_folder: str):
main_content.screenshot(new_icons_path);

# go downward so we get the oldest icon first
len_ = len(svgs)
for i in range(len_, 0, -1):
xpath = f'//*[@id="glyphSet0"]/div[{i}]'
icon_div = self.driver.find_element_by_xpath(xpath)
icon_divs_xpath = f'//div[@id="glyphSet0"]/div'
icon_divs = self.driver.find_elements_by_xpath(icon_divs_xpath)
icon_divs.reverse()
i = 0
for icon_div in icon_divs:
if not icon_div.is_displayed():
continue

# crop the div out from the screenshot
icon_screenshot = str(
Path(screenshot_folder, f"new_icon_{len_ - i}.png").resolve()
Path(screenshot_folder, f"new_icon_{i}.png").resolve()
)
icon_div.screenshot(icon_screenshot)
i += 1

print("Finished peeking the icons...")
6 changes: 3 additions & 3 deletions .github/scripts/icomoon_peek.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ def main():
except Exception as e:
filehandler.write_to_file("./err_messages.txt", str(e))
util.exit_with_err(e)
finally:
if runner is not None:
runner.close()
# finally:
# if runner is not None:
# runner.close()


def check_devicon_object(icon: dict):
Expand Down
3 changes: 3 additions & 0 deletions err_messages.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

### WARNING -- Strokes detected in the following SVGs:
- windows11-original-wordmark.svg

0 comments on commit 19a7120

Please sign in to comment.