Commit 88953561 authored by Alec Wang's avatar Alec Wang

added new functional test user story that allows them to create and update in...

added new functional test user story that allows them to create and update in the relevant pages of each model. Also updated froyo html templates to fit this new user story
parent 41fbdf95
......@@ -35,10 +35,10 @@
</tr>
<tr>
<td>
<div contenteditable></div>
<div contenteditable name="ingredient"></div>
</td>
<td>
<div contenteditable></div>
<div contenteditable name="qty"></div>
</td>
<td>
<button><a href="">create</a></button>
......
......@@ -35,10 +35,13 @@
</tr>
<tr>
<td>
<div contenteditable>Coconuts</div>
<div contenteditable name="ingredient">Coconuts</div>
</td>
<td>
<div contenteditable>12</div>
<div contenteditable name="qty">12</div>
</td>
<td>
<button><a href=#>update</a></button>
</td>
</tr>
</table>
......
......@@ -33,26 +33,25 @@
<tr>
<td>Customer</td>
<td>
<div contenteditable></div>
<div contenteditable name="customer"></div>
</td>
</tr>
<tr>
<td>Size</td>
<td>
<div contenteditable></div>
<div contenteditable name="size"></div>
</td>
</tr>
<tr>
<td>Base Recipe</td>
<td>
<div contenteditable></div>
<div contenteditable name="base-recipe"></div>
</td>
</tr>
<tr>
<td>Customization</td>
<td>
<div contenteditable></div><br>
<div contenteditable></div>
<div contenteditable name="customization"></div>
</td>
<td>
<button><a href="">create</a></button>
......
......@@ -33,26 +33,28 @@
<tr>
<td>Customer</td>
<td>
<div contenteditable>Krystel</div>
<div contenteditable name="customer">Krystel</div>
</td>
</tr>
<tr>
<td>Size</td>
<td>
<div contenteditable>Venti (20 oz)</div>
<div contenteditable name="size">Venti (20 oz)</div>
</td>
</tr>
<tr>
<td>Base Recipe</td>
<td>
<div contenteditable>Dark Muffin</div>
<div contenteditable name="base-recipe">Dark Muffin</div>
</td>
</tr>
<tr>
<td>Customization</td>
<td>
<div contenteditable>3 extra slice of bacon</div><br>
<div contenteditable>8 sprinkles of yellow salt</div>
<div contenteditable name="customization">3 extra slice of bacon<br>8 sprinkles of yellow salt</div>
</td>
<td>
<button><a href="">update</a></button>
</td>
</tr>
</table>
......
......@@ -34,26 +34,26 @@
<tr>
<td>
<div contenteditable>Strawberries</div>
<div contenteditable name="ingredient"></div>
</td>
<td>
<div contenteditable>4</div>
<div contenteditable name="qty"></div>
</td>
</tr>
<tr>
<td>
<div contenteditable>Bat Wings</div>
<div contenteditable name="ingredient"></div>
</td>
<td>
<div contenteditable>6</div>
<div contenteditable name="qty"></div>
</td>
</tr>
<tr>
<td>
<div contenteditable>Peanuts</div>
<div contenteditable name="ingredient"></div>
</td>
<td>
<div contenteditable>3</div>
<div contenteditable name="qty"></div>
</td>
<td>
<button><a href="">create</a></button>
......
......@@ -27,31 +27,36 @@
</header>
<table style="width:40%">
<tr>
<th colspan="2">Recipe: Black Muffin Light</th>
<th colspan="2">
<div contenteditable>Recipe: </div>
</th>
</tr>
<tr>
<td>
<div contenteditable>Strawberries</div>
<div contenteditable name="ingredient">Strawberries</div>
</td>
<td>
<div contenteditable>4</div>
<div contenteditable name="qty">4</div>
</td>
</tr>
<tr>
<td>
<div contenteditable>Bat Wings</div>
<div contenteditable name="ingredient">Bat Wings</div>
</td>
<td>
<div contenteditable>6</div>
<div contenteditable name="qty">6</div>
</td>
</tr>
<tr>
<td>
<div contenteditable>Peanuts</div>
<div contenteditable name="ingredient">Peanuts</div>
</td>
<td>
<div contenteditable>3</div>
<div contenteditable name="qty">3</div>
</td>
<td>
<button><a href="">update</a></button>
</td>
</tr>
</table>
......
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import unittest
import time
......@@ -10,100 +11,251 @@ class UserTest(unittest.TestCase):
def tearDown(self):
self.browser.quit()
# a user wants to check out one of the pages.
# this test covers all functionality as of the current version of thegoodplace
# Usecase: a user wants to check out one of the pages.
# this test covers all the page links as of the current version of thegoodplace
def test_can_walk_and_display_all_pages(self):
self.browser.get('http://localhost:8000/')
self.assertIn('Home Directory', self.browser.title)
time.sleep(1)
time.sleep(0.2)
self.browser.find_element_by_link_text("Ingredients - List").click()
time.sleep(1)
time.sleep(0.2)
self.assertIn('Ingredients - List', self.browser.page_source)
time.sleep(1)
time.sleep(0.2)
self.browser.find_element_by_link_text("Go Home").click()
time.sleep(1)
time.sleep(0.2)
self.browser.find_element_by_link_text("Ingredients - Update").click()
time.sleep(1)
time.sleep(0.2)
self.assertIn('Ingredients - Update', self.browser.page_source)
time.sleep(1)
time.sleep(0.2)
self.browser.find_element_by_link_text("Go Home").click()
time.sleep(1)
time.sleep(0.2)
self.browser.find_element_by_link_text("Ingredients - Create").click()
time.sleep(1)
time.sleep(0.2)
self.assertIn('Ingredients - Create', self.browser.page_source)
time.sleep(1)
time.sleep(0.2)
self.browser.find_element_by_link_text("Go Home").click()
time.sleep(1)
time.sleep(0.2)
self.browser.find_element_by_link_text("Ingredients - Detail").click()
time.sleep(1)
time.sleep(0.2)
self.assertIn('Ingredients - Detail', self.browser.page_source)
time.sleep(1)
time.sleep(0.2)
self.browser.find_element_by_link_text("Go Home").click()
time.sleep(1)
time.sleep(0.2)
self.browser.find_element_by_link_text("Orders - List").click()
time.sleep(1)
time.sleep(0.2)
self.assertIn('Orders - List', self.browser.page_source)
time.sleep(1)
time.sleep(0.2)
self.browser.find_element_by_link_text("Go Home").click()
time.sleep(1)
time.sleep(0.2)
self.browser.find_element_by_link_text("Orders - Update").click()
time.sleep(1)
time.sleep(0.2)
self.assertIn('Orders - Update', self.browser.page_source)
time.sleep(1)
time.sleep(0.2)
self.browser.find_element_by_link_text("Go Home").click()
time.sleep(1)
time.sleep(0.2)
self.browser.find_element_by_link_text("Orders - Create").click()
time.sleep(1)
time.sleep(0.2)
self.assertIn('Orders - Create', self.browser.page_source)
time.sleep(1)
time.sleep(0.2)
self.browser.find_element_by_link_text("Go Home").click()
time.sleep(1)
time.sleep(0.2)
self.browser.find_element_by_link_text("Orders - Detail").click()
time.sleep(1)
time.sleep(0.2)
self.assertIn('Orders - Detail', self.browser.page_source)
time.sleep(1)
time.sleep(0.2)
self.browser.find_element_by_link_text("Go Home").click()
time.sleep(1)
time.sleep(0.2)
self.browser.find_element_by_link_text("Recipes - List").click()
time.sleep(1)
time.sleep(0.2)
self.assertIn('Recipes - List', self.browser.page_source)
time.sleep(1)
time.sleep(0.2)
self.browser.find_element_by_link_text("Go Home").click()
time.sleep(1)
time.sleep(0.2)
self.browser.find_element_by_link_text("Recipes - Update").click()
time.sleep(1)
time.sleep(0.2)
self.assertIn('Recipes - Update', self.browser.page_source)
time.sleep(1)
time.sleep(0.2)
self.browser.find_element_by_link_text("Go Home").click()
time.sleep(1)
time.sleep(0.2)
self.browser.find_element_by_link_text("Recipes - Create").click()
time.sleep(1)
time.sleep(0.2)
self.assertIn('Recipes - Create', self.browser.page_source)
time.sleep(1)
time.sleep(0.2)
self.browser.find_element_by_link_text("Go Home").click()
time.sleep(1)
time.sleep(0.2)
self.browser.find_element_by_link_text("Recipes - Detail").click()
time.sleep(1)
time.sleep(0.2)
self.assertIn('Recipes - Detail', self.browser.page_source)
time.sleep(1)
time.sleep(0.2)
self.browser.find_element_by_link_text("Go Home").click()
time.sleep(1)
time.sleep(0.2)
self.assertIn('Home Directory', self.browser.title)
self.fail("Test is passed")
self.fail("Page Walking Test is passed")
# Usecase: A user wants to use the update and create functionality of the ingredients models.
def test_create_and_update_pages_for_ingredients_work(self):
self.browser.get('http://localhost:8000/')
self.assertIn('Home Directory', self.browser.title)
time.sleep(0.2)
# Ingredients Create starts here
self.browser.find_element_by_link_text("Ingredients - Create").click()
time.sleep(0.2)
self.assertIn('Ingredients - Create', self.browser.page_source)
time.sleep(0.2)
element = self.browser.find_element_by_name('ingredient')
element.send_keys("lorem ipsum ingredients")
self.assertIn('lorem ipsum ingredients', self.browser.page_source)
time.sleep(0.2)
element = self.browser.find_element_by_name('qty')
element.send_keys("lorem ipsum qty")
self.assertIn('lorem ipsum qty', self.browser.page_source)
time.sleep(0.2)
self.browser.find_element_by_link_text("create").click()
time.sleep(0.2)
self.browser.find_element_by_link_text("Go Home").click()
time.sleep(0.2)
# Ingredients Update starts here
self.browser.find_element_by_link_text("Ingredients - Update").click()
time.sleep(0.2)
self.assertIn('Ingredients - Update', self.browser.page_source)
time.sleep(0.2)
element = self.browser.find_element_by_name('ingredient')
element.clear()
element.send_keys("lorem ipsum ingredients")
self.assertIn('lorem ipsum ingredients', self.browser.page_source)
time.sleep(0.2)
element = self.browser.find_element_by_name('qty')
element.clear()
element.send_keys("lorem ipsum qty")
self.assertIn('lorem ipsum qty', self.browser.page_source)
time.sleep(0.2)
self.browser.find_element_by_link_text("update").click()
time.sleep(0.2)
self.browser.find_element_by_link_text("Go Home").click()
time.sleep(0.2)
self.fail("Ingredients Update and Create Test is passed")
# Usecase: A user wants to use the update and create functionality of the orders models.
def test_create_and_update_pages_for_orders_work(self):
self.browser.get('http://localhost:8000/')
self.assertIn('Home Directory', self.browser.title)
time.sleep(0.2)
# Orders Create starts here
self.browser.find_element_by_link_text("Orders - Create").click()
time.sleep(0.2)
self.assertIn('Orders - Create', self.browser.page_source)
time.sleep(0.2)
element = self.browser.find_element_by_name('customer')
element.send_keys("lorem ipsum customer")
self.assertIn('lorem ipsum customer', self.browser.page_source)
time.sleep(0.2)
element = self.browser.find_element_by_name('size')
element.send_keys("lorem ipsum size")
self.assertIn('lorem ipsum size', self.browser.page_source)
time.sleep(0.2)
element = self.browser.find_element_by_name('base-recipe')
element.send_keys("lorem ipsum base-recipe")
self.assertIn('lorem ipsum base-recipe', self.browser.page_source)
time.sleep(0.2)
element = self.browser.find_element_by_name('customization')
element.send_keys(
"lorem ipsum customization1", Keys.ENTER, "lorem ipsum customization2")
self.assertIn('lorem ipsum customization1',
self.browser.page_source)
self.assertIn('lorem ipsum customization2',
self.browser.page_source)
time.sleep(0.2)
self.browser.find_element_by_link_text("create").click()
time.sleep(0.2)
self.browser.find_element_by_link_text("Go Home").click()
time.sleep(0.2)
# Orders Update starts here
self.browser.find_element_by_link_text("Orders - Update").click()
time.sleep(0.2)
self.assertIn('Orders - Update', self.browser.page_source)
time.sleep(0.2)
element = self.browser.find_element_by_name('customer')
element.clear()
element.send_keys("lorem ipsum customer")
self.assertIn('lorem ipsum customer', self.browser.page_source)
time.sleep(0.2)
element = self.browser.find_element_by_name('size')
element.clear()
element.send_keys("lorem ipsum size")
self.assertIn('lorem ipsum size', self.browser.page_source)
time.sleep(0.2)
element = self.browser.find_element_by_name('base-recipe')
element.clear()
element.send_keys("lorem ipsum base-recipe", )
self.assertIn('lorem ipsum base-recipe', self.browser.page_source)
time.sleep(0.2)
element = self.browser.find_element_by_name('customization')
element.clear()
element.send_keys(
"lorem ipsum customization1", Keys.ENTER, "lorem ipsum customization2")
self.assertIn('lorem ipsum customization1',
self.browser.page_source)
self.assertIn('lorem ipsum customization2',
self.browser.page_source)
time.sleep(0.2)
self.browser.find_element_by_link_text("update").click()
time.sleep(0.2)
self.fail("Orders Update and Create Test is passed")
# Usecase: A user wants to use the update and create functionality of the recipes models.
def test_create_and_update_pages_for_recipes_work(self):
self.browser.get('http://localhost:8000/')
self.assertIn('Home Directory', self.browser.title)
time.sleep(0.2)
# Recipes Create Starts Here
self.browser.find_element_by_link_text("Recipes - Create").click()
time.sleep(0.2)
self.assertIn('Recipes - Create', self.browser.page_source)
time.sleep(0.2)
element = self.browser.find_element_by_name('ingredient')
element.send_keys("lorem ipsum ingredients")
self.assertIn('lorem ipsum ingredients', self.browser.page_source)
time.sleep(0.2)
element = self.browser.find_element_by_name('qty')
element.send_keys("lorem ipsum qty")
self.assertIn('lorem ipsum qty', self.browser.page_source)
time.sleep(0.2)
self.browser.find_element_by_link_text("create").click()
time.sleep(0.2)
self.browser.find_element_by_link_text("Go Home").click()
time.sleep(0.2)
# Recipes Update Starts Here
self.browser.find_element_by_link_text("Recipes - Update").click()
time.sleep(0.2)
self.assertIn('Recipes - Update', self.browser.page_source)
time.sleep(0.2)
element = self.browser.find_element_by_name('ingredient')
element.clear()
element.send_keys("lorem ipsum ingredients")
self.assertIn('lorem ipsum ingredients', self.browser.page_source)
time.sleep(0.2)
element = self.browser.find_element_by_name('qty')
element.clear()
element.send_keys("lorem ipsum qty")
self.assertIn('lorem ipsum qty', self.browser.page_source)
time.sleep(0.2)
self.browser.find_element_by_link_text("update").click()
time.sleep(0.2)
self.fail("Recipes Update and Create Test is passed")
if __name__ == '__main__':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment