summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2015-05-21 20:31:59 +0000
committerintrigeri <intrigeri@boum.org>2015-05-22 14:47:20 +0000
commitdb5716d09235b9bdaf6da11faf586d7c2ced599d (patch)
tree7c0bc2888bad83154c9d9bec5c5a72652b694f7f
parentcdb369afa95bcaf0a691ddab083ee951b65b0754 (diff)
-rw-r--r--features/step_definitions/tbb_test_suite.rb60
-rw-r--r--features/support/helpers/misc_helpers.rb2
-rw-r--r--features/torified_browsing.feature23
3 files changed, 84 insertions, 1 deletions
diff --git a/features/step_definitions/tbb_test_suite.rb b/features/step_definitions/tbb_test_suite.rb
new file mode 100644
index 0000000..95aae75
--- /dev/null
+++ b/features/step_definitions/tbb_test_suite.rb
@@ -0,0 +1,60 @@
+When /^I set up the TBB test suite environment$/ do
+ next if @skip_steps_while_restoring_background
+ @vm.execute_successfully(
+ 'git clone https://git-tails.immerda.ch/tor-browser-bundle-testsuite',
+ LIVE_USER
+ )
+ @vm.execute_successfully(
+ 'cd tor-browser-bundle-testsuite && git submodule init',
+ LIVE_USER
+ )
+ @vm.execute_successfully(
+ 'cd tor-browser-bundle-testsuite && git submodule update',
+ LIVE_USER
+ )
+ @vm.execute_successfully('apt-get update')
+ @vm.execute_successfully(
+ 'export DEBIAN_FRONTEND=noninteractive ;' +
+ 'cd /home/amnesia/tor-browser-bundle-testsuite && ' +
+ './install-deps X'
+ )
+ @vm.execute_successfully(
+ 'cd tor-browser-bundle-testsuite && torsocks ./setup-virtualenv',
+ LIVE_USER
+ )
+end
+
+When /^the ([a-zA-Z0-9-]+) Mozmill test passes$/ do |test_name|
+ next if @skip_steps_while_restoring_background
+ @vm.execute_successfully(
+ 'export LD_LIBRARY_PATH=/usr/local/lib/tor-browser;' +
+ 'export MOZMILL_SCREENSHOTS=/tmp;' +
+ 'cd tor-browser-bundle-testsuite && ' +
+ './virtualenv/bin/mozmill ' +
+ ' -b /usr/local/lib/tor-browser/firefox ' +
+ ' -p /home/amnesia/.tor-browser/profile.default ' +
+ "-t ./mozmill-tests/tbb-tests/#{test_name}.js",
+ LIVE_USER
+ )
+end
+
+def run_selenium_test(test_name)
+ @vm.execute_successfully(
+ 'export TBB_BIN=/usr/local/lib/tor-browser/firefox;' +
+ 'export TBB_PROFILE=/home/amnesia/.tor-browser/profile.default;' +
+ "./virtualenv/bin/python ./selenium-tests/run_test #{test_name}",
+ LIVE_USER
+ )
+end
+
+Then /^all Selenium tests pass$/ do
+ next if @skip_steps_while_restoring_background
+ selenium_test_names = @vm.execute_successfully(
+ 'ls -1 selenium-tests/test_*.py', LIVE_USER
+ ).stdout.chomp.sub(/^selenium-tests\/test_/, '').sub(/\.py$/, '').split
+ STDERR.puts "selenium_test_names: #{selenium_test_names}"
+ selenium_test_names.each do |test_name|
+ run_selenium_test(test_name)
+ end
+end
+
diff --git a/features/support/helpers/misc_helpers.rb b/features/support/helpers/misc_helpers.rb
index a1ec6fc..8cc51bd 100644
--- a/features/support/helpers/misc_helpers.rb
+++ b/features/support/helpers/misc_helpers.rb
@@ -8,7 +8,7 @@ include Test::Unit::Assertions
def assert_vmcommand_success(p, msg = nil)
assert(p.success?, msg.nil? ? "Command failed: #{p.cmd}\n" + \
"error code: #{p.returncode}\n" \
- "stderr: #{p.stderr}" : \
+ "stderr: #{p.stderr}" : \ # XXX: and stdout?!
msg)
end
diff --git a/features/torified_browsing.feature b/features/torified_browsing.feature
index 0fef590..3525883 100644
--- a/features/torified_browsing.feature
+++ b/features/torified_browsing.feature
@@ -6,6 +6,8 @@ Feature: Browsing the web using the Tor Browser
Background:
Given a computer
+ # XXX
+ And the computer has 4 GiB of RAM
And I start the computer
And the computer boots Tails
And I log in to a new session
@@ -13,8 +15,29 @@ Feature: Browsing the web using the Tor Browser
And Tor is ready
And available upgrades have been checked
And all notifications have disappeared
+ # XXX
+ And I set up the TBB test suite environment
And I save the state so the background can be restored next scenario
+ Scenario: Selected bits of she TBB test suite pass
+ # When I set up the TBB test suite environment
+ And I disable Tails' firewall
+ Then the acid3 Mozmill test passes
+ And the dom-objects-enumeration Mozmill test passes
+ And the https-everywhere Mozmill test passes
+ And the navigation-timing Mozmill test passes
+ And the resource-timing Mozmill test passes
+ And the screenshots Mozmill test passes
+ And all Selenium tests pass
+ ## XXX: expects that the Perl test driver has disabled HTTPS Everywhere
+ # And the https-everywhere-disabled Mozmill test passes
+ ## XXX: following tests need a file created by the Perl test driver
+ # And the noscript Mozmill test passes
+ # And the settings Mozmill test passes
+ # And the slider_settings Mozmill test passes
+ # And the test_page Mozmill test passes
+ # And the searchengines Mozmill test passes
+
Scenario: The Tor Browser directory is usable
Then the amnesiac Tor Browser directory exists
And there is a GNOME bookmark for the amnesiac Tor Browser directory