Skip to content

Commit 6ca438b

Browse files
fix bluetooth tests
1 parent 9898609 commit 6ca438b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

tests/bluetooth/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ async def setup_granted_device(websocket,
9797
The page will have access to the bluetooth device via the `device`
9898
JavaScript variable after this function completes.
9999
"""
100-
await goto_url(websocket, context_id, html())
100+
# Web Bluetooth works only on secure contexts, which are either localhost or
101+
# HTTPS.
102+
await goto_url(websocket, context_id, html(host='localhost'))
101103
device_address = await setup_device(websocket, context_id)
102104
await subscribe(websocket, ['bluetooth.requestDevicePromptUpdated'])
103105
await request_device(websocket, context_id, optional_services)

tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,9 +532,9 @@ def url_download(file_name="file-name.txt", content="download content"):
532532
@pytest.fixture
533533
def html(local_http_server, some_domain, another_domain):
534534
"""Return a factory for URL with the given content."""
535-
def html(content="", same_origin=True):
535+
def html(content="", host=None, same_origin=True):
536536
if same_origin:
537-
return local_http_server.url_200(host=some_domain, content=content)
537+
return local_http_server.url_200(host=host, content=content)
538538
else:
539539
return local_http_server.url_200(host=another_domain,
540540
content=content)

0 commit comments

Comments
 (0)