Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updating project structure to resemble other projects structure.

  • Loading branch information...
commit 77e14cb73ad24bbec976be1c6d0d4901012daa7c 1 parent b567a9f
Glenn Howard authored
View
7 page.py
@@ -1,5 +1,4 @@
#!/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/.
@@ -14,18 +13,18 @@ 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, 10).until(lambda s: self.selenium.title)
+ WebDriverWait(self.selenium, self.timeout).until(lambda s: s.title)
Assert.equal(self.selenium.title, self._page_title)
return True
def is_element_visible(self, locator):
try:
- self.selenium.find_element(*locator)
- return True
+ return self.selenium.find_element(*locator).is_displayed()
except:
return False
View
1  pages/__init__.py
@@ -0,0 +1 @@
+
View
0  base_page.py → pages/base.py
File renamed without changes
View
4 home_page.py → pages/home_page.py
@@ -6,11 +6,11 @@
from selenium.webdriver.common.by import By
-import base_page
+import base
import view_source_page
-class HomePage(base_page.BasePage):
+class HomePage(base.BasePage):
_page_title = 'MozillaWiki'
View
4 log_in_or_create_account_page.py → pages/log_in_or_create_account_page.py
@@ -6,10 +6,10 @@
from selenium.webdriver.common.by import By
-import base_page
+import base
-class LogInOrCreateAccountPage(base_page.BasePage):
+class LogInOrCreateAccountPage(base.BasePage):
_page_title = 'Log in / create account - MozillaWiki'
View
4 log_out_page.py → pages/log_out_page.py
@@ -4,9 +4,9 @@
# 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
+import base
-class LogOutPage(base_page.BasePage):
+class LogOutPage(base.BasePage):
_page_title = 'Log out - MozillaWiki'
View
0  personal_tools_region.py → pages/personal_tools_region.py
File renamed without changes
View
4 view_source_page.py → pages/view_source_page.py
@@ -6,10 +6,10 @@
from selenium.webdriver.common.by import By
-import base_page
+import base
-class ViewSourcePage(base_page.BasePage):
+class ViewSourcePage(base.BasePage):
_page_title = 'View source - MozillaWiki'
View
1  test/__init__.py
@@ -0,0 +1 @@
+
View
10 test_log_in.py → test/test_log_in.py
@@ -7,19 +7,19 @@
import pytest
from unittestzero import Assert
-import home_page
-import log_in_or_create_account_page
+from pages.home_page import HomePage
+import pages.log_in_or_create_account_page
class TestLogIn:
@pytest.mark.nondestructive
def test_valid_user_can_log_in(self, mozwebqa):
- home_pg = home_page.HomePage(mozwebqa)
+ home_pg = HomePage(mozwebqa)
home_pg.go_to_home_page()
home_pg.personal_tools_region.click_log_in_or_create_account()
-
- log_in_or_create_account_pg = log_in_or_create_account_page.LogInOrCreateAccountPage(mozwebqa)
+
+ log_in_or_create_account_pg = pages.log_in_or_create_account_page.LogInOrCreateAccountPage(mozwebqa)
log_in_or_create_account_pg.log_in()
Assert.true(home_pg.is_the_current_page)
Assert.false(home_pg.personal_tools_region.is_log_in_or_create_account_visible)
View
12 test_log_out.py → test/test_log_out.py
@@ -7,23 +7,23 @@
import pytest
from unittestzero import Assert
-import home_page
-import log_in_or_create_account_page
-import log_out_page
+from pages.home_page import HomePage
+from pages.log_in_or_create_account_page import LogInOrCreateAccountPage
+import pages.log_out_page
class TestLogIn:
@pytest.mark.nondestructive
def test_valid_user_can_log_out(self, mozwebqa):
- home_pg = home_page.HomePage(mozwebqa)
+ home_pg = HomePage(mozwebqa)
home_pg.go_to_home_page()
home_pg.personal_tools_region.click_log_in_or_create_account()
- log_in_or_create_account_pg = log_in_or_create_account_page.LogInOrCreateAccountPage(mozwebqa)
+ log_in_or_create_account_pg = pages.log_in_or_create_account_page.LogInOrCreateAccountPage(mozwebqa)
log_in_or_create_account_pg.log_in()
- log_out_pg = log_out_page.LogOutPage(mozwebqa)
+ log_out_pg = pages.log_out_page.LogOutPage(mozwebqa)
home_pg.personal_tools_region.click_log_out()
Assert.true(log_out_pg.is_the_current_page)
Assert.true(log_out_pg.personal_tools_region.is_log_in_or_create_account_visible)
View
4 test_view_source.py → test/test_view_source.py
@@ -7,14 +7,14 @@
import pytest
from unittestzero import Assert
-import home_page
+from pages.home_page import HomePage
class TestViewSource:
@pytest.mark.nondestructive
def test_visitor_can_view_source(self, mozwebqa):
- home_pg = home_page.HomePage(mozwebqa)
+ home_pg = HomePage(mozwebqa)
home_pg.go_to_home_page()
view_source_pg = home_pg.click_view_source()
Please sign in to comment.
Something went wrong with that request. Please try again.