Commit c8510fc6 authored by Moira's avatar Moira

added functional tests

parent 31def305
Pipeline #1147 failed with stages
from selenium import webdriver
import unittest
class NewVisitorTest(unittest.TestCase):
def setUp(self):
self.browser = webdriver.Firefox()
def tearDown(self):
self.browser.quit()
def test_can_display_froyo_shop_home(self):
self.browser.get('http://localhost:8000')
self.assertIn('The Good Place Froyo Shop', self.browser.title)
self.assertTrue(self.browser.find_element_by_id("header_home"))
def test_froyo_display_ingredients_list(self):
self.browser.get('http://localhost:8000/home')
ingredients_list = self.browser.find_element_by_id('ingredients_list')
ingredients_list.click()
self.assertEqual('http://localhost:8000/ingredients/list', self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("ingredients_list_header"))
home = self.browser.find_element_by_id('home')
home.click()
self.assertEqual('http://localhost:8000/home', self.browser.current_url)
self.assertIn('The Good Place Froyo Shop', self.browser.title)
self.assertTrue(self.browser.find_element_by_id("header_home"))
def test_froyo_display_ingredients_detail(self):
self.browser.get('http://localhost:8000/home')
ingredients_detail = self.browser.find_element_by_id('ingredients_detail')
ingredients_detail.click()
self.assertEqual('http://localhost:8000/ingredients/detail', self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("ingredients_detail_header"))
home = self.browser.find_element_by_id('home')
home.click()
self.assertEqual('http://localhost:8000/home', self.browser.current_url)
self.assertIn('The Good Place Froyo Shop', self.browser.title)
self.assertTrue(self.browser.find_element_by_id("header_home"))
def test_froyo_display_ingredients_update_form(self):
self.browser.get('http://localhost:8000/home')
ingredients_update_form = self.browser.find_element_by_id('ingredients_update_form')
ingredients_update_form.click()
self.assertEqual('http://localhost:8000/ingredients/update_form', self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("ingredients_update_form_header"))
home = self.browser.find_element_by_id('home')
home.click()
self.assertEqual('http://localhost:8000/home', self.browser.current_url)
self.assertIn('The Good Place Froyo Shop', self.browser.title)
self.assertTrue(self.browser.find_element_by_id("header_home"))
def test_froyo_display_ingredients_create_form(self):
self.browser.get('http://localhost:8000/home')
ingredients_create_form = self.browser.find_element_by_id('ingredients_create_form')
ingredients_create_form.click()
self.assertEqual('http://localhost:8000/ingredients/create_form', self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("ingredients_create_form_header"))
home = self.browser.find_element_by_id('home')
home.click()
self.assertEqual('http://localhost:8000/home', self.browser.current_url)
self.assertIn('The Good Place Froyo Shop', self.browser.title)
self.assertTrue(self.browser.find_element_by_id("header_home"))
def test_froyo_display_recipes_list(self):
self.browser.get('http://localhost:8000/home')
recipes_list = self.browser.find_element_by_id('recipe_list')
recipes_list.click()
self.assertEqual('http://localhost:8000/recipes/list', self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("recipes_list_header"))
home = self.browser.find_element_by_id('home')
home.click()
self.assertEqual('http://localhost:8000/home', self.browser.current_url)
self.assertIn('The Good Place Froyo Shop', self.browser.title)
self.assertTrue(self.browser.find_element_by_id("header_home"))
def test_froyo_display_recipes_detail(self):
self.browser.get('http://localhost:8000/home')
recipes_detail = self.browser.find_element_by_id('recipe_detail')
recipes_detail.click()
self.assertEqual('http://localhost:8000/recipes/detail', self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("recipes_detail_header"))
home = self.browser.find_element_by_id('home')
home.click()
self.assertEqual('http://localhost:8000/home', self.browser.current_url)
self.assertIn('The Good Place Froyo Shop', self.browser.title)
self.assertTrue(self.browser.find_element_by_id("header_home"))
def test_froyo_display_recipes_update_form(self):
self.browser.get('http://localhost:8000/home')
recipes_update_form = self.browser.find_element_by_id('recipe_update_form')
recipes_update_form.click()
self.assertEqual('http://localhost:8000/recipes/update_form', self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("recipes_update_form_header"))
home = self.browser.find_element_by_id('home')
home.click()
self.assertEqual('http://localhost:8000/home', self.browser.current_url)
self.assertIn('The Good Place Froyo Shop', self.browser.title)
self.assertTrue(self.browser.find_element_by_id("header_home"))
def test_froyo_display_recipes_create_form(self):
self.browser.get('http://localhost:8000/home')
recipes_create_form = self.browser.find_element_by_id('recipe_create_form')
recipes_create_form.click()
self.assertEqual('http://localhost:8000/recipes/create_form', self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("recipes_create_form_header"))
home = self.browser.find_element_by_id('home')
home.click()
self.assertEqual('http://localhost:8000/home', self.browser.current_url)
self.assertIn('The Good Place Froyo Shop', self.browser.title)
self.assertTrue(self.browser.find_element_by_id("header_home"))
def test_froyo_display_orders_list(self):
self.browser.get('http://localhost:8000/home')
orders_list = self.browser.find_element_by_id('orders_list')
orders_list.click()
self.assertEqual('http://localhost:8000/orders/list', self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("orders_list_header"))
home = self.browser.find_element_by_id('home')
home.click()
self.assertEqual('http://localhost:8000/home', self.browser.current_url)
self.assertIn('The Good Place Froyo Shop', self.browser.title)
self.assertTrue(self.browser.find_element_by_id("header_home"))
def test_froyo_display_orders_detail(self):
self.browser.get('http://localhost:8000/home')
orders_detail = self.browser.find_element_by_id('orders_detail')
orders_detail.click()
self.assertEqual('http://localhost:8000/orders/detail', self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("orders_detail_header"))
home = self.browser.find_element_by_id('home')
home.click()
self.assertEqual('http://localhost:8000/home', self.browser.current_url)
self.assertIn('The Good Place Froyo Shop', self.browser.title)
self.assertTrue(self.browser.find_element_by_id("header_home"))
def test_froyo_display_orders_update_form(self):
self.browser.get('http://localhost:8000/home')
orders_update_form = self.browser.find_element_by_id('orders_update_form')
orders_update_form.click()
self.assertEqual('http://localhost:8000/orders/update_form', self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("orders_create_form_header"))
home = self.browser.find_element_by_id('home')
self.assertEqual('http://localhost:8000/home', self.browser.current_url)
self.assertIn('The Good Place Froyo Shop', self.browser.title)
self.assertTrue(self.browser.find_element_by_id("header_home"))
def test_froyo_display_orders_create_form(self):
self.browser.get('http://localhost:8000/home')
orders_create_form = self.browser.find_element_by_id('orders_create_form')
orders_create_form.click()
self.assertEqual('http://localhost:8000/orders/create_form', self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("orders_create_form_header"))
home = self.browser.find_element_by_id('home')
home.click()
self.assertEqual('http://localhost:8000/home', self.browser.current_url)
self.assertIn('The Good Place Froyo Shop', self.browser.title)
self.assertTrue(self.browser.find_element_by_id("header_home"))
self.fail('Finish the test!')
if __name__ == '__main__':
unittest.main(warnings = 'ignore')
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