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

Add a selenium test

parent ad48f68d
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.base_url = "about:tor"
self.verificationErrors = []
self.accept_next_alert = True
def tearDown(self):
self.assertEqual([], self.verificationErrors)
import unittest, time, re
import tbbtest
class CheckTpo(tbbtest.TBBTest):
def test_check_tpo(self):
driver = self.driver
self.assertEqual("Congratulations. This browser is configured to use Tor.", driver.find_element_by_css_selector("h1.on").text)
if __name__ == "__main__":
...@@ -55,10 +55,22 @@ sub mozmill_tests { ...@@ -55,10 +55,22 @@ sub mozmill_tests {
} }
} }
sub selenium_tests {
my @tests = (
$ENV{TBB_BIN} = "$options->{tbbdir}/Browser/firefox";
$ENV{TBB_PROFILE} = "$options->{tbbdir}/Data/Browser/profile.default";
foreach my $test (@tests) {
$options->{basedir} = getcwd; $options->{basedir} = getcwd;
$options->{tbbdir} = extract_tbb($options->{tbbfile}); $options->{tbbdir} = extract_tbb($options->{tbbfile});
chdir $options->{tbbdir} || exit_error "Can't enter directory $options->{tbbdir}"; chdir $options->{tbbdir} || exit_error "Can't enter directory $options->{tbbdir}";
setup_tbb; setup_tbb;
print "tbbdir: $options->{tbbdir}\n"; print "tbbdir: $options->{tbbdir}\n";
mozmill_tests; mozmill_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