Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding bedrock, skipsprod markers and tests for partner page

  • Loading branch information...
commit f2f15e8f4118d33a5176e65adc4348e879c6150a 1 parent 5da9b36
@retornam retornam authored
Showing with 107 additions and 8 deletions.
  1. +18 −8 conftest.py
  2. +47 −0 pages/desktop/partners.py
  3. +42 −0 tests/test_partners.py
View
26 conftest.py
@@ -3,21 +3,31 @@
def pytest_addoption(parser):
parser.addoption(
- '--nonbedrock',
+ '--bedrock',
action='store',
- dest='nonbedrock',
- metavar='nonbedrock',
- help='marks tests so they do not use Bedrock branch')
+ dest='bedrock',
+ metavar='bedrock',
+ help='marks tests so they use Bedrock branch')
+ parser.addoption(
+ '--skipsprod',
+ action='store',
+ dest='skipsprod',
+ metavar='skip',
+ help='marks tests as staging only and skips them on production')
def pytest_configure(config):
config.addinivalue_line(
'markers',
- 'nonbedrock: marks tests so they do not use Bedrock branch')
+ 'bedrock: marks tests so they use Bedrock branch')
def pytest_runtest_setup(item):
- if 'nonbedrock' in item.keywords:
- item.config.option.base_url = item.config.option.base_url.replace('/b', '')
+ if hasattr(item.obj, 'bedrock') and \
+ '/b' not in item.config.option.base_url:
+ item.config.option.base_url = item.config.option.base_url + '/b'
else:
- pass
+ item.config.option.base_url = item.config.option.base_url.replace('/b', '')
+ if hasattr(item.obj, 'skipsprod') \
+ and 'allizom.org' not in item.config.option.base_url:
+ pytest.skip("skipping tests marked staging only")
View
47 pages/desktop/partners.py
@@ -0,0 +1,47 @@
+#!/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.common.action_chains import ActionChains
+from pages.desktop.base import Base
+
+
+class Partners(Base):
+
+ def go_to_page(self):
+ self.open('/apps/partners/')
+
+ _marketplace_header_locator = (By.CSS_SELECTOR, '#masthead > h2 > a > img')
+ _apps_platform_billboard = (By.CSS_SELECTOR, '.billboard.menu-bar > ul > li:nth-of-type(1) >a')
+ _marketplace_billboard = (By.CSS_SELECTOR, '.billboard.menu-bar > ul > li:nth-of-type(2) >a')
+ _submit_apps_button = (By.CSS_SELECTOR, '.billboard.menu-bar > ul > li:nth-of-type(3) >a')
+ _mdn_apps_link = (By.CSS_SELECTOR, '#mdn-link > a')
+ _opening_soon_image = (By.CSS_SELECTOR, '#soon')
+ _test_apps_image = (By.CSS_SELECTOR, '#test')
+ _build_fanbase_image = (By.CSS_SELECTOR, '#build')
+ _target_consumers_image = (By.CSS_SELECTOR, '#target')
+
+ @property
+ def are_billboards_visible(self):
+ return self.is_element_visible(*self._marketplace_header_locator) and \
+ self.is_element_visible(*self._apps_platform_billboard)
+
+ @property
+ def is_opening_soon_image_visible(self):
+ return self.is_element_visible(*self._opening_soon_image)
+
+ @property
+ def are_pointer_images_visible(self):
+ return self.is_element_visible(*self._test_apps_image) and \
+ self.is_element_visible(*self._build_fanbase_image) and \
+ self.is_element_visible(*self._target_consumers_image)
+
+ @property
+ def click_submit_apps_button(self):
+ element = self.selenium.find_element(*self._submit_apps_button)
+ ActionChains(self.selenium).\
+ move_to_element(element).\
+ click().perform()
+ return self.url_current_page
View
42 tests/test_partners.py
@@ -0,0 +1,42 @@
+#!/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 pytest
+from pages.desktop.partners import Partners
+from unittestzero import Assert
+
+
+@pytest.mark.skipsprod
+class TestPartners:
+
+ @pytest.mark.nondestructive
+ @pytest.mark.bedrock
+ def test_footer_section(self, mozwebqa):
+ partners_page = Partners(mozwebqa)
+ partners_page.go_to_page()
+ Assert.true(partners_page.footer.are_footer_links_visible)
+
+ @pytest.mark.nondestructive
+ def test_header_section(self, mozwebqa):
+ partners_page = Partners(mozwebqa)
+ partners_page.go_to_page()
+ Assert.true(partners_page.header.is_tabzilla_panel_visible)
+ partners_page.header.toggle_tabzilla_dropdown()
+ Assert.true(partners_page.header.are_tabzilla_links_visible)
+
+ @pytest.mark.nondestructive
+ def test_partner_billboard_links(self, mozwebqa):
+ partners_page = Partners(mozwebqa)
+ partners_page.go_to_page()
+ Assert.true(partners_page.are_billboards_visible)
+ Assert.true(partners_page.is_opening_soon_image_visible)
+
+ @pytest.mark.nondestructive
+ def test_submit_app_button(self, mozwebqa):
+ partners_page = Partners(mozwebqa)
+ partners_page.go_to_page()
+ Assert.equal('https://marketplace.mozilla.org/en-US/login?to=/en-US/developers/',
+ partners_page.click_submit_apps_button)
Please sign in to comment.
Something went wrong with that request. Please try again.