Commit 58f77890 authored by Tails developers's avatar Tails developers
Browse files

Make all steps skippable, as they should be.

That is, according to the Art of writing step definitions in the
automated test suite docs.
parent ef0b9914
......@@ -13,6 +13,7 @@ Given /^the only hosts in APT sources are "([^"]*)"$/ do |hosts_str|
end
When /^I update APT using apt-get$/ do
next if @skip_steps_while_restoring_background
SystemTimer.timeout(30*60) do
cmd = @vm.execute("echo #{@sudo_password} | " +
"sudo -S apt-get update", $live_user)
......@@ -23,6 +24,7 @@ When /^I update APT using apt-get$/ do
end
Then /^I should be able to install a package using apt-get$/ do
next if @skip_steps_while_restoring_background
package = "cowsay"
SystemTimer.timeout(120) do
cmd = @vm.execute("echo #{@sudo_password} | " +
......@@ -35,6 +37,7 @@ Then /^I should be able to install a package using apt-get$/ do
end
When /^I update APT using Synaptic$/ do
next if @skip_steps_while_restoring_background
# Upon start the interface will be frozen while Synaptic loads the
# package list. Since the frozen GUI is so similar to the unfrozen
# one there's no easy way to reliably wait for the latter. Hence we
......@@ -47,6 +50,7 @@ When /^I update APT using Synaptic$/ do
end
Then /^I should be able to install a package using Synaptic$/ do
next if @skip_steps_while_restoring_background
package = "cowsay"
# We do this after a Reload, so the interface will be frozen until
# the package list has been loaded
......
......@@ -89,6 +89,7 @@ Given /^I plug ([[:alpha:]]+) drive "([^"]+)"$/ do |bus, name|
end
Then /^drive "([^"]+)" is detected by Tails$/ do |name|
next if @skip_steps_while_restoring_background
if @vm.is_running?
try_for(10, :msg => "Drive '#{name}' is not detected by Tails") {
@vm.disk_detected?(name)
......@@ -192,6 +193,7 @@ Given /^I set sudo password "([^"]*)"$/ do |password|
end
Given /^Tails Greeter has dealt with the sudo password$/ do
next if @skip_steps_while_restoring_background
f1 = "/etc/sudoers.d/tails-greeter"
f2 = "#{f1}-no-password-lecture"
try_for(20) {
......@@ -364,6 +366,7 @@ Given /^I enter the sudo password in the gksu prompt$/ do
end
Given /^I enter the sudo password in the PolicyKit prompt$/ do
next if @skip_steps_while_restoring_background
step "I enter the \"#{@sudo_password}\" password in the PolicyKit prompt"
end
......
......@@ -138,6 +138,7 @@ Given /^I fill the guest's memory with a known pattern$/ do
end
Then /^I find very few patterns in the guest's memory$/ do
next if @skip_steps_while_restoring_background
coverage = pattern_coverage_in_guest_ram()
max_coverage = 0.001
assert(coverage < max_coverage,
......
Then /^I should be able to run administration commands as the live user$/ do
next if @skip_steps_while_restoring_background
stdout = @vm.execute("echo #{@sudo_password} | sudo -S whoami", $live_user).stdout
assert(stdout.sub(/^\[sudo\] password for #{$live_user}: /, "") == "root\n",
"Could not use sudo")
end
Then /^I should not be able to run administration commands as the live user with the "([^"]*)" password$/ do |password|
next if @skip_steps_while_restoring_background
stderr = @vm.execute("echo #{password} | sudo -S whoami", $live_user).stderr
sudo_failed = stderr.include?("The administration password is disabled") || stderr.include?("is not allowed to execute")
assert(sudo_failed, "The administration password is not disabled:" + stderr)
......
......@@ -31,6 +31,7 @@ When /^the "([^"]*)" key is in the live user's public keyring after at most (\d+
end
When /^I fetch the "([^"]*)" OpenPGP key using Seahorse$/ do |keyid|
next if @skip_steps_while_restoring_background
step "I run \"seahorse\""
@screen.wait("SeahorseWindow.png", 10)
@screen.type("r", Sikuli::KEY_ALT) # Menu: "Remote" ->
......
When /^I see and accept the Unsafe Browser start verification$/ do
next if @skip_steps_while_restoring_background
@screen.wait("UnsafeBrowserStartVerification.png", 30)
@screen.type("l", Sikuli::KEY_ALT)
end
Then /^I see and close the Unsafe Browser start notification$/ do
next if @skip_steps_while_restoring_background
@screen.wait_and_click("UnsafeBrowserStartNotification.png", 30)
end
Then /^the Unsafe Browser has started$/ do
next if @skip_steps_while_restoring_background
@screen.wait("UnsafeBrowserWindow.png", 360)
end
Then /^the Unsafe Browser has a red theme$/ do
next if @skip_steps_while_restoring_background
@screen.wait("UnsafeBrowserRedTheme.png", 10)
end
Then /^the Unsafe Browser has Wikipedia pre-selected in the search bar$/ do
next if @skip_steps_while_restoring_background
@screen.wait("UnsafeBrowserSearchBar.png", 10)
end
Then /^the Unsafe Browser shows a warning as its start page$/ do
next if @skip_steps_while_restoring_background
@screen.wait("UnsafeBrowserStartPage.png", 10)
end
When /^I start the Unsafe Browser$/ do
next if @skip_steps_while_restoring_background
unsafe_browser_cmd = nil
@vm.execute("cat /usr/share/applications/unsafe-browser.desktop").stdout.chomp.each_line { |line|
next if ! line.start_with? "Exec="
......@@ -36,19 +43,23 @@ When /^I start the Unsafe Browser$/ do
end
Then /^I see a warning about another instance already running$/ do
next if @skip_steps_while_restoring_background
@screen.wait('UnsafeBrowserWarnAlreadyRunning.png', 10)
end
When /^I close the Unsafe Browser$/ do
next if @skip_steps_while_restoring_background
@screen.type("q", Sikuli::KEY_CTRL)
end
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', 20)
end
Then /^I can start the Unsafe Browser again$/ do
next if @skip_steps_while_restoring_background
step "I start the Unsafe Browser"
end
......@@ -66,6 +77,7 @@ When /^I open the address "([^"]*)" in the Unsafe Browser$/ do |address|
end
Then /^I cannot configure the Unsafe Browser to use any local proxies$/ do
next if @skip_steps_while_restoring_background
@screen.wait_and_click("UnsafeBrowserWindow.png", 10)
sleep 0.5
# First we open the proxy settings page to prepare it with the
......
......@@ -5,5 +5,6 @@ Given /^I enable Microsoft Windows XP camouflage$/ do
end
When /^I click the start menu$/ do
next if @skip_steps_while_restoring_background
@screen.wait_and_click("WinXPStartButton.png", 10)
end
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