Skip to content

Commit 50c8fed

Browse files
committed
Split selenium tests into separate CI job
1 parent 92fec2c commit 50c8fed

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

.github/workflows/ci.yml

+26-1
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,36 @@ jobs:
9292
9393
- run: python -m pip install .[test] codecov
9494
- run: python -m pip install django~=${{ matrix.django-version }}.0
95-
- run: python -m pytest
95+
- run: python -m pytest -m "not selenium"
9696
env:
9797
PATH: $PATH:$(pwd)/bin
9898
- run: codecov
9999

100+
selenium:
101+
needs:
102+
- pytest
103+
strategy:
104+
matrix:
105+
python-version:
106+
- "3.x"
107+
runs-on: ubuntu-latest
108+
steps:
109+
- uses: actions/checkout@v3
110+
- name: Install Chrome
111+
run: sudo apt-get install -y google-chrome-stable
112+
- name: Install Selenium
113+
run: |
114+
mkdir bin
115+
curl -O https://chromedriver.storage.googleapis.com/`curl -s https://chromedriver.storage.googleapis.com/LATEST_RELEASE`/chromedriver_linux64.zip
116+
unzip chromedriver_linux64.zip -d bin
117+
- uses: actions/setup-python@v4
118+
with:
119+
python-version: ${{ matrix.python-version }}
120+
- run: python -m pip install -e .[test,selenium]
121+
- run: python -m pytest -m selenium
122+
- uses: codecov/codecov-action@v3
123+
124+
100125
analyze:
101126
name: CodeQL Analyze
102127
needs:

tests/test_forms.py

+5
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,15 @@ def test_accept(self):
135135
"application/pdf,image/*"
136136
)
137137

138+
@pytest.mark.selenium
138139
def test_no_js_error(self, driver, live_server):
139140
driver.get(live_server + self.url)
140141

141142
with pytest.raises(NoSuchElementException):
142143
error = driver.find_element(By.XPATH, "//body[@JSError]")
143144
pytest.fail(error.get_attribute("JSError"))
144145

146+
@pytest.mark.selenium
145147
def test_file_insert(
146148
self, request, driver, live_server, upload_file, freeze_upload_folder
147149
):
@@ -157,6 +159,7 @@ def test_file_insert(
157159
error = driver.find_element(By.XPATH, "//body[@JSError]")
158160
pytest.fail(error.get_attribute("JSError"))
159161

162+
@pytest.mark.selenium
160163
def test_file_insert_submit_value(
161164
self, driver, live_server, upload_file, freeze_upload_folder
162165
):
@@ -179,6 +182,7 @@ def test_file_insert_submit_value(
179182
assert "save_continue" in driver.page_source
180183
assert "continue_value" in driver.page_source
181184

185+
@pytest.mark.selenium
182186
def test_progress(self, driver, live_server, upload_file, freeze_upload_folder):
183187
driver.get(live_server + self.url)
184188
file_input = driver.find_element(By.XPATH, "//input[@name='file']")
@@ -199,6 +203,7 @@ def test_progress(self, driver, live_server, upload_file, freeze_upload_folder):
199203
response = json.loads(driver.find_elements(By.CSS_SELECTOR, "pre")[0].text)
200204
assert response["POST"]["progress"] == "1"
201205

206+
@pytest.mark.selenium
202207
def test_multi_file(
203208
self,
204209
driver,

0 commit comments

Comments
 (0)