Unverified Commit c7440b33 authored by boklm's avatar boklm
Browse files

Add a selenium test

parent ad48f68d
#!/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)
#!/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()
......@@ -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;
Markdown is supported
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