unsafe_browser.rb 4.63 KB
Newer Older
1
When /^I see and accept the Unsafe Browser start verification$/ do
2
  next if @skip_steps_while_restoring_background
Tails developers's avatar
Tails developers committed
3
  @screen.wait("UnsafeBrowserStartVerification.png", 30)
4
  @screen.type("l", Sikuli::KeyModifier.ALT)
5 6
end

7 8 9 10 11 12
Then /^I see the Unsafe Browser start notification and wait for it to close$/ do
  next if @skip_steps_while_restoring_background
  @screen.wait("UnsafeBrowserStartNotification.png", 30)
  @screen.waitVanish("UnsafeBrowserStartNotification.png", 10)
end

13
Then /^the Unsafe Browser has started$/ do
14
  next if @skip_steps_while_restoring_background
15
  @screen.wait("UnsafeBrowserHomepage.png", 360)
16 17
end

18 19 20 21 22 23
Then /^the Unsafe Browser has no add-ons installed$/ do
  next if @skip_steps_while_restoring_background
  step "I open the address \"about:addons\" in the Unsafe Browser"
  step "I see \"UnsafeBrowserNoAddons.png\" after at most 30 seconds"
end

24
Then /^the Unsafe Browser has a red theme$/ do
25
  next if @skip_steps_while_restoring_background
26 27 28 29
  @screen.wait("UnsafeBrowserRedTheme.png", 10)
end

Then /^the Unsafe Browser shows a warning as its start page$/ do
30
  next if @skip_steps_while_restoring_background
31 32 33 34
  @screen.wait("UnsafeBrowserStartPage.png", 10)
end

When /^I start the Unsafe Browser$/ do
35
  next if @skip_steps_while_restoring_background
36
  step 'I start "UnsafeBrowser" via the GNOME "Internet" applications menu'
37 38 39 40 41
end

When /^I successfully start the Unsafe Browser$/ do
  next if @skip_steps_while_restoring_background
  step "I start the Unsafe Browser"
42
  step "I see and accept the Unsafe Browser start verification"
43
  step "I see the Unsafe Browser start notification and wait for it to close"
44
  step "the Unsafe Browser has started"
45 46 47
end

Then /^I see a warning about another instance already running$/ do
48
  next if @skip_steps_while_restoring_background
49 50 51
  @screen.wait('UnsafeBrowserWarnAlreadyRunning.png', 10)
end

Tails developers's avatar
Tails developers committed
52
When /^I close the Unsafe Browser$/ do
53
  next if @skip_steps_while_restoring_background
54
  @screen.type("q", Sikuli::KeyModifier.CTRL)
55 56
end

57 58 59 60 61 62
Then /^I see the Unsafe Browser stop notification$/ do
  next if @skip_steps_while_restoring_background
  @screen.wait('UnsafeBrowserStopNotification.png', 20)
  @screen.waitVanish('UnsafeBrowserStopNotification.png', 10)
end

63
Then /^I can start the Unsafe Browser again$/ do
64
  next if @skip_steps_while_restoring_background
65 66 67
  step "I start the Unsafe Browser"
end

68
Then /^I cannot configure the Unsafe Browser to use any local proxies$/ do
69
  next if @skip_steps_while_restoring_background
70
  @screen.wait_and_click("UnsafeBrowserWindow.png", 10)
71 72
  # First we open the proxy settings page to prepare it with the
  # correct open tabs for the loop below.
73 74
  @screen.click('UnsafeBrowserMenuButton.png')
  @screen.wait_and_click('UnsafeBrowserPreferencesButton.png', 10)
75
  @screen.wait('UnsafeBrowserPreferencesWindow.png', 10)
76 77
  @screen.wait_and_click('UnsafeBrowserAdvancedSettings.png', 10)
  @screen.wait_and_click('UnsafeBrowserNetworkTab.png', 10)
78
  sleep 0.5
79
  @screen.type(Sikuli::Key.ESC)
80 81
#  @screen.waitVanish('UnsafeBrowserPreferences.png', 10)
  sleep 0.5
82 83 84 85 86 87 88

  socks_proxy = 'c' # Alt+c for socks proxy
  no_proxy    = 'y' # Alt+y for no proxy

  proxies = [[socks_proxy, 9050],
             [socks_proxy, 9061],
             [socks_proxy, 9062],
89
             [socks_proxy, 9150],
90 91 92 93 94 95
             [no_proxy,       0]]

  proxies.each do |proxy|
    proxy_type = proxy[0]
    proxy_port = proxy[1]

96 97
    @screen.hide_cursor

98
    # Open proxy settings and select manual proxy configuration
99 100
    @screen.click('UnsafeBrowserMenuButton.png')
    @screen.wait_and_click('UnsafeBrowserPreferencesButton.png', 10)
101
    @screen.wait('UnsafeBrowserPreferencesWindow.png', 10)
102
    @screen.type("e", Sikuli::KeyModifier.ALT)
103
    @screen.wait('UnsafeBrowserProxySettings.png', 10)
104
    @screen.type("m", Sikuli::KeyModifier.ALT)
105 106

    # Configure the proxy
107 108
    @screen.type(proxy_type, Sikuli::KeyModifier.ALT)  # Select correct proxy type
    @screen.type("127.0.0.1" + Sikuli::Key.TAB + "#{proxy_port}") if proxy_type != no_proxy
109

Tails developers's avatar
Tails developers committed
110
    # Close settings
111
    @screen.type(Sikuli::Key.ENTER)
112 113
#    @screen.waitVanish('UnsafeBrowserProxySettings.png', 10)
    sleep 0.5
114
    @screen.type(Sikuli::Key.ESC)
115 116
#    @screen.waitVanish('UnsafeBrowserPreferences.png', 10)
    sleep 0.5
117 118 119 120 121 122 123 124 125 126

    # 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
127 128 129 130 131

Then /^the Unsafe Browser complains that no DNS server is configured$/ do
  next if @skip_steps_while_restoring_background
  @screen.wait("UnsafeBrowserDNSError.png", 30)
end