Commit d6dde68c authored by anonym's avatar anonym
Browse files

Dogtailify notification detection in the test suite.

parent c59dad7e
......@@ -38,7 +38,7 @@ Feature: I2P
And the I2P router console is ready
When I successfully start the I2P Browser
And I close the I2P Browser
Then I see the I2P Browser stop notification
Then I see the "Shutting down the I2P Browser..." notification after at most 60 seconds
And the I2P Browser chroot is torn down
#11114, #11465
......@@ -86,7 +86,7 @@ Feature: I2P
And I2P is running
And I2P's reseeding started
And the network is unplugged
Then I see a notification that I2P is not ready
Then I see the "I2P is not read" notification after at most 240 seconds
And I2P's reseeding failed
But I2P is still running
When I start the I2P Browser through the GNOME menu
......@@ -103,5 +103,5 @@ Feature: I2P
And Tor has built a circuit
Then I2P is running
But the network is unplugged
Then I see a notification that I2P failed to start
Then I see the "I2P failed to start" notification after at most 120 seconds
And I2P is not running
......@@ -31,7 +31,7 @@ Feature: Spoofing MAC addresses
Scenario: MAC address spoofing fails and macchanger returns false
Given macchanger will fail by not spoofing and always returns false
When I log in to a new session
And see the "Network card disabled" notification
And I see the "Network card disabled" notification after at most 60 seconds
Then no network interfaces are enabled
And the real MAC address was not leaked
......@@ -40,7 +40,7 @@ Feature: Spoofing MAC addresses
Scenario: MAC address spoofing fails and macchanger returns true
Given macchanger will fail by not spoofing and always returns true
When I log in to a new session
And see the "Network card disabled" notification
And I see the "Network card disabled" notification after at most 60 seconds
Then no network interfaces are enabled
And the real MAC address was not leaked
......@@ -50,7 +50,7 @@ Feature: Spoofing MAC addresses
Given macchanger will fail by not spoofing and always returns true
And no network interface modules can be unloaded
When I log in to a new session
And see the "All networking disabled" notification
And I see the "All networking disabled" notification after at most 60 seconds
Then 1 network interface is enabled
But the MAC spoofing panic mode disabled networking
And the real MAC address was not leaked
......
......@@ -20,8 +20,8 @@ Feature: Networking
#11463
@fragile
Scenario: The 'Tor is ready' notification is shown when Tor has bootstrapped
Scenario: The "Tor is ready" notification is shown when Tor has bootstrapped
Given I have started Tails from DVD without network and logged in
And the network is plugged
When I see the 'Tor is ready' notification
Then Tor is ready
When Tor is ready
Then I see the "Tor is ready" notification after at most 30 seconds
Then /^I see the (Unsafe|I2P) Browser start notification and wait for it to close$/ do |browser_type|
robust_notification_wait("#{browser_type}BrowserStartNotification.png", 60)
end
Then /^the (Unsafe|I2P) Browser has started$/ do |browser_type|
case browser_type
when 'Unsafe'
......@@ -18,7 +14,7 @@ end
When /^I successfully start the (Unsafe|I2P) Browser$/ do |browser_type|
step "I start the #{browser_type} Browser"
step "I see and accept the Unsafe Browser start verification" unless browser_type == 'I2P'
step "I see the #{browser_type} Browser start notification and wait for it to close"
step "I see the \"Starting the #{browser_type} Browser...\" notification after at most 60 seconds"
step "the #{browser_type} Browser has started"
end
......@@ -26,10 +22,6 @@ When /^I close the (?:Unsafe|I2P) Browser$/ do
@screen.type("q", Sikuli::KeyModifier.CTRL)
end
Then /^I see the (Unsafe|I2P) Browser stop notification$/ do |browser_type|
robust_notification_wait("#{browser_type}BrowserStopNotification.png", 60)
end
def xul_application_info(application)
binary = $vm.execute_successfully(
'echo ${TBB_INSTALL}/firefox', :libs => 'tor-browser'
......
......@@ -52,42 +52,6 @@ def deactivate_filesystem_shares
#end
end
# This helper requires that the notification image is the one shown in
# the notification applet's list, not the notification pop-up.
def robust_notification_wait(notification_image, time_to_wait)
error_msg = "Didn't not manage to open the notification applet"
wait_start = Time.now
try_for(time_to_wait, :delay => 0, :msg => error_msg) do
@screen.hide_cursor
@screen.click("GnomeNotificationApplet.png")
@screen.wait("GnomeNotificationAppletOpened.png", 10)
end
error_msg = "Didn't not see notification '#{notification_image}'"
time_to_wait -= (Time.now - wait_start).ceil
try_for(time_to_wait, :delay => 0, :msg => error_msg) do
found = false
entries = @screen.findAll("GnomeNotificationEntry.png")
while(entries.hasNext) do
entry = entries.next
@screen.hide_cursor
@screen.click(entry)
close_entry = @screen.wait("GnomeNotificationEntryClose.png", 10)
if @screen.exists(notification_image)
found = true
@screen.click(close_entry)
break
else
@screen.click(entry)
end
end
found
end
# Close the notification applet
@screen.type(Sikuli::Key.ESC)
end
def post_snapshot_restore_hook
$vm.wait_until_remote_shell_is_up
post_vm_start_hook
......@@ -371,8 +335,14 @@ Given /^the Tails desktop is ready$/ do
end
end
When /^I see the 'Tor is ready' notification$/ do
robust_notification_wait('TorIsReadyNotification.png', 300)
When /^I see the "(.+)" notification(?: after at most (\d+) seconds)?$/ do |title, timeout|
timeout = timeout ? timeout.to_i : nil
gnome_shell = Dogtail::Application.new('gnome-shell')
notification_list = gnome_shell.child(
'No Notifications', roleName: 'label', showingOnly: false
).parent.parent
notification_list.child(title, roleName: 'label', showingOnly: false)
.wait(timeout)
end
Given /^Tor is ready$/ do
......
......@@ -77,14 +77,6 @@ Then /^the I2P homepage loads in I2P Browser$/ do
end
end
Then /^I see a notification that I2P failed to start$/ do
robust_notification_wait('I2PFailedToStart.png', 2 * 60)
end
Then /^I see shared client tunnels in the I2P router console$/ do
@screen.wait('I2PSharedClientTunnels.png', 15 * 60)
end
Then /^I see a notification that I2P is not ready$/ do
robust_notification_wait('I2PBootstrapFailure.png', 4 * 60)
end
......@@ -64,14 +64,6 @@ EOF
$vm.execute_successfully("chmod a+rx /sbin/modprobe")
end
When /^see the "Network card disabled" notification$/ do
robust_notification_wait("MACSpoofNetworkCardDisabled.png", 60)
end
When /^see the "All networking disabled" notification$/ do
robust_notification_wait("MACSpoofNetworkingDisabled.png", 60)
end
Then /^(\d+|no) network interface(?:s)? (?:is|are) enabled$/ do |expected_nr_nics|
# note that "no".to_i => 0 in Ruby.
expected_nr_nics = expected_nr_nics.to_i
......
......@@ -33,7 +33,7 @@ Feature: Browsing the web using the Unsafe Browser
Given I have started Tails from DVD and logged in and the network is connected
When I successfully start the Unsafe Browser
And I close the Unsafe Browser
Then I see the Unsafe Browser stop notification
Then I see the "Shutting down the Unsafe Browser..." notification after at most 60 seconds
And the Unsafe Browser chroot is torn down
#11458
......
Supports Markdown
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