4 description: "I have started Tails from DVD without network and stopped at Tails Greeter's login screen",
5 parent_checkpoint: nil,
7 'the network is unplugged',
8 'I start the computer',
9 'the computer boots Tails',
13 'no-network-logged-in' => {
14 description: 'I have started Tails from DVD without network and logged in',
15 parent_checkpoint: 'tails-greeter',
17 'I log in to a new session',
18 'all notifications have disappeared',
22 'with-network-logged-in' => {
23 description: 'I have started Tails from DVD and logged in and the network is connected',
24 parent_checkpoint: 'no-network-logged-in',
26 'the network is plugged',
28 'all notifications have disappeared',
29 'available upgrades have been checked',
33 'no-network-bridge-mode' => {
35 description: 'I have started Tails from DVD without network and logged in with bridge mode enabled',
36 parent_checkpoint: 'tails-greeter',
38 'I enable the specific Tor configuration option',
39 'I log in to a new session',
40 'all notifications have disappeared',
44 'no-network-logged-in-sudo-passwd' => {
46 description: 'I have started Tails from DVD without network and logged in with an administration password',
47 parent_checkpoint: 'tails-greeter',
49 'I set an administration password',
50 'I log in to a new session',
51 'all notifications have disappeared',
55 'with-network-logged-in-sudo-passwd' => {
57 description: 'I have started Tails from DVD and logged in with an administration password and the network is connected',
58 parent_checkpoint: 'no-network-logged-in-sudo-passwd',
60 'the network is plugged',
62 'all notifications have disappeared',
63 'available upgrades have been checked',
67 'no-network-logged-in-unsafe-browser' => {
69 description: 'I have started Tails from DVD without network and logged in with the Unsafe Browser enabled',
70 parent_checkpoint: 'tails-greeter',
72 'I allow the Unsafe Browser to be started',
73 'I log in to a new session',
74 'all notifications have disappeared',
78 'with-network-logged-in-unsafe-browser' => {
80 description: 'I have started Tails from DVD and logged in with the Unsafe Browser enabled and the network is connected',
81 parent_checkpoint: 'no-network-logged-in-unsafe-browser',
83 'the network is plugged',
85 'all notifications have disappeared',
86 'available upgrades have been checked',
90 'usb-install-tails-greeter' => {
91 description: "I have started Tails without network from a USB drive without a persistent partition and stopped at Tails Greeter's login screen",
92 parent_checkpoint: nil,
94 'I create a 7200 MiB disk named "__internal"',
95 'I plug USB drive "__internal"',
96 'I write the Tails USB image to disk "__internal"',
97 'I start Tails from USB drive "__internal" with network unplugged',
98 'the boot device has safe access rights',
99 'Tails is running from USB drive "__internal"',
100 'there is no persistence partition on USB drive "__internal"',
101 'process "udev-watchdog" is running',
102 'udev-watchdog is monitoring the correct device',
106 'usb-install-logged-in' => {
107 description: 'I have started Tails without network from a USB drive without a persistent partition and logged in',
108 parent_checkpoint: 'usb-install-tails-greeter',
110 'I log in to a new session',
111 'all notifications have disappeared',
115 'usb-install-with-persistence-tails-greeter' => {
116 description: "I have started Tails without network from a USB drive with a persistent partition and stopped at Tails Greeter's login screen",
117 parent_checkpoint: 'usb-install-logged-in',
119 'I create a persistent partition',
120 'a Tails persistence partition exists on USB drive "__internal"',
121 'I cold reboot the computer',
122 'the computer reboots Tails',
123 'the boot device has safe access rights',
124 'Tails is running from USB drive "__internal"',
125 'process "udev-watchdog" is running',
126 'udev-watchdog is monitoring the correct device',
130 'usb-install-with-persistence-logged-in' => {
131 description: 'I have started Tails without network from a USB drive with a persistent partition enabled and logged in',
132 parent_checkpoint: 'usb-install-with-persistence-tails-greeter',
134 'I enable persistence',
135 'I log in to a new session',
136 'all persistence presets are enabled',
137 'all persistent filesystems have safe access rights',
138 'all persistence configuration files have safe access rights',
139 'all persistent directories have safe access rights',
140 'all notifications have disappeared',
146 # XXX: giving up on a few worst offenders for now
147 # rubocop:disable Metrics/AbcSize
148 # rubocop:disable Metrics/MethodLength
149 def reach_checkpoint(name)
150 scenario_indent = ' ' * 4
151 step_indent = ' ' * 6
154 if VM.snapshot_exists?(name)
155 $vm.restore_snapshot(name)
157 checkpoint = CHECKPOINTS[name]
158 checkpoint_description = checkpoint[:description]
159 parent_checkpoint = checkpoint[:parent_checkpoint]
160 steps = checkpoint[:steps]
162 if VM.snapshot_exists?(parent_checkpoint)
163 $vm.restore_snapshot(parent_checkpoint)
165 reach_checkpoint(parent_checkpoint)
167 post_snapshot_restore_hook(parent_checkpoint)
169 debug_log(scenario_indent + "Checkpoint: #{checkpoint_description}",
170 color: :white, timestamp: false)
171 step_action = 'Given'
173 parent_description = CHECKPOINTS[parent_checkpoint][:description]
174 debug_log(step_indent + "#{step_action} #{parent_description}",
175 color: :green, timestamp: false)
181 rescue StandardError => e
182 debug_log(scenario_indent +
183 "Step failed while creating checkpoint: #{s}",
184 color: :red, timestamp: false)
187 debug_log(step_indent + "#{step_action} #{s}",
188 color: :green, timestamp: false)
191 $vm.save_snapshot(name)
193 # VM#save_snapshot restores the RAM-only snapshot immediately
194 # after saving it, in which case post_snapshot_restore_hook is
195 # useful to ensure we've reached a good starting point, so we run
196 # it in all cases, including even when've just saved a new snapshot.
197 post_snapshot_restore_hook(name)
199 # rubocop:enable Metrics/AbcSize
200 # rubocop:enable Metrics/MethodLength
202 # For each checkpoint we generate a step to reach it.
203 CHECKPOINTS.each do |name, desc|
204 step_regex = Regexp.new("^#{Regexp.escape(desc[:description])}$")
207 reach_checkpoint(name)
208 rescue StandardError => e
209 debug_log(" Generated snapshot step failed with exception:\n" \
210 " #{e.class}: #{e}\n", color: :red, timestamp: false)