Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JR & LK - test that login directs to dashboard
- Loading branch information
Showing
3 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
|