Skip to content

Commit d062652

Browse files
committed
fix channel tests
1 parent 42d786a commit d062652

File tree

3 files changed

+57
-111
lines changed

3 files changed

+57
-111
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Install browsers
3131
run: python -m playwright install
3232
- name: Lint
33-
uses: pre-commit/action@v2.0.0
33+
uses: pre-commit/action@v2.0.3
3434
- name: Generate APIs
3535
run: bash scripts/update_api.sh
3636
- name: Verify generated API is up to date
@@ -126,10 +126,6 @@ jobs:
126126
browser-channel: msedge
127127
runs-on: ${{ matrix.os }}
128128
steps:
129-
- name: Install Media Pack
130-
if: matrix.os == 'windows-latest'
131-
shell: powershell
132-
run: Install-WindowsFeature Server-Media-Foundation
133129
- uses: actions/checkout@v2
134130
- name: Set up Python
135131
uses: actions/setup-python@v2
@@ -142,8 +138,8 @@ jobs:
142138
pip install -e .
143139
python setup.py bdist_wheel
144140
python -m playwright install-deps
145-
- name: Install ffmpeg
146-
run: python -m playwright install ffmpeg
141+
- name: Install browsers
142+
run: python -m playwright install ${{ matrix.browser-channel }}
147143
- name: Common Tests
148144
run: pytest tests/common --browser=chromium --browser-channel=${{ matrix.browser-channel }} --timeout 90
149145
- name: Test Sync API

tests/async/test_accessibility.py

Lines changed: 27 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -221,29 +221,17 @@ async def test_accessibility_filtering_children_of_leaf_nodes_rich_text_editable
221221
"children": [{"role": "text", "name": "my fake image"}],
222222
}
223223
else:
224-
if browser_channel:
225-
golden = {
226-
"role": "textbox",
227-
"name": "",
228-
"value": "Edit this image: ",
229-
"children": [
230-
{"role": "text", "name": "Edit this image:"},
231-
{"role": "img", "name": "my fake image"},
232-
],
233-
"value": "Edit this image: ",
234-
}
235-
else:
236-
golden = {
237-
"role": "textbox",
238-
"name": "",
239-
"multiline": True,
240-
"value": "Edit this image: ",
241-
"children": [
242-
{"role": "text", "name": "Edit this image:"},
243-
{"role": "img", "name": "my fake image"},
244-
],
245-
"value": "Edit this image: ",
246-
}
224+
golden = {
225+
"role": "textbox",
226+
"name": "",
227+
"multiline": True,
228+
"value": "Edit this image: ",
229+
"children": [
230+
{"role": "text", "name": "Edit this image:"},
231+
{"role": "img", "name": "my fake image"},
232+
],
233+
"value": "Edit this image: ",
234+
}
247235
snapshot = await page.accessibility.snapshot()
248236
assert snapshot["children"][0] == golden
249237

@@ -259,19 +247,12 @@ async def test_accessibility_plain_text_field_with_role_should_not_have_children
259247
<div contenteditable="plaintext-only" role='textbox'>Edit this image:<img src="fakeimage.png" alt="my fake image"></div>"""
260248
)
261249
snapshot = await page.accessibility.snapshot()
262-
if browser_channel:
263-
assert snapshot["children"][0] == {
264-
"name": "",
265-
"role": "textbox",
266-
"value": "Edit this image:",
267-
}
268-
else:
269-
assert snapshot["children"][0] == {
270-
"multiline": True,
271-
"name": "",
272-
"role": "textbox",
273-
"value": "Edit this image:",
274-
}
250+
assert snapshot["children"][0] == {
251+
"multiline": True,
252+
"name": "",
253+
"role": "textbox",
254+
"value": "Edit this image:",
255+
}
275256

276257

277258
@pytest.mark.only_browser("chromium")
@@ -283,14 +264,11 @@ async def test_accessibility_plain_text_field_without_role_should_not_have_conte
283264
<div contenteditable="plaintext-only">Edit this image:<img src="fakeimage.png" alt="my fake image"></div>"""
284265
)
285266
snapshot = await page.accessibility.snapshot()
286-
if browser_channel:
287-
assert snapshot["children"][0] == {"name": "", "role": "generic"}
288-
else:
289-
assert snapshot["children"][0] == {
290-
"name": "",
291-
"role": "generic",
292-
"value": "Edit this image:",
293-
}
267+
assert snapshot["children"][0] == {
268+
"name": "",
269+
"role": "generic",
270+
"value": "Edit this image:",
271+
}
294272

295273

296274
@pytest.mark.only_browser("chromium")
@@ -302,14 +280,11 @@ async def test_accessibility_plain_text_field_with_tabindex_and_without_role_sho
302280
<div contenteditable="plaintext-only" tabIndex=0>Edit this image:<img src="fakeimage.png" alt="my fake image"></div>"""
303281
)
304282
snapshot = await page.accessibility.snapshot()
305-
if browser_channel:
306-
assert snapshot["children"][0] == {"name": "", "role": "generic"}
307-
else:
308-
assert snapshot["children"][0] == {
309-
"name": "",
310-
"role": "generic",
311-
"value": "Edit this image:",
312-
}
283+
assert snapshot["children"][0] == {
284+
"name": "",
285+
"role": "generic",
286+
"value": "Edit this image:",
287+
}
313288

314289

315290
async def test_accessibility_non_editable_textbox_with_role_and_tabIndex_and_label_should_not_have_children(

tests/sync/test_accessibility.py

Lines changed: 27 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -215,29 +215,17 @@ def test_accessibility_filtering_children_of_leaf_nodes_rich_text_editable_field
215215
"children": [{"role": "text", "name": "my fake image"}],
216216
}
217217
else:
218-
if browser_channel:
219-
golden = {
220-
"role": "textbox",
221-
"name": "",
222-
"value": "Edit this image: ",
223-
"children": [
224-
{"role": "text", "name": "Edit this image:"},
225-
{"role": "img", "name": "my fake image"},
226-
],
227-
"value": "Edit this image: ",
228-
}
229-
else:
230-
golden = {
231-
"role": "textbox",
232-
"name": "",
233-
"multiline": True,
234-
"value": "Edit this image: ",
235-
"children": [
236-
{"role": "text", "name": "Edit this image:"},
237-
{"role": "img", "name": "my fake image"},
238-
],
239-
"value": "Edit this image: ",
240-
}
218+
golden = {
219+
"role": "textbox",
220+
"name": "",
221+
"multiline": True,
222+
"value": "Edit this image: ",
223+
"children": [
224+
{"role": "text", "name": "Edit this image:"},
225+
{"role": "img", "name": "my fake image"},
226+
],
227+
"value": "Edit this image: ",
228+
}
241229
snapshot = page.accessibility.snapshot()
242230
assert snapshot["children"][0] == golden
243231

@@ -253,19 +241,12 @@ def test_accessibility_plain_text_field_with_role_should_not_have_children(
253241
<div contenteditable="plaintext-only" role='textbox'>Edit this image:<img src="fakeimage.png" alt="my fake image"></div>"""
254242
)
255243
snapshot = page.accessibility.snapshot()
256-
if browser_channel:
257-
assert snapshot["children"][0] == {
258-
"name": "",
259-
"role": "textbox",
260-
"value": "Edit this image:",
261-
}
262-
else:
263-
assert snapshot["children"][0] == {
264-
"multiline": True,
265-
"name": "",
266-
"role": "textbox",
267-
"value": "Edit this image:",
268-
}
244+
assert snapshot["children"][0] == {
245+
"multiline": True,
246+
"name": "",
247+
"role": "textbox",
248+
"value": "Edit this image:",
249+
}
269250

270251

271252
@pytest.mark.only_browser("chromium")
@@ -277,14 +258,11 @@ def test_accessibility_plain_text_field_without_role_should_not_have_content(
277258
<div contenteditable="plaintext-only">Edit this image:<img src="fakeimage.png" alt="my fake image"></div>"""
278259
)
279260
snapshot = page.accessibility.snapshot()
280-
if browser_channel:
281-
assert snapshot["children"][0] == {"name": "", "role": "generic"}
282-
else:
283-
assert snapshot["children"][0] == {
284-
"name": "",
285-
"role": "generic",
286-
"value": "Edit this image:",
287-
}
261+
assert snapshot["children"][0] == {
262+
"name": "",
263+
"role": "generic",
264+
"value": "Edit this image:",
265+
}
288266

289267

290268
@pytest.mark.only_browser("chromium")
@@ -296,14 +274,11 @@ def test_accessibility_plain_text_field_with_tabindex_and_without_role_should_no
296274
<div contenteditable="plaintext-only" tabIndex=0>Edit this image:<img src="fakeimage.png" alt="my fake image"></div>"""
297275
)
298276
snapshot = page.accessibility.snapshot()
299-
if browser_channel:
300-
assert snapshot["children"][0] == {"name": "", "role": "generic"}
301-
else:
302-
assert snapshot["children"][0] == {
303-
"name": "",
304-
"role": "generic",
305-
"value": "Edit this image:",
306-
}
277+
assert snapshot["children"][0] == {
278+
"name": "",
279+
"role": "generic",
280+
"value": "Edit this image:",
281+
}
307282

308283

309284
def test_accessibility_non_editable_textbox_with_role_and_tabIndex_and_label_should_not_have_children(

0 commit comments

Comments
 (0)