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

Update integration tests. #490

Merged
merged 1 commit into from
Aug 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/selenium/base_test_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def check_filter_results(self, index, result):
# Handle stale reference errors in Chrome
get_values = lambda: [
row.find_elements_by_tag_name('td')[index].text
for row in self.driver.find_elements_by_css_selector('tbody tr')
for row in self.driver.find_elements_by_css_selector('tbody tr[role="row"]')
]
values = utils.try_until(get_values, errors=(StaleElementReferenceException, ))
if callable(result):
Expand Down
20 changes: 5 additions & 15 deletions tests/selenium/single_candidate_page_tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import unittest

from .base_test_class import BaseTest

from tests.selenium import utils
Expand All @@ -9,24 +7,16 @@

class SingleCandidatePageTests(BaseTest):

def setUp(self):
self.url = self.base_url + '/candidate/H0OH08029'

def testSingleCandidatePageLoads(self):
self.driver.get(self.base_url + '/candidates')
utils.wait_for_event(self.driver, 'draw.dt', 'draw')
self.driver.find_element_by_css_selector('a[data-category="candidate"]').click()

@unittest.skip('No principal committee links in test subset')
def testCommitteeLink(self):
self.driver.get(self.url)
self.assertTrue(self.elementExistsByXPath('//a[contains(@href, "committee/")]'))
link = self.driver.find_element_by_xpath('//a[contains(@href, "committees/")]')
self.assertEqual(link.text, 'OBAMA FOR AMERICA')

def test_glossary_load_from_term(self):
self.driver.get(self.base_url + '/candidates')
utils.wait_for_event(self.driver, 'draw.dt', 'draw')
self.driver.find_element_by_css_selector('a[data-category="candidate"]').click()

def testGlossaryLoadFromTerm(self):
self.driver.get(self.url)
term = self.driver.find_element_by_class_name('term')
term.click()
glossary = self.getGlossary()
Expand All @@ -41,4 +31,4 @@ def testGlossaryLoadFromTerm(self):
# Definition is expanded
self.assertTrue(
self.driver.find_element_by_css_selector('.glossary-definition').text
)
)
20 changes: 0 additions & 20 deletions tests/selenium/single_committee_page_tests.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,11 @@
import unittest

from .base_test_class import BaseTest

from tests.selenium import utils


class SingleCommitteePageTests(BaseTest):

def setUp(self):
self.url = self.base_url + '/committee/C00374058'

def testSingleCommitteePageLoads(self):
self.driver.get(self.base_url + '/committees')
utils.wait_for_event(self.driver, 'draw.dt', 'draw')
self.driver.find_element_by_css_selector('a[data-category="committee"]').click()

@unittest.skip('No principal committee links in test subset')
def testCandidateLink(self):
self.driver.get(self.url)
self.assertEqual(
self.elementExistsByXPath(
'//a[contains(@href, "candidate/")]'),
True)
if self.elementExistsByXPath(
'//a[contains(@href, "candidate/")]'):
link = self.driver.find_element_by_xpath(
'//a[contains(@href, "candidate/")]')
self.assertEqual(
link.text,
'ALLIEGRO, MARK C')