Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Check languages links #118

wants to merge 4 commits into


None yet
4 participants

trumans commented Sep 30, 2012

For issue #98

The test checks all 250+ download links on the page and generates a collective message for all links that fail the 302 check. My decision to not to parameterize is based on:
a) checking a single link is a very very short task relative to overall test setup & execution,
b) the large number of links checked,
c) if there were massive number of failures it might more helpful if they were gathered in one test failure instead generating a massive number of failures.

When links fail the 302 the assertion error will look something like:
Expected status code 302. Lang 'ar' Windows link: status 200. Lang 'ar' OSX link: status 200. Lang 'ar' Linux link: status 200.

The test includes disabled code to demonstrate getting links for an single language. Tests don't normally include commented code that, but I wasn't sure how best to "document" the method without writing another test.


zacc commented Oct 1, 2012

Hey Truamn, I negative tested this by adding download.mozilla.org to my hosts file (Windows) and then running the test.
Then every HEAD requests should have failed however the test passed. I haven't been able to debug it any further sorry. I will hvae to comeback to it.

PS I am OK with the comments especially on an unusual pull like this.


stephendonner commented Oct 10, 2012

@zacc @trumans any update on this?


zacc commented Oct 10, 2012

I think we should introduce the pull #115 style of soft assertion that @bobsilverberg developed into this pull.

trumans commented Oct 10, 2012

Ok. Will update.

On Wednesday, October 10, 2012, zacc wrote:

I think we should introduce the pull #115https://github.com/mozilla/mcom-tests/issues/115style of soft assertion that
@bobsilverberg https://github.com/bobsilverberg developed into this

Reply to this email directly or view it on GitHubhttps://github.com/mozilla/mcom-tests/pull/118#issuecomment-9295541.

trumans commented Oct 17, 2012

apologies for taking so long to update.

I'm not a complete stickler on this, but the precedent for this was bad_links -- easy enough / agreed to make that change?


trumans replied Oct 17, 2012


@retornam retornam commented on the diff Oct 17, 2012

+ def go_to_page(self):
+ self.open('/firefox/all.html')
+ class Language():
+ ''' data values for a language '''
+ def __init__(self, language_element):
+ self.id = language_element.get_attribute('id')
+ self.windows_url = language_element.find_element(
+ *Localizations._windows_link_locator).get_attribute('href')
+ self.osx_url = language_element.find_element(
+ *Localizations._osx_link_locator).get_attribute('href')
+ self.linux_url = language_element.find_element(
+ *Localizations._linux_link_locator).get_attribute('href')
+ def _get_language_table(self, table_locator):

retornam Oct 17, 2012


please remove the underscore before get

@retornam retornam commented on the diff Oct 17, 2012

+# 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 pages.desktop.base import Base
+class Localizations(Base):
+ # element containing languages
+ _released_languages_locator = (By.CSS_SELECTOR, '#languages table.downloads')
+ _beta_languages_locator = (By.CSS_SELECTOR, '#beta_versions table.downloads')
+ # element containing a language
+ _language_locator = (By.CSS_SELECTOR, 'tbody tr')
+ # element for a specific language based on id attribute
+ def _language_by_id_locator(self, language_id):

retornam Oct 17, 2012


please remove underscore before language

@retornam retornam commented on the diff Oct 17, 2012

+ ''' get languages from 'table_locator' table '''
+ languages = []
+ table = self.selenium.find_element(*table_locator)
+ for language in table.find_elements(*self._language_locator):
+ languages.append(self.Language(language))
+ return languages
+ @property
+ def released_languages(self):
+ return self._get_language_table(self._released_languages_locator)
+ @property
+ def beta_languages(self):
+ return self._get_language_table(self._beta_languages_locator)
+ def language_by_id(self, language_id):

retornam Oct 17, 2012


I dont see this used anywhere so you can remove it


retornam commented Oct 17, 2012

I wrote a smaller version of this in my locale branch, retornam/mcom-tests@6a50e60

I removed the need for the languages class and replaced it with a dictionary you can test to see links by adding print response. url after line #28 in test_localizations.py and running

py.test -v -s --driver=firefox tests/test_localization.py --baseurl=https://www.allizom.org

@trumans trumans referenced this pull request Oct 20, 2012


Check lang links #133


stephendonner commented Oct 24, 2012

Closing this per #133 (comment)

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