kotti_contactform browser tests
===============================

Setup and Login
---------------

  >>> from kotti import tests
  >>> tools = tests.setUpFunctional(
  ... **{'kotti.configurators': 'kotti_contactform.kotti_configure',
  ...    'kotti.includes': 'kotti_contactform.tests.setup_dummy_mailer',
  ...   })
  >>> browser = tools['Browser']()
  >>> ctrl = browser.getControl

  >>> browser.open(tests.BASE_URL + '/edit')
  >>> "Log in" in browser.contents
  True
  >>> ctrl("Username or email").value = "admin"
  >>> ctrl("Password").value = "secret"
  >>> ctrl(name="submit").click()
  >>> "Welcome, Administrator" in browser.contents
  True

Add a ContactForm
-----------------

  >>> browser.getLink("Add").click()
  >>> ctrl('ContactForm').click()
  >>> ctrl('Continue').click()
  >>> ctrl("Title").value = "new contact form"
  >>> ctrl("Recipient").value = "test@localhost.local"
  >>> ctrl("Body").value = "The body text"
  >>> ctrl("save").click()
  >>> "Successfully added item" in browser.contents
  True
  >>> browser.url == tests.BASE_URL + '/new-contact-form/@@edit'
  True

View ContactForm
----------------

  >>> browser.open(tests.BASE_URL + '/new-contact-form/')
  >>> "Address" in browser.contents
  True
  >>> "The body text" in browser.contents
  True

Submit ContactForm
------------------

  >>> ctrl("Full Name").value = "Test"
  >>> ctrl("E-Mail Address").value = "wrong email"
  >>> ctrl("Subject").value = "foosubject"
  >>> ctrl("Your message").value = "test message"
  >>> ctrl("submit").click()
  >>> "Invalid email address" in browser.contents
  True
  >>> browser.open(tests.BASE_URL + '/new-contact-form/')
  >>> ctrl("Full Name").value = "Test"
  >>> ctrl("E-Mail Address").value = "foo@example.com"
  >>> ctrl("Subject").value = "foosubject"
  >>> ctrl("Your message").value = "test message"
  >>> ctrl("submit").click()
  >>> "Thanks for your submission" in browser.contents
  True
