Revision 003876d5
Added by koszko over 1 year ago
test/haketilo_test/unit/test_repo_query.py | ||
---|---|---|
28 | 28 |
|
29 | 29 |
queried_url = 'https://example_a.com/something' |
30 | 30 |
|
31 |
def setup_view(execute_in_page, repo_urls): |
|
31 |
def setup_view(execute_in_page, repo_urls, tab={'id': 0}):
|
|
32 | 32 |
mock_cacher(execute_in_page) |
33 | 33 |
|
34 | 34 |
execute_in_page(load_script('html/repo_query.js')) |
... | ... | |
37 | 37 |
const repo_proms = arguments[0].map(url => haketilodb.set_repo(url)); |
38 | 38 |
|
39 | 39 |
const cb_calls = []; |
40 |
const view = new RepoQueryView(0,
|
|
40 |
const view = new RepoQueryView(arguments[1],
|
|
41 | 41 |
() => cb_calls.push("show"), |
42 | 42 |
() => cb_calls.push("hide")); |
43 | 43 |
document.body.append(view.main_div); |
... | ... | |
45 | 45 |
|
46 | 46 |
returnval(Promise.all(repo_proms)); |
47 | 47 |
''', |
48 |
repo_urls) |
|
48 |
repo_urls, tab)
|
|
49 | 49 |
|
50 | 50 |
repo_query_ext_data = { |
51 | 51 |
'background_script': broker_js, |
... | ... | |
133 | 133 |
@pytest.mark.parametrize('message', [ |
134 | 134 |
'browsing_for', |
135 | 135 |
'no_repos', |
136 |
'private_mode', |
|
136 | 137 |
'failure_to_communicate', |
137 | 138 |
'HTTP_code', |
138 | 139 |
'invalid_JSON', |
... | ... | |
174 | 175 |
show_and_wait_for_repo_entry() |
175 | 176 |
|
176 | 177 |
elem = execute_in_page('returnval(view.repos_list);') |
177 |
done = has_msg('You have no repositories configured :(', elem) |
|
178 |
WebDriverWait(driver, 10).until(done) |
|
178 |
assert has_msg('You have no repositories configured :(', elem)(0) |
|
179 |
elif message == 'private_mode': |
|
180 |
setup_view(execute_in_page, repo_urls, tab={'id': 0, 'incognito': True}) |
|
181 |
show_and_wait_for_repo_entry() |
|
182 |
|
|
183 |
elem = execute_in_page('returnval(view.top_text);') |
|
184 |
assert has_msg('when in Private Browsing mode', elem)(0) |
|
179 | 185 |
elif message == 'failure_to_communicate': |
180 | 186 |
setup_view(execute_in_page, repo_urls) |
181 | 187 |
execute_in_page( |
Also available in: Unified diff
present appropriate error message when using popup in Private Browsing mode