Skip to content

Commit

Permalink
Test edge on GHA + reduce number of GHA jobs by using tox-factor. (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Howitz committed Jun 29, 2022
1 parent 3caa47d commit 4d3b091
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
26 changes: 18 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,23 @@ on:
jobs:
build:
strategy:
fail-fast: false
matrix:
config:
# [Python version, tox env]
- ["3.7", "py37"]
- ["3.8", "py38"]
- ["3.9", "py39"]
flavour:
- wsgi
- plonetesting
- grok
browser:
- ff
- chrome
- edge
state:
- headless
# - head # disabled because it needs xvfb which is not so easy to set up on GHA

runs-on: ubuntu-latest
name: ${{ matrix.config[1] }}-${{ matrix.flavour }}-${{ matrix.browser }}-${{ matrix.state }}
name: ${{ matrix.config[1] }}-${{ matrix.browser }}-${{ matrix.state }}
steps:
- uses: actions/checkout@v2
- name: Set up Python
Expand All @@ -47,12 +45,24 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
pip install tox tox-factor
- name: Install dependencies (firefox)
if: matrix.browser == 'ff'
run: |
sudo apt-get update
sudo apt-get install firefox firefox-geckodriver
sudo apt-get install firefox
- name: Install dependencies (edge)
if: matrix.browser == 'edge'
run: |
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-dev.list'
sudo rm microsoft.gpg
sudo apt update
sudo apt install microsoft-edge-stable
- name: Test
run: |
tox -e ${{ matrix.config[1] }}-${{ matrix.flavour }}-${{ matrix.browser }}-${{ matrix.state }}
tox -f ${{ matrix.config[1] }}-${{ matrix.browser }}-${{ matrix.state }}
- name: Report to coveralls
run: |
pip install coverage coveralls
Expand Down
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Changelog

- Depend on ``webdriver-manager`` to get drivers automatically updated.

- Add support for ``edge`` headless mode.
- Add support for ``edge`` headless mode and test it on GHA.


7.0 (2022-06-28)
Expand Down
3 changes: 2 additions & 1 deletion src/gocept/selenium/tests/test_wd_selenese.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,8 @@ def test_successful_comparison_chrome(self):
reason='This test is for edge only.')
def test_successful_comparison_edge(self):
self.selenium.open('screenshot.html')
self.selenium.assertScreenshot('screenshot-edge', 'css=#block-1')
self.selenium.assertScreenshot(
'screenshot-edge', 'css=#block-1', threshold=14)

def test_raises_exception_if_image_sizes_differ(self):
self.selenium.open('screenshot.html')
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ commands =
coverage combine
coverage html
coverage xml
coverage report --fail-under=75
coverage report --fail-under=77

0 comments on commit 4d3b091

Please sign in to comment.