Browse files

Updating to match the structure of other projects.

  • Loading branch information...
1 parent eeb17f8 commit 30e31a948c57f251f13805740e435b8dd5fa56dc @davehunt davehunt committed Feb 13, 2012
View
1 .gitignore
@@ -2,3 +2,4 @@
*.pyc
*.tmproj
*.komodoproject
+results*
View
4 README.md
@@ -39,11 +39,11 @@ Once this is all set up you will need to download and start a Selenium Grid inst
To run tests locally its a simple case of calling the command below from this directory
- py.test . --browser-name=<BROWSER_NAME> --browser-version=<BROWSER_VERSION> --platform=<PLATFORM>
+ py.test --browsername=<BROWSER_NAME> --browserver=<BROWSER_VERSION> --platform=<PLATFORM> tests
All parameters are required, and depend on the environments provided by your Selenium Grid instance. For example:
- py.test . --browser-name=FIREFOX --browser-version=4.0 --platform=MAC
+ py.test --browsername=FIREFOX --browserver=4.0 --platform=MAC tests
Writing Tests
-------------
View
0 pages/__init__.py
No changes.
View
4 base_page.py → pages/base.py
@@ -6,7 +6,6 @@
from selenium.webdriver.common.by import By
from page import Page
-import login_region
class BasePage(Page):
@@ -15,7 +14,8 @@ class BasePage(Page):
@property
def login_region(self):
- return login_region.LoginRegion(self.testsetup)
+ from regions.login import LoginRegion
+ return LoginRegion(self.testsetup)
@property
def page_title(self):
View
6 home_page.py → pages/home.py
@@ -3,12 +3,12 @@
# 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 base_page
+from base import BasePage
-class HomePage(base_page.BasePage):
+class HomePage(BasePage):
- _page_title = u"QMO \u2013 quality.mozilla.org | The home of Mozilla QA"
+ _page_title = u"QMO \u2013 quality.mozilla.org | The Home of Mozilla QA"
def go_to_home_page(self):
self.selenium.get(self.testsetup.base_url + "/")
View
0 pages/regions/__init__.py
No changes.
View
2 login_region.py → pages/regions/login.py
@@ -14,3 +14,5 @@ class LoginRegion(Page):
def click_sign_up(self):
self.selenium.find_element(*self._sign_up_link_locator).click()
+ from pages.registration import RegistrationPage
+ return RegistrationPage(self.testsetup)
View
4 registration_page.py → pages/registration.py
@@ -8,10 +8,10 @@
from selenium.webdriver.common.by import By
from unittestzero import Assert
-import base_page
+from base import BasePage
-class RegistrationPage(base_page.BasePage):
+class RegistrationPage(BasePage):
_page_title = u"Create an Account | QMO \u2013 quality.mozilla.org"
View
0 tests/__init__.py
No changes.
View
13 test_user_registration.py → tests/test_user_registration.py
@@ -7,27 +7,24 @@
from unittestzero import Assert
-import home_page
-import registration_page
+from pages.home import HomePage
class TestUserRegistration:
def test_new_user_can_register(self, mozwebqa):
- home_pg = home_page.HomePage(mozwebqa)
+ home_pg = HomePage(mozwebqa)
home_pg.go_to_home_page()
- home_pg.login_region.click_sign_up()
+ registration_pg = home_pg.login_region.click_sign_up()
- registration_pg = registration_page.RegistrationPage(mozwebqa)
registration_pg.register_new_user()
Assert.equal(registration_pg.page_title, "Sign Up Complete!")
def test_username_only_allows_lower_case_letters_and_numbers(self, mozwebqa):
- home_pg = home_page.HomePage(mozwebqa)
+ home_pg = HomePage(mozwebqa)
home_pg.go_to_home_page()
- home_pg.login_region.click_sign_up()
+ registration_pg = home_pg.login_region.click_sign_up()
- registration_pg = registration_page.RegistrationPage(mozwebqa)
invalid_characters = range(32, 47) + range(58, 96) + range(123, 127)
invalid_username = "automatedtest%s" % chr(random.choice(invalid_characters))
print "invalid_username : %s" % invalid_username

0 comments on commit 30e31a9

Please sign in to comment.