Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tails
tails
Commits
b6e6f682
Commit
b6e6f682
authored
Jun 17, 2012
by
Tails developers
Browse files
Import first POC of cucumber/sikuli tests.
parent
eab80705
Changes
12
Hide whitespace changes
Inline
Side-by-side
features/cucumber/.rvmrc
0 → 100644
View file @
b6e6f682
#!/usr/bin/env bash
# This is an RVM Project .rvmrc file, used to automatically load the ruby
# development environment upon cd'ing into the directory
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
# Only full ruby name is supported here, for short names use:
# echo "rvm use jruby" > .rvmrc
environment_id
=
"jruby-1.6.7.2"
# Uncomment the following lines if you want to verify rvm version per project
# rvmrc_rvm_version="1.14.1 ()" # 1.10.1 seams as a safe start
# eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
# echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
# return 1
# }
# Uncomment following line if you want options to be set only for given project.
PROJECT_JRUBY_OPTS
=(
--1
.9
)
# The variable PROJECT_JRUBY_OPTS requires the following to be run in shell:
# chmod +x ${rvm_path}/hooks/after_use_jruby_opts
# First we attempt to load the desired environment directly from the environment
# file. This is very fast and efficient compared to running through the entire
# CLI and selector. If you want feedback on which environment was used then
# insert the word 'use' after --create as this triggers verbose mode.
if
[[
-d
"
${
rvm_path
:-
$HOME
/.rvm
}
/environments"
&&
-s
"
${
rvm_path
:-
$HOME
/.rvm
}
/environments/
$environment_id
"
]]
then
\.
"
${
rvm_path
:-
$HOME
/.rvm
}
/environments/
$environment_id
"
[[
-s
"
${
rvm_path
:-
$HOME
/.rvm
}
/hooks/after_use"
]]
&&
\.
"
${
rvm_path
:-
$HOME
/.rvm
}
/hooks/after_use"
||
true
if
[[
$-
==
*
i
*
]]
# check for interactive shells
then
echo
"Using:
$(
tput setaf 2
)
$GEM_HOME
$(
tput sgr0
)
"
# show the user the ruby and gemset they are using in green
else
echo
"Using:
$GEM_HOME
"
# don't use colors in non-interactive shells
fi
else
# If the environment file has not yet been created, use the RVM CLI to select.
rvm
--create
use
"
$environment_id
"
||
{
echo
"Failed to create RVM environment '
${
environment_id
}
'."
return
1
}
fi
features/cucumber/features/iceweasel/step_definitions/torified_browsing.rb
0 → 100644
View file @
b6e6f682
Given
/^a freshly started Tails$/
do
@vm
.
start
@screen
.
wait
(
'WelcometoTai-1.png'
,
500
)
end
When
/^I log in a new session$/
do
@screen
.
click
(
'Logln.png'
)
end
Then
/^I should see YourbrowserT\.png$/
do
@screen
.
wait
(
'YourbrowserT.png'
,
300
)
end
features/cucumber/features/iceweasel/torified_browsing.feature
0 → 100644
View file @
b6e6f682
Feature
:
Iceweasel must be torified.
In order to be anonymous, the iceweasel web browser must connect through Tor.
Background
:
Given
a freshly started Tails
Scenario
:
See check.torproject green page on session startup
When
I log in a new session
Then
I should see YourbrowserT.png
features/cucumber/features/images/Logln.png
0 → 100644
View file @
b6e6f682
1.21 KB
features/cucumber/features/images/WelcometoTai-1.png
0 → 100644
View file @
b6e6f682
8.12 KB
features/cucumber/features/images/YourbrowserT.png
0 → 100644
View file @
b6e6f682
9.58 KB
features/cucumber/features/support/env.rb
0 → 100644
View file @
b6e6f682
require
'java'
require
'rubygems'
Dir
[
File
.
dirname
(
__FILE__
)
+
"/features/support/helpers/*.rb"
].
each
do
|
file
|
require
file
end
Before
do
@vm
=
VM
.
new
(
ENV
[
'VM'
])
@display
=
Display
.
new
(
ENV
[
'VM'
])
@screen
=
Sikuli
::
Screen
.
new
end
After
do
@display
.
stop
@vm
.
stop
end
features/cucumber/features/support/helpers/display_helper.rb
0 → 100644
View file @
b6e6f682
class
Display
def
initialize
(
domain
)
start_virtviewer
(
domain
)
end
def
stop
stop_virtviewer
end
# Self-explainatory TODO item. Xvfb can be told to put screen raw X images
# in a directory. These files are .wxd that can prob. be converted. see Xvfb(1)
def
take_screenshot
end
def
start_virtviewer
(
domain
)
IO
.
popen
([
"virt-viewer"
,
"-d"
,
"-f"
,
"-r"
,
"-c"
,
"qemu+ssh://localhost/system"
,
[
"--display="
,
ENV
[
'DISPLAY'
]].
join
(
''
),
domain
,
"&"
].
join
(
' '
))
end
def
stop_virtviewer
system
(
"killall virt-viewer"
)
end
end
features/cucumber/features/support/helpers/net_helper.rb
0 → 100644
View file @
b6e6f682
#
# There should be a way to tests against network traffic. Possible pathes
# are the use of the pcap gem, use of iptables, or maybe the most promising:
# use the nfqueue gem to be able to inspect packets directly.
#
# Scenario: Iceweasel should connect only through Tor
# Given I open Iceweasel
# When I browse to http://any.url
# Then the network traffic should flow only through Tor
features/cucumber/features/support/helpers/sikuli_helper.rb
0 → 100644
View file @
b6e6f682
require
'sikuli'
# Configure sikuli
Sikuli
::
Config
.
run
do
|
config
|
config
.
image_path
=
"
#{
Dir
.
pwd
}
/features/images/"
config
.
logging
=
false
config
.
highlight_on_find
=
false
end
features/cucumber/features/support/helpers/storage_helper.rb
0 → 100644
View file @
b6e6f682
# Helper to manipulate VM's storages (usb, ide, CD...). Iso management
# might end in there too.
class
Storage
end
features/cucumber/features/support/helpers/vm_helper.rb
0 → 100644
View file @
b6e6f682
require
'libvirt'
class
VM
def
initialize
(
domain
)
@iso
=
ENV
[
'ISO'
]
||
get_last_iso
@virt
=
Libvirt
::
open
(
"qemu:///system"
)
@dom
=
@virt
.
lookup_domain_by_name
(
domain
)
add_iso_to_domain
end
def
get_last_iso
Dir
.
glob
(
"*.iso"
).
sort_by
{
|
f
|
File
.
mtime
(
f
)}.
last
end
def
add_iso_to_domain
xml
=
<<
EOF
<disk>
<source file="
#{
ENV
[
'PWD'
]
}
/
#{
@iso
}
"/>
<target dev='hdc' bus='ide'/>
</disk>
EOF
@dom
.
update_device
(
xml
)
end
def
is_running?
@dom
.
active?
end
def
execute
# TODO: could allow to run commands on the tails VM
# Might deserve a whole helper though.
end
def
start
@dom
.
destroy
if
@dom
.
active?
@dom
.
create
end
def
stop
@dom
.
destroy
if
@dom
.
active?
end
end
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment