Skip to content

Commit 7cf623e

Browse files
committed
Add Firefox and Safari to Selenium CI suite
1 parent 8bc91ee commit 7cf623e

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,19 @@ jobs:
6464
with:
6565
token: ${{ secrets.CODECOV_TOKEN }}
6666
flags: python-${{ matrix.python-version }}
67-
Selenium:
67+
selenium:
6868
needs:
69-
- standardjs
70-
runs-on: ubuntu-latest
69+
- PyTest
70+
strategy:
71+
fail-fast: false
72+
matrix:
73+
os: [ubuntu-latest, macos-latest]
74+
runs-on: ${{ matrix.os }}
7175
steps:
7276
- uses: actions/checkout@v6
73-
- name: Install Selenium
74-
run: |
75-
curl -LsSfO https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
76-
sudo dpkg -i google-chrome-stable_current_amd64.deb || sudo apt-get -f install -y
7777
- uses: astral-sh/setup-uv@v7
7878
- run: uv run pytest -m selenium
7979
- uses: codecov/codecov-action@v5
8080
with:
8181
token: ${{ secrets.CODECOV_TOKEN }}
82-
flags: selenium
82+
flags: selenium-${{ matrix.os }}

tests/conftest.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ def random_name(n):
2525
return "-".join([x.capitalize() for x in words])
2626

2727

28-
@pytest.fixture(scope="session")
29-
def driver():
30-
chrome_options = webdriver.ChromeOptions()
31-
chrome_options.add_argument("--headless=new")
28+
@pytest.fixture(scope="session", params=["Chrome", "Safari", "Firefox"])
29+
def driver(request):
30+
options = getattr(webdriver, f"{request.param}Options")()
31+
options.add_argument("--headless")
3232
try:
33-
b = webdriver.Chrome(options=chrome_options)
33+
b = getattr(webdriver, request.param)(options=options)
3434
except WebDriverException as e:
3535
pytest.skip(str(e))
3636
else:

tests/test_forms.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -751,12 +751,11 @@ def test_widgets_selected_after_validation_error(
751751

752752
# clicking country select2 lists reduced list to the only country available to the city
753753
country_container.click()
754-
WebDriverWait(driver, 60).until(
755-
expected_conditions.presence_of_element_located(
754+
country_options = WebDriverWait(driver, 60).until(
755+
expected_conditions.presence_of_all_elements_located(
756756
(By.CSS_SELECTOR, ".select2-results li")
757757
)
758758
)
759-
country_options = driver.find_elements(By.CSS_SELECTOR, ".select2-results li")
760759
country_names_from_browser = {option.text for option in country_options}
761760
country_names_from_db = {City.objects.get(name=city_name).country.name}
762761
assert len(country_names_from_browser) != Country.objects.count()

0 commit comments

Comments
 (0)