From a6f41c35e337db192e612ee6e1545fcae4c69ac7 Mon Sep 17 00:00:00 2001 From: Philip Hands Date: Thu, 29 Jun 2017 22:11:09 +0200 Subject: lvc: grab updates from tails (01371c19bd..6ae59c49e5) Signed-off-by: Holger Levsen --- .../features/step_definitions/unsafe_browser.rb | 45 ++++++++++++++-------- 1 file changed, 30 insertions(+), 15 deletions(-) (limited to 'cucumber/features/step_definitions/unsafe_browser.rb') diff --git a/cucumber/features/step_definitions/unsafe_browser.rb b/cucumber/features/step_definitions/unsafe_browser.rb index b8c04983..160279ca 100644 --- a/cucumber/features/step_definitions/unsafe_browser.rb +++ b/cucumber/features/step_definitions/unsafe_browser.rb @@ -1,6 +1,11 @@ -When /^I see and accept the Unsafe Browser start verification$/ do +When /^I see and accept the Unsafe Browser start verification(?:| in the "([^"]+)" locale)$/ do |locale| @screen.wait('GnomeQuestionDialogIcon.png', 30) - @screen.type(Sikuli::Key.ESC) + if ['ar_EG.utf8', 'fa_IR'].include?(locale) + # Take into account button ordering in RTL languages + @screen.type(Sikuli::Key.LEFT + Sikuli::Key.ENTER) + else + @screen.type(Sikuli::Key.RIGHT + Sikuli::Key.ENTER) + end end def supported_torbrowser_languages @@ -8,7 +13,8 @@ def supported_torbrowser_languages File.read(localization_descriptions).split("\n").map do |line| # The line will be of the form "xx:YY:..." or "xx-YY:YY:..." first, second = line.sub('-', '_').split(':') - candidates = ["#{first}_#{second}.utf8", "#{first}.utf8", + candidates = ["#{first}_#{second}.UTF-8", "#{first}_#{second}.utf8", + "#{first}.UTF-8", "#{first}.utf8", "#{first}_#{second}", first] when_not_found = Proc.new { raise "Could not find a locale for '#{line}'" } candidates.find(when_not_found) do |candidate| @@ -19,12 +25,12 @@ end Then /^I start the Unsafe Browser in the "([^"]+)" locale$/ do |loc| step "I run \"LANG=#{loc} LC_ALL=#{loc} sudo unsafe-browser\" in GNOME Terminal" - step "I see and accept the Unsafe Browser start verification" + step "I see and accept the Unsafe Browser start verification in the \"#{loc}\" locale" end Then /^the Unsafe Browser works in all supported languages$/ do failed = Array.new - supported_torbrowser_languages.each do |lang| + supported_torbrowser_languages.sample(3).each do |lang| step "I start the Unsafe Browser in the \"#{lang}\" locale" begin step "the Unsafe Browser has started" @@ -85,7 +91,7 @@ Then /^the Unsafe Browser has only Firefox's default bookmarks configured$/ do assert_equal(5, mozilla_uris_counter, "Unexpected number (#{mozilla_uris_counter}) of mozilla " \ "bookmarks") - assert_equal(3, places_uris_counter, + assert_equal(2, places_uris_counter, "Unexpected number (#{places_uris_counter}) of places " \ "bookmarks") @screen.type(Sikuli::Key.F4, Sikuli::KeyModifier.ALT) @@ -108,7 +114,7 @@ Then /^I can start the Unsafe Browser again$/ do end Then /^I cannot configure the Unsafe Browser to use any local proxies$/ do - socks_proxy = 'c' # Alt+c for socks proxy + socks_proxy = 'C' # Alt+Shift+c for socks proxy no_proxy = 'y' # Alt+y for no proxy proxies = [[no_proxy, nil, nil]] socksport_lines = @@ -120,7 +126,7 @@ Then /^I cannot configure the Unsafe Browser to use any local proxies$/ do proxies.each do |proxy_type, proxy_host, proxy_port| @screen.hide_cursor - # Open proxy settings and select manual proxy configuration + # Open proxy settings @screen.click('UnsafeBrowserMenuButton.png') @screen.wait_and_click('UnsafeBrowserPreferencesButton.png', 10) @screen.wait_and_click('UnsafeBrowserAdvancedSettingsButton.png', 10) @@ -129,20 +135,25 @@ Then /^I cannot configure the Unsafe Browser to use any local proxies$/ do @screen.click(hit) if hit == 'UnsafeBrowserNetworkTab.png' @screen.wait_and_click('UnsafeBrowserNetworkTabSettingsButton.png', 10) @screen.wait_and_click('UnsafeBrowserProxySettingsWindow.png', 10) - @screen.type("m", Sikuli::KeyModifier.ALT) - # Configure the proxy - @screen.type(proxy_type, Sikuli::KeyModifier.ALT) # Select correct proxy type - @screen.type(proxy_host + Sikuli::Key.TAB + proxy_port) if proxy_type != no_proxy + # Ensure the desired proxy configuration + if proxy_type == no_proxy + @screen.type(proxy_type, Sikuli::KeyModifier.ALT) + @screen.wait('UnsafeBrowserNoProxySelected.png', 10) + else + @screen.type("M", Sikuli::KeyModifier.ALT) + @screen.type(proxy_type, Sikuli::KeyModifier.ALT) + @screen.type(proxy_host + Sikuli::Key.TAB + proxy_port) + end # Close settings @screen.click('UnsafeBrowserProxySettingsOkButton.png') @screen.waitVanish('UnsafeBrowserProxySettingsWindow.png', 10) # Test that the proxy settings work as they should - step "I open the address \"https://check.torproject.org\" in the Unsafe Browser" + step 'I open Tails homepage in the Unsafe Browser' if proxy_type == no_proxy - @screen.wait('UnsafeBrowserTorCheckFail.png', 60) + step 'Tails homepage loads in the Unsafe Browser' else @screen.wait('UnsafeBrowserProxyRefused.png', 60) end @@ -162,7 +173,11 @@ Then /^the Unsafe Browser has no proxy configured$/ do end Then /^the Unsafe Browser complains that no DNS server is configured$/ do - @screen.wait("UnsafeBrowserDNSError.png", 30) + assert_not_nil( + Dogtail::Application.new('zenity') + .child(roleName: 'label') + .text['No DNS server was obtained'] + ) end Then /^I configure the Unsafe Browser to check for updates more frequently$/ do -- cgit v1.2.3-70-g09d2