Skip to content

Commit

Permalink
JR & LK - test that login directs to dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
lknapp committed Jul 18, 2014
1 parent c628e45 commit d706af2
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion run-selenium-tests.sh
@@ -1,3 +1,3 @@
#!/bin/bash -e

env/bin/python -m unittest discover -s selenium/ -p '*_test.py'
python -m unittest discover -s selenium/ -p '*_test.py'
2 changes: 1 addition & 1 deletion selenium/first_time_login_screen_test.py
Expand Up @@ -5,7 +5,7 @@
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

class SecondTimeChangePasswordAttempt(unittest.TestCase):
class SecondTimeChangePasswordAttempt (unittest.TestCase):

def setUp(self):
self.driver = webdriver.Firefox()
Expand Down
32 changes: 32 additions & 0 deletions selenium/login_test.py
@@ -0,0 +1,32 @@
import unittest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

class Login (unittest.TestCase):

def setUp(self):
self.driver = webdriver.Firefox()

def test_login_redirects_to_dashboard (self):
driver = self.driver
driver.get("http://gw.home.lan/login.html")

pass_field = driver.find_element_by_id("password")
pass_field.send_keys("asdf1234")

submit_button = driver.find_element_by_id('submit')
submit_button.click()

successful_redirect = WebDriverWait(driver, 5).until(
EC.text_to_be_present_in_element((By.CSS_SELECTOR, "body > div > header > h1"), "Dashboard")
)

def tearDown(self):
self.driver.close()

if __name__ == "__main__":
unittest.main()

0 comments on commit d706af2

Please sign in to comment.