Revision 093ec2a5
Added by koszko over 1 year ago
test/haketilo_test/unit/test_settings.py | ||
---|---|---|
81 | 81 |
}) |
82 | 82 |
@pytest.mark.usefixtures('webextension') |
83 | 83 |
@pytest.mark.parametrize('incognito', [True, False]) |
84 |
def test_settings_page_indexeddb_error(driver, execute_in_page, incognito):
|
|
84 |
def test_settings_page_error(driver, execute_in_page, incognito): |
|
85 | 85 |
""" |
86 |
Test if failure to access IndexedDB in settings page results in the
|
|
87 |
appropriate message being shown.
|
|
86 |
Test whether being in Private Browsing mode and failure to access IndexedDB
|
|
87 |
in settings page result in the appropriate messages being shown.
|
|
88 | 88 |
""" |
89 |
error_divs = 'indexeddb_error', 'private_mode_error' |
|
90 |
|
|
89 | 91 |
execute_in_page( |
90 | 92 |
'''{ |
91 | 93 |
/* |
92 | 94 |
* Mock an unavailable IndexedDB. Calling onerror() without having set |
93 |
* "errorCode" on the request is the behavior observed under Mozilla. |
|
95 |
* "errorCode" on the request is the behavior observed under Mozilla |
|
96 |
* when IndexedDB is disabled. |
|
94 | 97 |
*/ |
95 | 98 |
indexedDB.open = function() { |
96 | 99 |
const dummy_open_request = {}; |
... | ... | |
108 | 111 |
incognito) |
109 | 112 |
|
110 | 113 |
WebDriverWait(driver, 10)\ |
111 |
.until(EC.visibility_of_element_located((By.ID, 'indexeddb_error')))
|
|
114 |
.until(EC.visibility_of_element_located((By.ID, error_divs[incognito])))
|
|
112 | 115 |
|
113 | 116 |
assert driver.find_elements_by_id('loader') == [] |
114 | 117 |
assert not driver.find_element_by_id('main_view').is_displayed() |
115 |
|
|
116 |
if incognito: |
|
117 |
assert driver.find_element_by_id('indexeddb_private_mode_explanation')\ |
|
118 |
.is_displayed() |
Also available in: Unified diff
correct the Private Browsing mode notice on settings page