Commit 8b3cd52d authored by anonym's avatar anonym
Browse files

Test suite: adapt for new Tails Installer.

Refs: #8859, #8860
parent a4121b5b
......@@ -68,7 +68,7 @@ def checkpoints
:steps => [
'I create a 8 GiB disk named "__internal"',
'I plug USB drive "__internal"',
'I "Install by cloning" Tails to USB drive "__internal"',
'I install Tails to USB drive "__internal" by cloning',
'the running Tails is installed on USB drive "__internal"',
'there is no persistence partition on USB drive "__internal"',
'I shutdown Tails and wait for the computer to power off',
......
......@@ -74,13 +74,13 @@ Given /^the computer is set to boot in UEFI mode$/ do
end
def tails_installer_selected_device
@installer.child('Target Device:', roleName: 'label').parent
@installer.child('Target USB stick:', roleName: 'label').parent
.child('', roleName: 'combo box', recursive: false).name
end
def tails_installer_is_device_selected?(name)
device = $vm.disk_dev(name)
tails_installer_selected_device[/#{device}\d*$/]
tails_installer_selected_device[/\(#{device}\d*\)$/]
end
def tails_installer_match_status(pattern)
......@@ -90,53 +90,22 @@ end
class UpgradeNotSupported < StandardError
end
def usb_install_helper(name)
if tails_installer_match_status(/It is impossible to upgrade the device .+ #{$vm.disk_dev(name)}\d* /)
raise UpgradeNotSupported
end
assert(tails_installer_is_device_selected?(name))
begin
@installer.button('Install Tails').click
@installer.child('Question', roleName: 'alert').button('Yes').click
try_for(30*60) do
@installer
.child('Information', roleName: 'alert')
.child('Installation complete!', roleName: 'label')
true
end
rescue FindFailed => e
path = $vm.execute_successfully('ls -1 /tmp/tails-installer-*').stdout.chomp
debug_log("Tails Installer debug log:\n" + $vm.file_content(path))
raise e
end
end
When /^I start Tails Installer in "([^"]+)" mode$/ do |mode|
step 'I run "export DEBUG=1 ; tails-installer-launcher" in GNOME Terminal'
installer_launcher = Dogtail::Application.new('tails-installer-launcher')
.child('Tails Installer', roleName: 'frame')
# Sometimes Dogtail will find the button and click it before it is
# shown (searchShowingOnly is not perfect) which generally means
# clicking somewhere on the Terminal => the click is lost *and* the
# installer does no go to the foreground. So let's wait a bit extra.
sleep 3
installer_launcher.button(mode).click
When /^I start Tails Installer$/ do
step 'I run "export DEBUG=1 ; /usr/bin/tails-installer-launcher" in GNOME Terminal'
@installer = Dogtail::Application.new('tails-installer')
@installer.child('Tails Installer', roleName: 'frame')
# ... and something similar (for consecutive steps) again.
# Sometimes Dogtail will find the Installer and click its window
# before it is shown (searchShowingOnly is not perfect) which
# generally means clicking somewhere on the Terminal => the click is
# lost *and* the installer does not go to the foreground. So let's
# wait a bit extra.
sleep 3
$vm.focus_window('Tails Installer')
end
Then /^Tails Installer detects that a device is too small$/ do
try_for(10) do
tails_installer_match_status(/^The device .* is too small to install Tails/)
end
end
When /^I am told that the destination device cannot be upgraded$/ do
When /^I am told that the destination device (.*)$/ do |status|
try_for(10) do
tails_installer_match_status(/^It is impossible to upgrade the device/)
tails_installer_match_status(status)
end
end
......@@ -164,14 +133,42 @@ Then /^(no|the "([^"]+)") USB drive is selected$/ do |mode, name|
end
end
When /^I "([^"]*)" Tails to USB drive "([^"]+)"$/ do |mode, name|
step "I start Tails Installer in \"#{mode}\" mode"
usb_install_helper(name)
When /^I (install|upgrade) Tails (?:to|on) USB drive "([^"]+)" (by cloning|from an ISO)$/ do |action, name, source|
step "I start Tails Installer"
if tails_installer_match_status(/It is impossible to upgrade the device .+ #{$vm.disk_dev(name)}\d* /)
raise UpgradeNotSupported
end
assert(tails_installer_is_device_selected?(name))
if source == 'from an ISO'
iso_radio = @installer.child('Use a downloaded Tails ISO image',
roleName: 'radio button')
iso_radio.click
iso_radio.parent.button('(None)').click
file_chooser = @installer.child('Select a File', roleName: 'file chooser')
@screen.type("l", Sikuli::KeyModifier.CTRL)
# The only visible text element will be the path entry
file_chooser.child(roleName: 'text').typeText(@iso_path + '\n')
file_chooser.button('Open').click
end
begin
@installer.button(action.capitalize).click
@installer.child('Question', roleName: 'alert').button('Yes').click
try_for(30*60) do
@installer
.child('Information', roleName: 'alert')
.child('Installation complete!', roleName: 'label')
true
end
rescue Exception => e
path = $vm.execute_successfully('ls -1 /tmp/tails-installer-*').stdout.chomp
debug_log("Tails Installer debug log:\n" + $vm.file_content(path))
raise e
end
end
When /^I fail to "([^"]*)" Tails to USB drive "([^"]+)"$/ do |mode, name|
When /^I fail to (.*)$/ do |step|
begin
step "I \"#{mode}\" Tails to USB drive \"#{name}\""
step "I #{step}"
rescue UpgradeNotSupported
# this is what we expect
else
......@@ -184,18 +181,6 @@ Given /^I plug and mount a USB drive containing the Tails ISO$/ do
@iso_path = "#{iso_dir}/#{File.basename(TAILS_ISO)}"
end
When /^I do a "Upgrade from ISO" on USB drive "([^"]+)"$/ do |name|
step 'I start Tails Installer in "Upgrade from ISO" mode'
@installer.child('Use existing Live system ISO:', roleName: 'label')
.parent.button('(None)').click
file_chooser = @installer.child('Select a File', roleName: 'file chooser')
@screen.type("l", Sikuli::KeyModifier.CTRL)
# The only visible text element will be the path entry
file_chooser.child(roleName: 'text').typeText(@iso_path + '\n')
file_chooser.button('Open').click
usb_install_helper(name)
end
Given /^I enable all persistence presets$/ do
@screen.wait('PersistenceWizardPresets.png', 20)
# Select the "Persistent" folder preset, which is checked by default.
......
......@@ -6,11 +6,11 @@ Feature: Installing Tails to a USB drive
Scenario: Try installing Tails to a too small USB drive
Given I have started Tails from DVD without network and logged in
And I temporarily create a 4500 MiB disk named "too-small-device"
And I start Tails Installer in "Install by cloning" mode
And I start Tails Installer
But a suitable USB device is not found
And no USB drive is selected
When I plug USB drive "too-small-device"
Then Tails Installer detects that a device is too small
Then I am told that the destination device is too small
And no USB drive is selected
When I unplug USB drive "too-small-device"
And I temporarily create a 7200 MiB disk named "big-enough"
......@@ -20,7 +20,7 @@ Feature: Installing Tails to a USB drive
Scenario: Detecting when a target USB drive is inserted or removed
Given I have started Tails from DVD without network and logged in
And I temporarily create a 7200 MiB disk named "temp"
And I start Tails Installer in "Install by cloning" mode
And I start Tails Installer
But a suitable USB device is not found
When I plug USB drive "temp"
Then the "temp" USB drive is selected
......@@ -31,7 +31,7 @@ Feature: Installing Tails to a USB drive
Given I have started Tails from DVD without network and logged in
And I temporarily create a 7200 MiB disk named "install"
And I plug USB drive "install"
And I "Install by cloning" Tails to USB drive "install"
And I install Tails to USB drive "install" by cloning
Then the running Tails is installed on USB drive "install"
But there is no persistence partition on USB drive "install"
......@@ -65,7 +65,7 @@ Feature: Installing Tails to a USB drive
And I temporarily create a 7200 MiB disk named "mbr"
And I create a msdos label on disk "mbr"
And I plug USB drive "mbr"
And I "Install by cloning" Tails to USB drive "mbr"
And I install Tails to USB drive "mbr" by cloning
Then the running Tails is installed on USB drive "mbr"
But there is no persistence partition on USB drive "mbr"
When I shutdown Tails and wait for the computer to power off
......@@ -82,10 +82,10 @@ Feature: Installing Tails to a USB drive
Then Tails is running from USB drive "isohybrid"
When I shutdown Tails and wait for the computer to power off
And I start Tails from DVD with network unplugged and I login
And I fail to "Upgrade by cloning" Tails to USB drive "isohybrid"
And I fail to upgrade Tails on USB drive "isohybrid" by cloning
Then I am suggested to do a "Install by cloning"
When I kill the process "tails-installer"
And I "Install by cloning" Tails to USB drive "isohybrid"
And I install Tails to USB drive "mbr" by cloning
Then the running Tails is installed on USB drive "isohybrid"
But there is no persistence partition on USB drive "isohybrid"
When I shutdown Tails and wait for the computer to power off
......
......@@ -15,15 +15,15 @@ Feature: Upgrading an old Tails USB installation
And I plug and mount a USB drive containing the Tails ISO
And I temporarily create a 4 GiB disk named "pristine"
And I plug USB drive "pristine"
When I start Tails Installer in "Upgrade from ISO" mode
Then I am told that the destination device cannot be upgraded
When I start Tails Installer
Then I am told that the destination device is too small
Scenario: Try to "Upgrade by cloning" Tails to a pristine USB drive
Given I have started Tails from DVD without network and logged in
And I temporarily create a 4 GiB disk named "pristine"
And I plug USB drive "pristine"
When I start Tails Installer in "Upgrade by cloning" mode
Then I am told that the destination device cannot be upgraded
When I start Tails Installer
Then I am told that the destination device is too small
Scenario: Try to "Upgrade from ISO" Tails to a USB drive with GPT and a FAT partition
Given I have started Tails from DVD without network and logged in
......@@ -31,15 +31,15 @@ Feature: Upgrading an old Tails USB installation
And I temporarily create a 4 GiB disk named "gptfat"
And I create a gpt partition with a vfat filesystem on disk "gptfat"
And I plug USB drive "gptfat"
When I start Tails Installer in "Upgrade from ISO" mode
Then I am told that the destination device cannot be upgraded
When I start Tails Installer
Then I am told that the destination device is too small
Scenario: Try to "Upgrade by cloning" Tails to a USB drive with GPT and a FAT partition
Given I have started Tails from DVD without network and logged in
And I temporarily create a 4 GiB disk named "gptfat"
And I create a gpt partition with a vfat filesystem on disk "gptfat"
And I plug USB drive "gptfat"
When I start Tails Installer in "Upgrade by cloning" mode
When I start Tails Installer
Then I am told that the destination device cannot be upgraded
Scenario: Installing an old version of Tails to a pristine USB drive
......@@ -52,7 +52,7 @@ Feature: Upgrading an old Tails USB installation
And all notifications have disappeared
And I create a 7200 MiB disk named "old"
And I plug USB drive "old"
When I "Install by cloning" Tails to USB drive "old"
When I install Tails to USB drive "old" by cloning
Then the running Tails is installed on USB drive "old"
But there is no persistence partition on USB drive "old"
And I unplug USB drive "old"
......@@ -87,7 +87,7 @@ Feature: Upgrading an old Tails USB installation
Given I have started Tails from DVD without network and logged in
And I clone USB drive "old" to a new USB drive "to_upgrade"
And I plug USB drive "to_upgrade"
When I "Upgrade by cloning" Tails to USB drive "to_upgrade"
When I upgrade Tails to USB drive "to_upgrade" by cloning
Then the running Tails is installed on USB drive "to_upgrade"
And I unplug USB drive "to_upgrade"
......@@ -107,7 +107,7 @@ Feature: Upgrading an old Tails USB installation
And I log in to a new session
And I clone USB drive "old" to a new USB drive "to_upgrade"
And I plug USB drive "to_upgrade"
When I "Upgrade by cloning" Tails to USB drive "to_upgrade"
When I upgrade Tails to USB drive "to_upgrade" by cloning
Then the running Tails is installed on USB drive "to_upgrade"
And I unplug USB drive "to_upgrade"
And I unplug USB drive "__internal"
......@@ -129,7 +129,7 @@ Feature: Upgrading an old Tails USB installation
When I start Tails from USB drive "old" with network unplugged and I login
And I plug and mount a USB drive containing the Tails ISO
And I plug USB drive "to_upgrade"
And I do a "Upgrade from ISO" on USB drive "to_upgrade"
And I upgrade Tails on USB drive "to_upgrade" from an ISO
Then the ISO's Tails is installed on USB drive "to_upgrade"
And I unplug USB drive "to_upgrade"
......@@ -139,7 +139,7 @@ Feature: Upgrading an old Tails USB installation
And I plug and mount a USB drive containing the Tails ISO
And I clone USB drive "old" to a new USB drive "to_upgrade"
And I plug USB drive "to_upgrade"
And I do a "Upgrade from ISO" on USB drive "to_upgrade"
And I upgrade Tails on USB drive "to_upgrade" from an ISO
Then the ISO's Tails is installed on USB drive "to_upgrade"
And I unplug USB drive "to_upgrade"
......
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