def test_can_start_a_list_and_retrieve_it_later(self):
# Edith has heard about a cool new online to-do app. She goes to check its homepage
self.browser.get(self.live_server_url)
# She notices the page title and header mention to-do lists
self.assertIn('To-Do', self.browser.title)
header_text = self.browser.find_element_by_tag_name('h1').text
self.assertIn('To-Do', header_text )
inputbox = self.browser.find_element_by_id('id_new_item')
self.assertEqual( inputbox.get_attribute('placeholder'), 'Enter a to-do item')
inputbox.send_keys('Buy peacock feathers')
inputbox.send_keys(Keys.ENTER)
edith_list_url = self.browser.current_url
self.assertRegex(edith_list_url, '/lists/.+')
self.check_for_row_in_list_table('1: Buy peacock feathers')
inputbox = self.browser.find_element_by_id('id_new_item')
inputbox.send_keys('Use peacock feathers to make a fly' )
inputbox.send_keys(Keys.ENTER)
self.check_for_row_in_list_table('1: Buy peacock feathers')
self.check_for_row_in_list_table('2: Use peacock feathers to make a fly')
#New user comes along to the site
## We're closing and opening the browser to create a new session
## to check that none of Edith's stuff comes through cookies, etc
self.browser.quit()
self.browser = webdriver.Firefox()
#Check new user doesn't see Edith's list
self.browser.get(self.live_server_url)
page_text = self.browser.find_element_by_tag_name('body').text
self.assertNotIn('Buy peacock feathers', page_text)
self.assertNotIn('make a fly', page_text)
#New user, Francis, starts a new list
inputbox = self.browser.find_element_by_id('id_new_item')
inputbox.send_keys('Buy milk')
inputbox.send_keys(Keys.ENTER)
#New user gets unique url
francis_list_url = self.browser.current_url
self.assertRegex(francis_list_url, '/lists/.+')
self.assertNotEqual(francis_list_url, edith_list_url)
#Let's double check for the first user's, Edith, list
page_text = self.browser.find_element_by_tag_name('body').text
self.assertNotIn('Buy peacock feathers', page_text)
self.assertIn('Buy milk', page_text)
--
You received this message because you are subscribed to the Google Groups "Obey the testing goat! Test-Driven Web Development with Python book" group.
To unsubscribe from this group and stop receiving emails from it, send an email to obey-the-testing-go...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to obey-the-testing-goat-book+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to obey-the-testing-go...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--------------------------------
Harry J.W. Percival
------------------------------
Twitter: @hjwp
Mobile: +44 (0) 78877 02511
Skype: harry.percival
--
You received this message because you are subscribed to the Google Groups "Obey the testing goat! Test-Driven Web Development with Python book" group.
To unsubscribe from this group and stop receiving emails from it, send an email to obey-the-testing-go...@googlegroups.com.
I still don't know what point in the book you're at. And, if you're saying this happens after we've built the second browser window, then why is it checking for "buy peacock feathers"? that's in the first browser window...
On 23 April 2015 at 17:31, Mitch Raful <mitch...@gmail.com> wrote:
When running the functional test it loads up the input boxes. On the browser I get The requested URL /lists//add_item was not found on this server. Then it launches the window for the second user with the Start a to do list window, then I get this from the test
raceback (most recent call last):
File "/Users/mitchellraful/Desktop/tdd/superlists/functional_tests/tests.py", line 44, in test_can_start_a_list_and_retrieve_it_later
self.check_for_row_in_list_table('1: Buy peacock feathers')
File "/Users/mitchellraful/Desktop/tdd/superlists/functional_tests/tests.py", line 16, in check_for_row_in_list_table
table = self.browser.find_element_by_id('id_list_table')
File "/Users/mitchellraful/Desktop/tdd/lib/python3.4/site-packages/selenium/webdriver/remote/webdriver.py", line 208, in find_element_by_id
return self.find_element(by=By.ID, value=id_)
File "/Users/mitchellraful/Desktop/tdd/lib/python3.4/site-packages/selenium/webdriver/remote/webdriver.py", line 664, in find_element
{'using': by, 'value': value})['value']
File "/Users/mitchellraful/Desktop/tdd/lib/python3.4/site-packages/selenium/webdriver/remote/webdriver.py", line 175, in execute
self.error_handler.check_response(response)
File "/Users/mitchellraful/Desktop/tdd/lib/python3.4/site-packages/selenium/webdriver/remote/errorhandler.py", line 166, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: {"method":"id","selector":"id_list_table"}
Stacktrace:
at FirefoxDriver.prototype.findElementInternal_ (file:///var/folders/pv/xbvh6cvj1p90t6r28mj4gn2c0000gn/T/tmpridmesoj/extensions/fxdriv...@googlecode.com/components/driver-component.js:10271)
at fxdriver.Timer.prototype.setTimeout/<.notify (file:///var/folders/pv/xbvh6cvj1p90t6r28mj4gn2c0000gn/T/tmpridmesoj/extensions/fxdriv...@googlecode.com/components/driver-component.js:603)
To unsubscribe from this group and stop receiving emails from it, send an email to obey-the-testing-goat-book+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--------------------------------
Harry J.W. Percival
------------------------------
Twitter: @hjwp
Mobile: +44 (0) 78877 02511
Skype: harry.percival
--
You received this message because you are subscribed to the Google Groups "Obey the testing goat! Test-Driven Web Development with Python book" group.
To unsubscribe from this group and stop receiving emails from it, send an email to obey-the-testing-goat-book+unsub...@googlegroups.com.
<form method="POST" action="/lists/1/add_item">
it works. Why no list_id???
<form method="POST" action="/lists/new">
<form method="POST" action="/lists/{{ list.id }}/add_item">
at FirefoxDriver.prototype.findElementInternal_ (file:///var/folders/pv/xbvh6cvj1p90t6r28mj4gn2c0000gn/T/tmpridmesoj/extensions/fxdr...@googlecode.com/components/driver-component.js:10271)
at fxdriver.Timer.prototype.setTimeout/<.notify (file:///var/folders/pv/xbvh6cvj1p90t6r28mj4gn2c0000gn/T/tmpridmesoj/extensions/fxdr...@googlecode.com/components/driver-component.js:603)
To unsubscribe from this group and stop receiving emails from it, send an email to obey-the-testing-go...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--------------------------------
Harry J.W. Percival
------------------------------
Twitter: @hjwp
Mobile: +44 (0) 78877 02511
Skype: harry.percival
--
You received this message because you are subscribed to the Google Groups "Obey the testing goat! Test-Driven Web Development with Python book" group.
To unsubscribe from this group and stop receiving emails from it, send an email to obey-the-testing-go...@googlegroups.com.
--------------------------------
Harry J.W. Percival
------------------------------
Twitter: @hjwp
Mobile: +44 (0) 78877 02511
Skype: harry.percival
--
You received this message because you are subscribed to the Google Groups "Obey the testing goat! Test-Driven Web Development with Python book" group.
To unsubscribe from this group and stop receiving emails from it, send an email to obey-the-testing-go...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Harry Percival
+44 78877 02511