Permalink
Browse files

Merge pull request #2670 from mozilla/kapow

Kapow!
  • Loading branch information...
2 parents 3a4e816 + cb9bb4c commit cec83da8629844bb91ecffd61ffdc9c9fa0c18ef @6a68 6a68 committed Nov 15, 2012
Showing with 3,532 additions and 2,913 deletions.
  1. +6 −3 .awsbox.json
  2. +2 −7 .gitignore
  3. +1 −0 .travis.yml
  4. 0 automation-tests/123done/mocks/__init__.py
  5. +0 −22 automation-tests/123done/mocks/mock_user.py
  6. +0 −4 automation-tests/123done/mozwebqa.cfg
  7. +0 −44 automation-tests/123done/page.py
  8. 0 automation-tests/123done/pages/__init__.py
  9. +0 −74 automation-tests/123done/pages/home.py
  10. 0 automation-tests/123done/restmail/__init__.py
  11. +0 −89 automation-tests/123done/restmail/restmail.py
  12. 0 automation-tests/123done/tests/__init__.py
  13. +0 −64 automation-tests/123done/tests/test_change_password.py
  14. +0 −22 automation-tests/123done/tests/test_logout.py
  15. +0 −33 automation-tests/123done/tests/test_new_user.py
  16. +0 −20 automation-tests/123done/tests/test_sign_in.py
  17. +86 −81 automation-tests/README.md
  18. +0 −4 automation-tests/browserid/.gitignore
  19. +0 −19 automation-tests/browserid/.travis.yml
  20. +0 −20 automation-tests/browserid/README.md
  21. +0 −1 automation-tests/browserid/__init__.py
  22. +0 −71 automation-tests/browserid/browser_id.py
  23. +0 −77 automation-tests/browserid/check_browser_id.py
  24. +0 −14 automation-tests/browserid/conftest.py
  25. 0 automation-tests/browserid/mocks/__init__.py
  26. +0 −21 automation-tests/browserid/mocks/user.py
  27. +0 −3 automation-tests/browserid/mozwebqa.cfg
  28. 0 automation-tests/browserid/pages/__init__.py
  29. +0 −76 automation-tests/browserid/pages/account_manager.py
  30. +0 −16 automation-tests/browserid/pages/base.py
  31. +0 −77 automation-tests/browserid/pages/complete_registration.py
  32. +0 −245 automation-tests/browserid/pages/sign_in.py
  33. +0 −2 automation-tests/browserid/requirements.txt
  34. +0 −2 automation-tests/browserid/setup.cfg
  35. 0 automation-tests/browserid/tests/__init__.py
  36. +0 −47 automation-tests/browserid/tests/base.py
  37. +0 −56 automation-tests/browserid/tests/check_add_email.py
  38. +0 −47 automation-tests/browserid/tests/check_change_password.py
  39. +0 −50 automation-tests/browserid/tests/check_reset_password.py
  40. +0 −104 automation-tests/browserid/tests/check_sign_in.py
  41. +0 −20 automation-tests/browserid/tests/conftest.py
  42. +0 −32 automation-tests/browserid/tests/restmail.py
  43. +65 −0 automation-tests/config/sauce-platforms.js
  44. +12 −0 automation-tests/config/tests-to-ignore.js
  45. +0 −37 automation-tests/credentials.yaml.example
  46. +10 −0 automation-tests/lib/asserts.js
  47. +0 −75 automation-tests/lib/convert_results.js
  48. +30 −0 automation-tests/lib/personatestuser.js
  49. +30 −0 automation-tests/lib/reporters/file-reporter.js
  50. +11 −0 automation-tests/lib/reporters/std-err-reporter.js
  51. +12 −0 automation-tests/lib/reporters/std-out-reporter.js
  52. +47 −0 automation-tests/lib/restmail.js
  53. +77 −0 automation-tests/lib/results-aggregator.js
  54. +31 −0 automation-tests/lib/runner.js
  55. +45 −0 automation-tests/lib/test-finder.js
  56. +197 −0 automation-tests/lib/test-setup.js
  57. +2 −0 automation-tests/lib/timeouts.js
  58. +41 −0 automation-tests/lib/toolbelt.js
  59. +37 −0 automation-tests/lib/urls.js
  60. +59 −0 automation-tests/lib/user.js
  61. +23 −0 automation-tests/lib/utils.js
  62. +68 −0 automation-tests/lib/vows_harness.js
  63. +259 −0 automation-tests/lib/wd-extensions.js
  64. +0 −4 automation-tests/myfavoritebeer/mozwebqa.cfg
  65. +0 −44 automation-tests/myfavoritebeer/page.py
  66. 0 automation-tests/myfavoritebeer/pages/__init__.py
  67. +0 −44 automation-tests/myfavoritebeer/pages/home.py
  68. 0 automation-tests/myfavoritebeer/tests/__init__.py
  69. +0 −21 automation-tests/myfavoritebeer/tests/test_logout.py
  70. +0 −20 automation-tests/myfavoritebeer/tests/test_sign_in.py
  71. +16 −0 automation-tests/package.json
  72. +84 −0 automation-tests/pages/css.js
  73. +30 −0 automation-tests/pages/dialog.js
  74. 0 automation-tests/persona_server/__init__.py
  75. 0 automation-tests/persona_server/pages/__init__.py
  76. +0 −115 automation-tests/persona_server/pages/account_manager.py
  77. +0 −35 automation-tests/persona_server/pages/base.py
  78. +0 −77 automation-tests/persona_server/pages/complete_registration.py
  79. +0 −41 automation-tests/persona_server/pages/home.py
  80. +0 −162 automation-tests/persona_server/pages/sign_in.py
  81. 0 automation-tests/persona_server/tests/__init__.py
  82. +0 −55 automation-tests/persona_server/tests/base.py
  83. +0 −11 automation-tests/persona_server/tests/conftest.py
  84. +0 −124 automation-tests/persona_server/tests/test_manage_account.py
  85. +0 −42 automation-tests/persona_server/tests/test_sign_in_unit.py
  86. +0 −11 automation-tests/requirements.txt
  87. +0 −154 automation-tests/run.py
  88. +0 −365 automation-tests/run_saucelabs
  89. +0 −8 automation-tests/sauce.yaml.example
  90. +78 −0 automation-tests/scripts/post-update.js
  91. +336 −0 automation-tests/scripts/run-all.js
  92. +104 −0 automation-tests/tests/add-primary-to-primary.js
  93. +95 −0 automation-tests/tests/add-primary-to-secondary.js
  94. +181 −0 automation-tests/tests/cancel-account.js
  95. +120 −0 automation-tests/tests/change-password-test.js
  96. +101 −0 automation-tests/tests/frontend-qunit-test.js
  97. +108 −0 automation-tests/tests/health-check-tests.js
  98. +130 −0 automation-tests/tests/new-user/new-user-primary-test.js
  99. +168 −0 automation-tests/tests/new-user/new-user-secondary-test.js
  100. +108 −0 automation-tests/tests/public-terminals.js
  101. +219 −0 automation-tests/tests/remove-email.js
  102. +101 −0 automation-tests/tests/reset-password-test.js
  103. +119 −0 automation-tests/tests/returning-user.js
  104. +89 −0 automation-tests/tests/sign-in-test.js
  105. +0 −1 package.json
  106. +48 −0 scripts/awsbox_local/post_create.js
  107. +30 −0 scripts/awsbox_local/scp.js
  108. 0 scripts/{awsbox → awsbox_remote}/post_create.sh
  109. +1 −0 scripts/{awsbox → awsbox_remote}/post_deploy.sh
  110. +6 −0 scripts/awsbox_remote/post_start.sh
  111. +5 −0 scripts/test
  112. +104 −0 scripts/test_selenium
View
@@ -12,9 +12,12 @@
"CONFIG_FILES": "$HOME/code/config/production.json,$HOME/code/config/aws.json,$HOME/config.json"
},
"hooks": {
- "postdeploy": "scripts/awsbox/post_deploy.sh",
- "poststart": "scripts/show_config.js",
- "postcreate": "scripts/awsbox/post_create.sh"
+ "postdeploy": "scripts/awsbox_remote/post_deploy.sh",
+ "poststart": "scripts/awsbox_remote/post_start.sh",
+ "postcreate": "scripts/awsbox_remote/post_create.sh"
+ },
+ "local_hooks": {
+ "postcreate": "node scripts/awsbox_local/post_create.js"
},
"packages": [
"mysql-server"
View
@@ -16,11 +16,6 @@
Thumbs.db
/locale
/resources/email_templates/email-test.html
-/automation-tests/bid_selenium
+/automation-tests/node_modules
/automation-tests/results
-/automation-tests/credentials.yaml
-/automation-tests/sauce.yaml
-automation-tests/persona_server/results/*
-/automation-tests/chromedriver.log
-/.coverage_data
-/cover_html
+/automation-tests/*.jar
View
@@ -25,6 +25,7 @@ env:
- WHAT_TESTS=front MYSQL_USER=root
- WHAT_TESTS=back_mysql MYSQL_USER=root
- WHAT_TESTS=back
+ - WHAT_TESTS=selenium
mysql:
adapter: mysql2
No changes.
@@ -1,22 +0,0 @@
-#!/usr/bin/env python
-
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-
-class MockUser(dict):
-
- def __init__(self, **kwargs):
- # set your default values
- import time
-
- self['email'] = '123donetest_%s@restmail.net' % repr(time.time())
- self['password'] = 'Password12345'
-
- # update with any keyword arguments passed
- self.update(**kwargs)
-
- # allow getting items as if they were attributes
- def __getattr__(self, attr):
- return self[attr]
@@ -1,4 +0,0 @@
-[DEFAULT]
-api = webdriver
-baseurl = http://dev.123done.org
-tags = 123done
@@ -1,44 +0,0 @@
-#!/usr/bin/env python
-
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-from unittestzero import Assert
-from selenium.webdriver.support.ui import WebDriverWait
-from selenium.common.exceptions import NoSuchElementException
-from selenium.common.exceptions import ElementNotVisibleException
-
-
-class Page(object):
-
- def __init__(self, testsetup):
- self.testsetup = testsetup
- self.base_url = testsetup.base_url
- self.selenium = testsetup.selenium
- self.timeout = testsetup.timeout
-
- @property
- def is_the_current_page(self):
- if self._page_title:
- WebDriverWait(self.selenium, self.timeout).until(lambda s: s.title)
-
- Assert.equal(self.selenium.title, self._page_title)
- return True
-
- def is_element_present(self, *locator):
- self.selenium.implicitly_wait(0)
- try:
- self.selenium.find_element(*locator)
- return True
- except NoSuchElementException:
- return False
- finally:
- # set back to where you once belonged
- self.selenium.implicitly_wait(self.testsetup.default_implicit_wait)
-
- def is_element_visible(self, *locator):
- try:
- return self.selenium.find_element(*locator).is_displayed()
- except NoSuchElementException, ElementNotVisibleException:
- return False
No changes.
@@ -1,74 +0,0 @@
-#!/usr/bin/env python
-
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-from selenium.webdriver.common.by import By
-from selenium.webdriver.support.ui import WebDriverWait
-
-from page import Page
-
-
-class HomePage(Page):
-
- _page_title = '123done - your tasks, simplified'
-
- _sign_in_locator = (By.CSS_SELECTOR, '#loggedout > button')
- _logout_locator = (By.CSS_SELECTOR, '#loggedin > a')
- _logged_in_user_email_locator = (By.CSS_SELECTOR, '#loggedin > span')
- _loading_spinner_locator = (By.CSS_SELECTOR, "li.loading img")
-
- def go_to_home_page(self):
- self.selenium.get(self.base_url + '/')
- WebDriverWait(self.selenium, self.timeout).until(
- lambda s: not self.is_element_visible(*self._loading_spinner_locator),
- 'Timeout waiting for sign-in button to appear.')
- self.is_the_current_page
-
- def sign_in(self, user='default'):
- credentials = self.testsetup.credentials[user]
- browserid = self.click_sign_in()
- browserid.sign_in(credentials['email'], credentials['password'])
- self.wait_for_user_login()
-
- def logout(self):
- self.click_logout()
- WebDriverWait(self.selenium, self.timeout).until(
- lambda s: self.is_element_visible(*self._sign_in_locator) and not \
- self.is_element_visible(*self._loading_spinner_locator),
- 'Timeout waiting for user to log out.')
-
- def click_sign_in(self, expect='new'):
- """Click the 'sign in' button.
-
- Keyword arguments:
- expect -- the expected resulting page
- 'new' for user that is not currently signed in (default)
- 'returning' for users already signed in or recently verified
-
- """
- self.selenium.find_element(*self._sign_in_locator).click()
- from browserid.pages.sign_in import SignIn
- return SignIn(self.selenium, self.timeout, expect=expect)
-
- def click_logout(self):
- self.selenium.find_element(*self._logout_locator).click()
-
- @property
- def is_logged_in(self):
- return self.is_element_visible(*self._logout_locator)
-
- @property
- def logged_in_user_email(self):
- WebDriverWait(self.selenium, self.timeout).until(
- lambda s: self.is_element_visible(*self._logged_in_user_email_locator)and not \
- self.is_element_visible(*self._loading_spinner_locator),
- "Timeout waiting for user's email to appear.")
- return self.selenium.find_element(*self._logged_in_user_email_locator).text
-
- def wait_for_user_login(self):
- WebDriverWait(self.selenium, self.timeout).until(
- lambda s: self.is_element_visible(*self._logout_locator) and not \
- self.is_element_visible(*self._loading_spinner_locator),
- 'Timeout waiting for user to login.')
@@ -1,89 +0,0 @@
-#!/usr/bin/env python
-
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-import requests
-import json
-import re
-from time import sleep
-
-
-class RestmailInbox(object):
- """
- This wrapper loads restmail for the given email address.
- It will loop and wait for an email to arrive if there is not one present.
- find_by_* methods can be used to find an email and return it as Email() class.
- """
-
- _restmail_mail_server = "https://restmail.net/mail/"
-
- def __init__(self, email):
- self.email = email
- self.username = email.split('@')[0]
- self.json = self._wait_and_return_json_response(self.username)
-
- def _wait_and_return_json_response(self, username, timeout=60):
- # Loop for 60 attempts until the restmail json returned is not empty
-
- timer = 0
- response_json = []
-
- while timer < timeout:
- sleep(1)
- timer += 1
-
- response = requests.get(self._restmail_mail_server + self.username, verify=False)
- response_json = json.loads(response.content)
- if response_json != []:
- return response_json
-
- raise Exception("Failed to find an email before timeout")
-
- def delete_all_mail(self):
- # Delete all of the mail in the inbox
-
- requests.delete(self._restmail_mail_server + self.username, verify=False)
-
- def find_by_index(self, index):
- return Email(self.json[index])
-
- def find_by_sender(self, sender):
- # Loop through the address and name objects for each sender and match at least one
-
- for json_object in self.json:
- for from_source in json_object['from']:
- if from_source['address'] == sender or from_source['name'] == sender:
- return Email(json_object)
- else:
- raise Exception("Sender not found")
-
-
-class Email():
- """
- This returns a class representation of an email from restmail inbox
- """
-
- def __init__(self, json):
- self.json = json
-
- @property
- def body(self):
- return(self.json['text'])
-
- @property
- def verify_user_link(self):
- # This returns the link for verifying the email address of a new account
- regex = 'https:\/\/.*verify_email_address\?token=.{48}'
-
- verify_link = re.search(regex, self.body).group(0)
- return verify_link
-
- @property
- def add_email_address_link(self):
- # This returns the link for adding the email address of a new account
- regex = 'https:\/\/.*confirm\?token=.{48}'
-
- add_email_link = re.search(regex, self.body).group(0)
- return add_email_link
No changes.
@@ -1,64 +0,0 @@
-#!/usr/bin/env python
-
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-from pages.home import HomePage
-from restmail.restmail import RestmailInbox
-from mocks.mock_user import MockUser
-from unittestzero import Assert
-
-import pytest
-
-
-class TestChangePassword:
-
- def _persona_server_url(self, mozwebqa):
- server = None
- if 'dev' in mozwebqa.base_url:
- server = 'https://login.dev.anosrep.org'
- elif 'beta' in mozwebqa.base_url:
- server = 'https://login.anosrep.org'
- else:
- server = 'https://login.persona.org'
- return server
-
- def test_can_change_user_password(self, mozwebqa):
- user = MockUser()
- home_pg = HomePage(mozwebqa)
-
- home_pg.go_to_home_page()
- bid_login = home_pg.click_sign_in()
- bid_login.sign_in_new_user(user['email'], user['password'])
-
- # Open restmail inbox, find the email
- inbox = RestmailInbox(user['email'])
- email = inbox.find_by_index(0)
-
- # Load the BrowserID link from the email in the browser
- from browserid.pages.complete_registration import CompleteRegistration
- CompleteRegistration(mozwebqa.selenium, mozwebqa.timeout, email.verify_user_link)
-
- mozwebqa.selenium.get(self._persona_server_url(mozwebqa))
- from browserid.pages.account_manager import AccountManager
- account_manager = AccountManager(mozwebqa.selenium, mozwebqa.timeout)
-
- Assert.contains(user['email'], account_manager.emails)
-
- account_manager.click_edit_password()
- account_manager.old_password = user['password']
- new_password = "newpass12345"
- account_manager.new_password = new_password
- account_manager.click_password_done()
-
- account_manager.click_sign_out()
- mozwebqa.selenium.execute_script('localStorage.clear()')
-
- home_pg.go_to_home_page()
-
- bid_login = home_pg.click_sign_in()
- bid_login.sign_in(user['email'], new_password)
-
- home_pg.wait_for_user_login()
- Assert.true(home_pg.is_logged_in)
@@ -1,22 +0,0 @@
-#!/usr/bin/env python
-
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-from pages.home import HomePage
-from unittestzero import Assert
-
-import pytest
-
-
-class TestLogout:
-
- @pytest.mark.nondestructive
- def test_that_user_can_logout(self, mozwebqa):
- home_pg = HomePage(mozwebqa)
- home_pg.go_to_home_page()
- home_pg.sign_in()
-
- home_pg.logout()
- Assert.false(home_pg.is_logged_in)
@@ -1,33 +0,0 @@
-#!/usr/bin/env python
-
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-from pages.home import HomePage
-from restmail.restmail import RestmailInbox
-from mocks.mock_user import MockUser
-from unittestzero import Assert
-
-import pytest
-
-
-class TestNewAccount:
-
- def test_can_create_new_user_account(self, mozwebqa):
- user = MockUser()
- home_pg = HomePage(mozwebqa)
-
- home_pg.go_to_home_page()
- bid_login = home_pg.click_sign_in()
- bid_login.sign_in_new_user(user['email'], user['password'])
-
- # Open restmail inbox, find the email
- inbox = RestmailInbox(user['email'])
- email = inbox.find_by_index(0)
-
- # Load the BrowserID link from the email in the browser
- from browserid.pages.complete_registration import CompleteRegistration
- complete_registration = CompleteRegistration(mozwebqa.selenium, mozwebqa.timeout, email.verify_user_link)
-
- Assert.equal(home_pg.logged_in_user_email, user['email'])
Oops, something went wrong.

0 comments on commit cec83da

Please sign in to comment.