aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-03-08 18:15:23 +0100
committerWojtek Kosior <koszko@koszko.org>2022-03-10 11:43:51 +0100
commit003876d507112ebe2575086514d5a388f78dedd9 (patch)
tree58cc0e5f119df559377dbff830d140110eca35a0 /test
parent093ec2a52697afdda610dde1302a59183719ac0f (diff)
downloadbrowser-extension-003876d507112ebe2575086514d5a388f78dedd9.tar.gz
browser-extension-003876d507112ebe2575086514d5a388f78dedd9.zip
present appropriate error message when using popup in Private Browsing mode
Diffstat (limited to 'test')
-rw-r--r--test/haketilo_test/unit/test_repo_query.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/test/haketilo_test/unit/test_repo_query.py b/test/haketilo_test/unit/test_repo_query.py
index 177d415..f6cae93 100644
--- a/test/haketilo_test/unit/test_repo_query.py
+++ b/test/haketilo_test/unit/test_repo_query.py
@@ -28,7 +28,7 @@ repo_urls = [f'https://hydril.la/{s}' for s in ('', '1/', '2/', '3/', '4/')]
queried_url = 'https://example_a.com/something'
-def setup_view(execute_in_page, repo_urls):
+def setup_view(execute_in_page, repo_urls, tab={'id': 0}):
mock_cacher(execute_in_page)
execute_in_page(load_script('html/repo_query.js'))
@@ -37,7 +37,7 @@ def setup_view(execute_in_page, repo_urls):
const repo_proms = arguments[0].map(url => haketilodb.set_repo(url));
const cb_calls = [];
- const view = new RepoQueryView(0,
+ const view = new RepoQueryView(arguments[1],
() => cb_calls.push("show"),
() => cb_calls.push("hide"));
document.body.append(view.main_div);
@@ -45,7 +45,7 @@ def setup_view(execute_in_page, repo_urls):
returnval(Promise.all(repo_proms));
''',
- repo_urls)
+ repo_urls, tab)
repo_query_ext_data = {
'background_script': broker_js,
@@ -133,6 +133,7 @@ def test_repo_query_normal_usage(driver, execute_in_page):
@pytest.mark.parametrize('message', [
'browsing_for',
'no_repos',
+ 'private_mode',
'failure_to_communicate',
'HTTP_code',
'invalid_JSON',
@@ -174,8 +175,13 @@ def test_repo_query_messages(driver, execute_in_page, message):
show_and_wait_for_repo_entry()
elem = execute_in_page('returnval(view.repos_list);')
- done = has_msg('You have no repositories configured :(', elem)
- WebDriverWait(driver, 10).until(done)
+ assert has_msg('You have no repositories configured :(', elem)(0)
+ elif message == 'private_mode':
+ setup_view(execute_in_page, repo_urls, tab={'id': 0, 'incognito': True})
+ show_and_wait_for_repo_entry()
+
+ elem = execute_in_page('returnval(view.top_text);')
+ assert has_msg('when in Private Browsing mode', elem)(0)
elif message == 'failure_to_communicate':
setup_view(execute_in_page, repo_urls)
execute_in_page(