Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Added Events page test #19

Merged
merged 4 commits into from almost 2 years ago

4 participants

Rebecca Billings Trif Andrei-Alin Leah Klearman Zac
Rebecca Billings
Collaborator

No description provided.

pages/events.py
((4 lines not shown))
  4
+# License, v. 2.0. If a copy of the MPL was not distributed with this
  5
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
  6
+
  7
+from base import BasePage
  8
+
  9
+
  10
+class EventsPage(BasePage):
  11
+
  12
+    _page_title = u'Events | QMO \u2013 quality.mozilla.org'
  13
+
  14
+    def go_to_events_page(self):
  15
+        self.selenium.get(self.testsetup.base_url + '/events')
  16
+        self.is_the_current_page
  17
+
  18
+    @property
  19
+    def is_page_title_correct(self):
4
Zac Collaborator
zacc added a note May 08, 2012

Did you mean to add an assertion for this in the test?

Rebecca Billings Collaborator
rbillings added a note May 08, 2012

Yes, that assertion was also in the docs.py and media.py and I was making them match. If it needs to be removed then I'll remove it from all three.

Zac Collaborator
zacc added a note May 09, 2012

OK. this method is exactly the same as: https://github.com/mozilla/qmo-tests/blob/master/page.py#L20 so it's duplicated code.

We have that one in page.py so we can access it anywhere.

Zac Collaborator
zacc added a note May 09, 2012

PS don't worry about removing it from the other pages just yet. It should be done in a separate pull to keep the pressure off this pull. Or better, pop it in the pivotal as a refactoring task and someone can pick it up and do it :)

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

If someone could check this I would appreciate it.

pages/regions/header.py
((5 lines not shown))
13 14
     _media_link_locator = (By.CSS_SELECTOR, '#nav-main li:nth-child(5) a')
14 15
     _docs_link_locator = (By.CSS_SELECTOR, '#nav-main li:nth-child(6) a')
15 16
 
  17
+    def click_events_link(self):
  18
+        self.selenium.find_element(*self._events_link_locator).click()
  19
+        from pages.events import EventsPage
  20
+        return EventsPage(self.testsetup)
  21
+        
1
Trif Andrei-Alin Collaborator
AlinT added a note May 30, 2012

blank line contains whitespace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
tests/test_events.py
... ...
@@ -0,0 +1,19 @@
  1
+#!/usr/bin/env python
  2
+
  3
+# This Source Code Form is subject to the terms of the Mozilla Public
  4
+# License, v. 2.0. If a copy of the MPL was not distributed with this
  5
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
  6
+
  7
+from unittestzero import Assert
  8
+
  9
+from pages.events import MediaPage
1
Trif Andrei-Alin Collaborator
AlinT added a note May 30, 2012

You should import EventsPage, instead of MediaPage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Trif Andrei-Alin
Collaborator
AlinT commented May 30, 2012

In pages/regions/header there are several white spaces before each of # of the MPL2 licence.This is also happening in several other pages.
If you can please remove them, if not leave them be and will make a future pull with this refactoring task.

Trif Andrei-Alin AlinT commented on the diff May 30, 2012
tests/test_events.py
... ...
@@ -0,0 +1,19 @@
  1
+#!/usr/bin/env python
  2
+
  3
+# This Source Code Form is subject to the terms of the Mozilla Public
  4
+# License, v. 2.0. If a copy of the MPL was not distributed with this
  5
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
  6
+
  7
+from unittestzero import Assert
  8
+
  9
+from pages.events import MediaPage
  10
+from pages.home import HomePage
  11
+
  12
+
  13
+class TestEventsPage:
  14
+
2
Trif Andrei-Alin Collaborator
AlinT added a note May 30, 2012

You need to add the nondestructive mark for this test:
@pytest.mark.nondestructive
I've seen this mark is not used in other tests, is this intended or why is that?

Rebecca Billings Collaborator
rbillings added a note May 30, 2012

AlinT: They weren't added because the tests were written prior to the introduction of the nondestructive marks- I'll fix that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Trif Andrei-Alin
Collaborator
AlinT commented May 31, 2012

This is a "by the book" pull!:)
Lgtm!

Leah Klearman
Collaborator
klrmn commented June 01, 2012

LGTM

Leah Klearman klrmn merged commit 3bad4d0 into from June 01, 2012
Leah Klearman klrmn closed this June 01, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
16  pages/events.py
... ...
@@ -0,0 +1,16 @@
  1
+#!/usr/bin/env python
  2
+
  3
+# This Source Code Form is subject to the terms of the Mozilla Public
  4
+# License, v. 2.0. If a copy of the MPL was not distributed with this
  5
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
  6
+
  7
+from base import BasePage
  8
+
  9
+
  10
+class EventsPage(BasePage):
  11
+
  12
+    _page_title = u'Events | QMO \u2013 quality.mozilla.org'
  13
+
  14
+    def go_to_events_page(self):
  15
+        self.selenium.get(self.testsetup.base_url + '/events')
  16
+        self.is_the_current_page
6  pages/regions/header.py
@@ -10,9 +10,15 @@
10 10
 
11 11
 
12 12
 class HeaderRegion(Page):
  13
+    _events_link_locator = (By.CSS_SELECTOR, '#nav-main li:nth-child(4) a')
13 14
     _media_link_locator = (By.CSS_SELECTOR, '#nav-main li:nth-child(5) a')
14 15
     _docs_link_locator = (By.CSS_SELECTOR, '#nav-main li:nth-child(6) a')
15 16
 
  17
+    def click_events_link(self):
  18
+        self.selenium.find_element(*self._events_link_locator).click()
  19
+        from pages.events import EventsPage
  20
+        return EventsPage(self.testsetup)
  21
+
16 22
     def click_media_link(self):
17 23
         self.selenium.find_element(*self._media_link_locator).click()
18 24
         from pages.media import MediaPage
21  tests/test_events.py
... ...
@@ -0,0 +1,21 @@
  1
+#!/usr/bin/env python
  2
+
  3
+# This Source Code Form is subject to the terms of the Mozilla Public
  4
+# License, v. 2.0. If a copy of the MPL was not distributed with this
  5
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
  6
+
  7
+import pytest
  8
+from unittestzero import Assert
  9
+
  10
+from pages.events import EventsPage
  11
+from pages.home import HomePage
  12
+
  13
+
  14
+class TestEventsPage:
  15
+
  16
+    @pytest.mark.nondestructive
  17
+    def test_events_title(self, mozwebqa):
  18
+        home_page = HomePage(mozwebqa)
  19
+        home_page.go_to_home_page()
  20
+        events_page = home_page.header_region.click_events_link()
  21
+        Assert.true(events_page.is_the_current_page)
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.