Skip to content

Commit f3999ae

Browse files
committed
firs test commit
0 parents  commit f3999ae

File tree

4 files changed

+87
-0
lines changed

4 files changed

+87
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.DS_Store
2+
venv/

action.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: 'Font browser tests'
2+
description: 'Test font rendering on different browsers'
3+
inputs:
4+
fonts_before:
5+
description: 'Diff against a previous set of fonts'
6+
required: false
7+
default: ''
8+
pt_size:
9+
description: 'Set pt size of sample images'
10+
required: false
11+
default: '14'
12+
runs:
13+
using: "composite"
14+
steps:
15+
- name: Set up Python 3.9
16+
uses: actions/setup-python@v2
17+
with:
18+
python-version: 3.9
19+
- name: Install packages
20+
run: |
21+
pip install git+https://github.com/googlefonts/gftools/pull/420/head
22+
- name: Setup Chrome
23+
uses: browser-actions/setup-chrome@latest
24+
- name: Setup Chrome Driver
25+
uses: nanasess/setup-chromedriver@master
26+
27+
- name: Gen Screenshots
28+
run: |
29+
chromedriver --url-base=/wd/hub &
30+
python test.py
31+
32+
- name: Create Artifacts
33+
uses: actions/upload-artifact@v2
34+
with:
35+
name: images
36+
path: ./*.png

readme.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Font Browser Tests Action
2+
3+
Test how your fonts render on different browsers
4+
5+
## Example
6+
7+
Create a `.github/workflows/test.yml` with the following contents:
8+
9+
```
10+
on: [push]
11+
12+
jobs:
13+
font-render:
14+
runs-on: ubuntu-latest
15+
name: Check fonts on different browsers
16+
steps:
17+
- uses: actions/checkout@v2
18+
- uses: m4rc1e/font-browser-tests-action
19+
- uses: actions/upload-artifact@v2
20+
if: always()
21+
with:
22+
name: Images
23+
path: ./*.png
24+
```
25+
26+
27+
Want to test different operating systems? use a matrix.
28+
29+
```
30+
TODO
31+
```
32+
33+
## Inputs
34+
35+
You can further customise the action using the following inputs:

test.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from selenium import webdriver
2+
from platform import platform
3+
4+
options = webdriver.ChromeOptions()
5+
options.headless = True
6+
7+
driver = webdriver.Chrome(options=options)
8+
driver.get("https://www.ft.com")
9+
filename = f"{platform()}.png"
10+
el = driver.find_element_by_tag_name('body')
11+
driver.set_window_size(el.size["width"], el.size["height"])
12+
driver.save_screenshot(filename)
13+
driver.close()
14+
print(f"saved {filename}")

0 commit comments

Comments
 (0)