Docs page test #14

Merged
merged 4 commits into from Apr 20, 2012

Conversation

Projects
None yet
5 participants
Collaborator

rbillings commented Mar 15, 2012

I re-added the is_logout_visible code that was accidentally deleted in the previous changes.

@bebef1987 bebef1987 commented on an outdated diff Mar 19, 2012

@@ -27,4 +27,4 @@ def is_element_visible(self, locator):
try:
return self.selenium.find_element(*locator).is_displayed()
except:
- return False
+ return False
@bebef1987

bebef1987 Mar 19, 2012

Contributor

pep8 like a new line at the end of the file

@bebef1987 bebef1987 commented on an outdated diff Mar 19, 2012

pages/base.py
@@ -7,10 +7,13 @@
from page import Page
-
@bebef1987

bebef1987 Mar 19, 2012

Contributor

we should keep this line

@bebef1987 bebef1987 commented on an outdated diff Mar 19, 2012

tests/test_docs.py
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+from unittestzero import Assert
+
+from pages.docs import DocsPage
+
+from pages.home import HomePage
+
+class TestDocsPage:
+
+ def test_docs_title(self,mozwebqa):
+ home_page = HomePage(mozwebqa)
+ home_page.go_to_home_page()
+ docs_page = home_page.header_region.click_docs_link()
+ Assert.true(docs_page.is_the_current_page)
+
@bebef1987

bebef1987 Mar 19, 2012

Contributor

to many new lines here

@bebef1987 bebef1987 commented on the diff Mar 19, 2012

pages/docs.py
@@ -0,0 +1,18 @@
+ #!/usr/bin/env python
@bebef1987

bebef1987 Mar 19, 2012

Contributor

add a new line after this one in all files

@bebef1987 bebef1987 commented on an outdated diff Mar 19, 2012

pages/docs.py
+ # 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 base import BasePage
+
+class DocsPage(BasePage):
+
+ _page_title = u"Docs | QMO \u2013 quality.mozilla.org"
+
+ def go_to_docs_page(self):
+ self.selenium.get(self.testsetup.base_url + "/docs")
+ self.is_the_current_page
+
+ @property
+ def is_page_title_correct(self):
@bebef1987

bebef1987 Mar 19, 2012

Contributor

we have this implemented in https://github.com/mozilla/qmo-tests/blob/master/page.py#L19
it's safer use the method from page.py

Contributor

bebef1987 commented Mar 19, 2012

pulls #14 and #13 are very similar you should close one of them and update just one of them

davehunt referenced this pull request Mar 19, 2012

Closed

Add QMO Docs page test #13

@davehunt davehunt commented on an outdated diff Mar 19, 2012

pages/regions/header.py
@@ -0,0 +1,17 @@
+ #!/usr/bin/env python
+ # This Source Code Form is subject to the terms of the Mozilla Public
@davehunt

davehunt Mar 19, 2012

Member

Nit: Add a blank newline before the license block.

@davehunt davehunt commented on the diff Mar 19, 2012

pages/regions/header.py
@@ -0,0 +1,17 @@
+ #!/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 page import Page
+
+from selenium.webdriver.common.by import By
+
@davehunt

davehunt Mar 19, 2012

Member

PEP8: Two blank new lines after imports.

@davehunt davehunt commented on an outdated diff Mar 19, 2012

pages/regions/header.py
+ # 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 page import Page
+
+from selenium.webdriver.common.by import By
+
+class HeaderRegion(Page):
+
+ _docs_link_locator = (By.CSS_SELECTOR, '#nav-main li:nth-child(7) a')
+
+ def click_docs_link(self):
+ self.selenium.find_element(*self._docs_link_locator).click()
+ from pages.docs import DocsPage
+ return DocsPage(self.testsetup)
@davehunt

davehunt Mar 19, 2012

Member

PEP8: Add a new line to the end of the file.

@davehunt davehunt commented on an outdated diff Mar 19, 2012

tests/test_docs.py
@@ -0,0 +1,23 @@
+ #!/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 pages.docs import DocsPage
@davehunt

davehunt Mar 19, 2012

Member

We don't need to import DocsPage because it's imported in the HeaderRegion.

Member

davehunt commented Mar 19, 2012

Thanks for the pull request @rbillings. Let us know if you need any help with the suggested changes, which are all minor, and mostly style guide related.

bebef1987 referenced this pull request Mar 20, 2012

Closed

Docspagefix #15

Seeing the following PEP8 issues:
./page.py:30:25: W292 no newline at end of file
./pages/base.py:15:1: W293 blank line contains whitespace
./pages/base.py:33:1: W391 blank line at end of file
./pages/base.py:33:1: W293 blank line contains whitespace
./pages/docs.py:2:1: W293 blank line contains whitespace
./pages/docs.py:11:1: W293 blank line contains whitespace
./pages/docs.py:13:1: W293 blank line contains whitespace
./pages/docs.py:17:1: W391 blank line at end of file
./pages/docs.py:17:1: W293 blank line contains whitespace
./pages/regions/header.py:2:1: W293 blank line contains whitespace
./pages/regions/header.py:13:1: W293 blank line contains whitespace
./pages/regions/header.py:15:1: W293 blank line contains whitespace
./pages/regions/header.py:20:1: W391 blank line at end of file
./pages/regions/header.py:20:1: W293 blank line contains whitespace
./tests/test_docs.py:2:1: W293 blank line contains whitespace
./tests/test_docs.py:6:1: W293 blank line contains whitespace
./tests/test_docs.py:8:1: W293 blank line contains whitespace
./tests/test_docs.py:12:1: W293 blank line contains whitespace
./tests/test_docs.py:13:1: W293 blank line contains whitespace
./tests/test_docs.py:15:1: W293 blank line contains whitespace
./tests/test_docs.py:16:29: E231 missing whitespace after ','
./tests/test_docs.py:21:1: W293 blank line contains whitespace
./tests/test_docs.py:22:1: W293 blank line contains whitespace
./tests/test_docs.py:23:1: W293 blank line contains whitespace
./tests/test_docs.py:25:1: W391 blank line at end of file
./tests/test_docs.py:25:1: W293 blank line contains whitespace

Also, tests.test_login_logout.TestLoginLogout is failing for me when I run it but this looks like a bug on https://quality.mozilla.org/ where you are logged in but #user-state doesn't reflect this, the login area remains but if you click to another page, it is updated correctly. I've logged https://bugzilla.mozilla.org/show_bug.cgi?id=742230 for this issue.

But apart from the pep8 (& provided the failing test passes), LGTM :)

LGTM (bar the failing tests due to https://bugzilla.mozilla.org/show_bug.cgi?id=742230).
All pep8 issues seen before have been fixed.

Collaborator

rbillings commented Apr 19, 2012

OK, my tests don't involve logging in, so hopefully that isn't a blocker to getting this merged.

Contributor

AlinT commented Apr 20, 2012

Looks good to me!
Merging this in

@AlinT AlinT merged commit 3b185a8 into mozilla:master Apr 20, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment