aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-03-08 17:34:37 +0100
committerWojtek Kosior <koszko@koszko.org>2022-03-08 17:34:37 +0100
commit093ec2a52697afdda610dde1302a59183719ac0f (patch)
tree1216a20fed8a04b83bdd6ef42f6134c9bddd7a77 /test
parent96efcc335bbd9f2ad098e694d6cff6c1c22b4ce8 (diff)
downloadbrowser-extension-093ec2a52697afdda610dde1302a59183719ac0f.tar.gz
browser-extension-093ec2a52697afdda610dde1302a59183719ac0f.zip
correct the Private Browsing mode notice on settings page
Diffstat (limited to 'test')
-rw-r--r--test/haketilo_test/unit/test_settings.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/test/haketilo_test/unit/test_settings.py b/test/haketilo_test/unit/test_settings.py
index 92ec4b6..6f669cb 100644
--- a/test/haketilo_test/unit/test_settings.py
+++ b/test/haketilo_test/unit/test_settings.py
@@ -81,16 +81,19 @@ def test_settings_page_tabs(driver, execute_in_page):
})
@pytest.mark.usefixtures('webextension')
@pytest.mark.parametrize('incognito', [True, False])
-def test_settings_page_indexeddb_error(driver, execute_in_page, incognito):
+def test_settings_page_error(driver, execute_in_page, incognito):
"""
- Test if failure to access IndexedDB in settings page results in the
- appropriate message being shown.
+ Test whether being in Private Browsing mode and failure to access IndexedDB
+ in settings page result in the appropriate messages being shown.
"""
+ error_divs = 'indexeddb_error', 'private_mode_error'
+
execute_in_page(
'''{
/*
* Mock an unavailable IndexedDB. Calling onerror() without having set
- * "errorCode" on the request is the behavior observed under Mozilla.
+ * "errorCode" on the request is the behavior observed under Mozilla
+ * when IndexedDB is disabled.
*/
indexedDB.open = function() {
const dummy_open_request = {};
@@ -108,11 +111,7 @@ def test_settings_page_indexeddb_error(driver, execute_in_page, incognito):
incognito)
WebDriverWait(driver, 10)\
- .until(EC.visibility_of_element_located((By.ID, 'indexeddb_error')))
+ .until(EC.visibility_of_element_located((By.ID, error_divs[incognito])))
assert driver.find_elements_by_id('loader') == []
assert not driver.find_element_by_id('main_view').is_displayed()
-
- if incognito:
- assert driver.find_element_by_id('indexeddb_private_mode_explanation')\
- .is_displayed()