1
|
# SPDX-License-Identifier: CC0-1.0
|
2
|
|
3
|
"""
|
4
|
Haketilo unit tests - default script blocking policy dialog
|
5
|
"""
|
6
|
|
7
|
# This file is part of Haketilo
|
8
|
#
|
9
|
# Copyright (C) 2022, Wojtek Kosior <koszko@koszko.org>
|
10
|
#
|
11
|
# This program is free software: you can redistribute it and/or modify
|
12
|
# it under the terms of the CC0 1.0 Universal License as published by
|
13
|
# the Creative Commons Corporation.
|
14
|
#
|
15
|
# This program is distributed in the hope that it will be useful,
|
16
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18
|
# CC0 1.0 Universal License for more details.
|
19
|
|
20
|
import pytest
|
21
|
|
22
|
from ..extension_crafting import ExtraHTML
|
23
|
from ..script_loader import load_script
|
24
|
from .utils import broker_js
|
25
|
|
26
|
@pytest.mark.ext_data({
|
27
|
'background_script': broker_js,
|
28
|
'extra_html': ExtraHTML(
|
29
|
'html/default_blocking_policy.html',
|
30
|
{
|
31
|
'html/default_blocking_policy.js':
|
32
|
'init_default_policy_dialog();'
|
33
|
}
|
34
|
),
|
35
|
'navigate_to': 'html/default_blocking_policy.html'
|
36
|
})
|
37
|
@pytest.mark.usefixtures('webextension')
|
38
|
def test_default_blocking_policy_dialog(driver, wait_elem_text):
|
39
|
"""
|
40
|
A test case for the dialog that facilitates toggling the default policy of
|
41
|
script blocking.
|
42
|
"""
|
43
|
wait_elem_text('current_policy_span', 'block')
|
44
|
|
45
|
driver.find_element_by_id('toggle_policy_but').click()
|
46
|
wait_elem_text('current_policy_span', 'allow')
|
47
|
|
48
|
driver.find_element_by_id('toggle_policy_but').click()
|
49
|
wait_elem_text('current_policy_span', 'block')
|