Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Applications
tor-browser-bundle-testsuite
Commits
c7440b33
Unverified
Commit
c7440b33
authored
Feb 25, 2014
by
boklm
Browse files
Add a selenium test
parent
ad48f68d
Changes
3
Hide whitespace changes
Inline
Side-by-side
selenium-tests/tbbtest.py
0 → 100755
View file @
c7440b33
#!/usr/bin/python
from
selenium
import
webdriver
from
selenium.webdriver.common.by
import
By
from
selenium.webdriver.common.keys
import
Keys
from
selenium.webdriver.support.ui
import
Select
from
selenium.common.exceptions
import
NoSuchElementException
import
unittest
,
time
,
re
import
os
class
TBBTest
(
unittest
.
TestCase
):
def
setUp
(
self
):
ffbinary
=
webdriver
.
firefox
.
firefox_binary
.
FirefoxBinary
(
firefox_path
=
os
.
environ
[
'TBB_BIN'
])
ffprofile
=
webdriver
.
firefox
.
firefox_profile
.
FirefoxProfile
(
profile_directory
=
os
.
environ
[
'TBB_PROFILE'
])
self
.
driver
=
webdriver
.
Firefox
(
firefox_binary
=
ffbinary
,
firefox_profile
=
ffprofile
)
self
.
driver
.
implicitly_wait
(
30
)
self
.
base_url
=
"about:tor"
self
.
verificationErrors
=
[]
self
.
accept_next_alert
=
True
def
tearDown
(
self
):
self
.
driver
.
quit
()
self
.
assertEqual
([],
self
.
verificationErrors
)
selenium-tests/test_check.tpo.py
0 → 100755
View file @
c7440b33
#!/usr/bin/python
import
unittest
,
time
,
re
import
tbbtest
class
CheckTpo
(
tbbtest
.
TBBTest
):
def
test_check_tpo
(
self
):
driver
=
self
.
driver
driver
.
get
(
"http://check.torproject.org/"
)
self
.
assertEqual
(
"Congratulations. This browser is configured to use Tor."
,
driver
.
find_element_by_css_selector
(
"h1.on"
).
text
)
if
__name__
==
"__main__"
:
unittest
.
main
()
tbb-testsuite
View file @
c7440b33
...
...
@@ -55,10 +55,22 @@ sub mozmill_tests {
}
}
sub
selenium_tests
{
my
@tests
=
(
'
test_check.tpo.py
',
);
$ENV
{
TBB_BIN
}
=
"
$options
->{tbbdir}/Browser/firefox
";
$ENV
{
TBB_PROFILE
}
=
"
$options
->{tbbdir}/Data/Browser/profile.default
";
foreach
my
$test
(
@tests
)
{
system
("
$FindBin
::Bin/selenium-tests/
$test
");
}
}
$options
->
{
basedir
}
=
getcwd
;
$options
->
{
tbbdir
}
=
extract_tbb
(
$options
->
{
tbbfile
});
chdir
$options
->
{
tbbdir
}
||
exit_error
"
Can't enter directory
$options
->{tbbdir}
";
setup_tbb
;
print
"
tbbdir:
$options
->{tbbdir}
\n
";
mozmill_tests
;
selenium_tests
;
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