Skip to content
This repository has been archived by the owner on Dec 23, 2017. It is now read-only.

Commit

Permalink
Merge pull request #77 from jmcarp/selenium-config
Browse files Browse the repository at this point in the history
Miscellaneous updates for Selenium tests.
  • Loading branch information
arowla committed Apr 21, 2015
2 parents 755805f + 241cf7f commit 1b61971
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
13 changes: 11 additions & 2 deletions openfecwebapp/tests/selenium/base_test_class.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
import os
import unittest

from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
import unittest
from nose.plugins.attrib import attr


drivers = {
'phantomjs': lambda: webdriver.PhantomJS(service_args=['--ignore-ssl-errors=true']),
'firefox': lambda: webdriver.Firefox(),
'chrome': lambda: webdriver.Chrome(),
}


@attr('selenium')
class BaseTest(unittest.TestCase):

@classmethod
def setUpClass(cls):
cls.driver = webdriver.PhantomJS()
cls.driver = drivers[os.getenv('FEC_SELENIUM_DRIVER', 'phantomjs')]()
cls.driver.set_window_size(2000, 2000)
cls.base_url = 'http://localhost:3000'

Expand Down
5 changes: 1 addition & 4 deletions openfecwebapp/tests/selenium/candidates_list_page_test.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
from .base_test_class import BaseTest
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
import time


Expand Down Expand Up @@ -41,7 +38,7 @@ def checkFilter(self, name, first_entry, second_entry,
self.assertEqual(
div.get_attribute('class'),
'field active')
div.find_element_by_tag_name('input').send_keys(Keys.ENTER)
self.driver.find_element_by_id('category-filters').submit()
results = (self.driver.find_elements_by_tag_name('tr'))
col = [y.find_elements_by_tag_name('td')[index]
.text for y in results[1:]]
Expand Down
3 changes: 1 addition & 2 deletions openfecwebapp/tests/selenium/committees_list_page_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ def checkFilter(self, name, first_entry, second_entry,
self.driver.get(self.url)
self.openFilters()
cycle = self.getFilterDivByName(name)
time.sleep(1)
cycle.find_element_by_xpath('./div/a/div/b').click()
self.assertEqual(
cycle.find_element_by_xpath('./div').get_attribute('class'),
Expand All @@ -38,7 +37,7 @@ def checkFilter(self, name, first_entry, second_entry,
self.assertEqual(
cycle.get_attribute('class'),
'field active')
cycle.find_element_by_tag_name('input').send_keys(Keys.ENTER)
self.driver.find_element_by_id('category-filters').submit()
results = (self.driver.find_elements_by_tag_name('tr'))
col = [y.find_elements_by_tag_name('td')[index]
.text for y in results[1:]]
Expand Down
2 changes: 1 addition & 1 deletion openfecwebapp/tests/selenium/error_page_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def testErrorPageLoads(self):
self.driver.get(self.url)
self.assertEqual(
self.driver.find_element_by_tag_name('h1').text,
'Not Found')
'Oops!')

def testErrorPageSearch(self):
self.driver.get(self.url)
Expand Down

0 comments on commit 1b61971

Please sign in to comment.