Skip to content

Commit ef153d5

Browse files
committed
Add Firefox and Safari to Selenium CI suite
1 parent 48698c8 commit ef153d5

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,19 @@ jobs:
6161
python-version: ${{ matrix.python-version }}
6262
- run: uv run --with Django~=${{ matrix.django-version }}.0 pytest -m "not selenium"
6363
- uses: codecov/codecov-action@v5
64-
Selenium:
64+
selenium:
6565
needs:
66-
- standardjs
67-
runs-on: ubuntu-latest
66+
- PyTest
67+
strategy:
68+
fail-fast: false
69+
matrix:
70+
os: [ubuntu-latest, macos-latest]
71+
runs-on: ${{ matrix.os }}
6872
steps:
6973
- uses: actions/checkout@v6
70-
- name: Install Selenium
71-
run: |
72-
curl -LsSfO https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
73-
sudo dpkg -i google-chrome-stable_current_amd64.deb || sudo apt-get -f install -y
7474
- uses: astral-sh/setup-uv@v7
7575
- run: uv run pytest -m selenium
7676
- uses: codecov/codecov-action@v5
77+
with:
78+
token: ${{ secrets.CODECOV_TOKEN }}
79+
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)