Skip to content

Commit

Permalink
Hack FT Runner to test staging site
Browse files Browse the repository at this point in the history
  • Loading branch information
Juan J. San Emeterio authored and Juan J. San Emeterio committed Dec 21, 2014
1 parent 344167e commit 7f61fe8
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions functional_tests/tests.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
import sys

class NewVisitorTest(StaticLiveServerTestCase):

@classmethod
def setUpClass(cls):
for arg in sys.argv:
if 'liveserver' in arg:
cls.server_url = 'http://' + arg.split('=')[1]
return
super().setUpClass()
cls.server_url = cls.live_server_url

@classmethod
def tearDownClass(cls):
if cls.server_url == cls.live_server_url:
super().tearDownClass()



def setUp(self):
self.browser=webdriver.Firefox()
self.browser.implicitly_wait(3)
Expand All @@ -19,7 +36,7 @@ def check_for_row_in_list_table(self, row_text):
def test_can_start_a_list_and_retreive_it_later(self):

#Cheryl has so much stuff to do, she decides that she needs to start a to-do list and goes the superlists website!
self.browser.get(self.live_server_url)
self.browser.get(self.server_url)

#She notices the header and page title say "To-Do"
self.assertIn('To-Do',self.browser.title)
Expand Down Expand Up @@ -60,7 +77,7 @@ def test_can_start_a_list_and_retreive_it_later(self):
self.browser = webdriver.Firefox()

#Francis visits the homepage and none of Edith's items are present
self.browser.get(self.live_server_url)
self.browser.get(self.server_url)
page_text = self.browser.find_element_by_tag_name('body').text
self.assertNotIn('Buy peacock feathers', page_text)
self.assertNotIn('Buy a hat', page_text)
Expand All @@ -84,7 +101,7 @@ def test_can_start_a_list_and_retreive_it_later(self):

def test_layout_and_styling(self):
#Edith goes to the home page
self.browser.get(self.live_server_url)
self.browser.get(self.server_url)
self.browser.set_window_size(1024, 768)

#she notices the input box is nicely centered
Expand Down

0 comments on commit 7f61fe8

Please sign in to comment.