Commit 4d761fd1 authored by Tails developers's avatar Tails developers
Browse files

Add scenario testing that Unsafe Browser can't use local proxies.

parent 8d625be2
......@@ -14,6 +14,7 @@ module Sikuli
KEY_F10 = "\356\200\230"
KEY_F11 = "\356\200\231"
KEY_F12 = "\356\200\232"
KEY_ESC = Key::ESC
end
module Sikuli::Clickable
......
......@@ -61,3 +61,66 @@ When /^I open the address "([^"]*)" in the Unsafe Browser$/ do |address|
@screen.type("l", Sikuli::KEY_CTRL)
@screen.type(address + Sikuli::KEY_RETURN)
end
Then /^I cannot configure the Unsafe Browser to use any local proxies$/ do
# First we open the proxy settings page to prepare it with the
# correct open tabs for the loop below.
@screen.type("e", Sikuli::KEY_ALT)
@screen.type("n")
@screen.wait('UnsafeBrowserPreferences.png', 10)
@screen.wait('UnsafeBrowserAdvancedSettings.png', 10)
@screen.click('UnsafeBrowserAdvancedSettings.png')
@screen.wait('UnsafeBrowserNetworkTab.png', 10)
@screen.click('UnsafeBrowserNetworkTab.png')
sleep 0.5
@screen.type(Sikuli::KEY_ESC)
@screen.waitVanish('UnsafeBrowserPreferences.png', 10)
http_proxy = 'x' # Alt+x is the shortcut to select http proxy
socks_proxy = 'c' # Alt+c for socks proxy
no_proxy = 'y' # Alt+y for no proxy
# Note: the loop below depends on that http_proxy is done after any
# other proxy types since it will set "Use this proxy server for all
# protocols", which will make the other proxy types unselectable.
proxies = [[socks_proxy, 9050],
[socks_proxy, 9061],
[socks_proxy, 9062],
[socks_proxy, 9063],
[http_proxy, 8118],
[no_proxy, 0]]
proxies.each do |proxy|
proxy_type = proxy[0]
proxy_port = proxy[1]
# Open proxy settings and select manual proxy configuration
@screen.type("e", Sikuli::KEY_ALT)
@screen.type("n")
@screen.wait('UnsafeBrowserPreferences.png', 10)
@screen.type("e", Sikuli::KEY_ALT)
@screen.wait('UnsafeBrowserProxySettings.png', 10)
@screen.type("m", Sikuli::KEY_ALT)
# Configure the proxy
@screen.type(proxy_type, Sikuli::KEY_ALT) # Select correct proxy type
@screen.type("localhost\t#{proxy_port}") if proxy_type != no_proxy
# For http proxy we set "Use this proxy server for all protocols"
@screen.type("s", Sikuli::KEY_ALT) if proxy_type == http_proxy
# Close settings settings
@screen.type(Sikuli::KEY_RETURN)
@screen.waitVanish('UnsafeBrowserProxySettings.png', 10)
@screen.type(Sikuli::KEY_ESC)
@screen.waitVanish('UnsafeBrowserPreferences.png', 10)
# Test that the proxy settings work as they should
step "I open the address \"https://check.torproject.org\" in the Unsafe Browser"
if proxy_type == no_proxy
@screen.wait('UnsafeBrowserTorCheckFail.png', 60)
else
@screen.wait('UnsafeBrowserProxyRefused.png', 60)
end
end
end
......@@ -45,3 +45,7 @@ Feature: Browsing the web using the Unsafe Browser
When I start the Unsafe Browser
And I open the address "https://check.torproject.org" in the Unsafe Browser
Then I see "UnsafeBrowserTorCheckFail.png" after at most 30 seconds
Scenario: The Unsafe Browser cannot be configured to use Tor and other local proxies.
When I start the Unsafe Browser
Then I cannot configure the Unsafe Browser to use any local proxies
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment