diff --git a/config/requirements.txt b/config/requirements.txt index 6f02f0ee6..e1f9bd725 100644 --- a/config/requirements.txt +++ b/config/requirements.txt @@ -9,5 +9,5 @@ nose==1.3.7 pep8==1.7.0 Pillow==4.0.0 requests==2.13.0 -ua-parser==0.7.2 +ua-parser==0.8 WTForms==2.1 diff --git a/tests/functional/index-non-auth.js b/tests/functional/index-non-auth.js index 74a451e5d..a9bd34619 100755 --- a/tests/functional/index-non-auth.js +++ b/tests/functional/index-non-auth.js @@ -26,16 +26,6 @@ registerSuite("Index", { .end(); }, - "reporter addon link is shown"() { - return FunctionalHelpers.openPage(this, url("/"), ".js-hero-title") - .findByCssSelector(".js-addon-link") - .getVisibleText() - .then(function(text) { - assert.include(text, "Download"); - }) - .end(); - }, - "form toggles open then closed"() { return ( FunctionalHelpers.openPage(this, url("/"), ".js-hero-title") diff --git a/tests/unit/test_rendering.py b/tests/unit/test_rendering.py index 2ac187e83..f11ae1a45 100644 --- a/tests/unit/test_rendering.py +++ b/tests/unit/test_rendering.py @@ -16,8 +16,11 @@ # Any request that depends on parsing HTTP Headers (basically anything # on the index route, will need to include the following: environ_base=headers -headers = {'HTTP_USER_AGENT': ('Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; ' - 'rv:31.0) Gecko/20100101 Firefox/31.0')} +CHROME_UA = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3425.0 Safari/537.36' # noqa +FIREFOX_UA = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:61.0) Gecko/20100101 Firefox/61.0' # noqa +FIREFOX_AND_UA = 'Mozilla/5.0 (Android; Mobile; rv:61.0) Gecko/61.0 Firefox/61.0' # noqa +OPERA_UA = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.52 Safari/537.36 OPR/15.0.1147.100' # noqa +headers = {'HTTP_USER_AGENT': FIREFOX_UA} class TestURIContent(unittest.TestCase): @@ -69,5 +72,46 @@ def test_user_title_pages(self): rv = self.app.get('/activity/testuser') self.assertTrue(title in rv.data) + def test_addon_link(self): + """An addon link should be in the top navigation bar. + + This depends on the user agent string. + """ + + # testing Firefox addon + headers = {'HTTP_USER_AGENT': FIREFOX_UA} + rv = self.app.get('/', environ_base=headers) + expected = 'Download Firefox Add-on' + expected2 = 'Firefox addons' + self.assertTrue(expected in rv.data) + self.assertTrue(expected2 in rv.data) + # testing for Firefox Androidpe + headers = {'HTTP_USER_AGENT': FIREFOX_AND_UA} + rv = self.app.get('/', environ_base=headers) + expected = 'Download Firefox Add-on' + expected2 = 'Firefox for Android addons' # noqa + self.assertTrue(expected in rv.data) + self.assertTrue(expected2 in rv.data) + # testing for Chrome + headers = {'HTTP_USER_AGENT': CHROME_UA} + rv = self.app.get('/', environ_base=headers) + expected = 'Download Chrome Add-on' + expected2 = 'Chrome webstore' + self.assertTrue(expected in rv.data) + self.assertTrue(expected2 in rv.data) + # testing for Opera + headers = {'HTTP_USER_AGENT': OPERA_UA} + rv = self.app.get('/', environ_base=headers) + expected = 'Download Opera Add-on' + expected2 = 'Opera Extension' + self.assertTrue(expected in rv.data) + self.assertTrue(expected2 in rv.data) + # testing for unknown browser + headers = {'HTTP_USER_AGENT': 'Punk Cat Space'} + rv = self.app.get('/', environ_base=headers) + expected = 'Give Feedback' + self.assertTrue(expected in rv.data) + + if __name__ == '__main__': unittest.main() diff --git a/webcompat/templates/nav/addon-links.html b/webcompat/templates/nav/addon-links.html index cd31a3970..ba609115c 100644 --- a/webcompat/templates/nav/addon-links.html +++ b/webcompat/templates/nav/addon-links.html @@ -15,8 +15,8 @@ - Firefox for Android addons - Firefox for Android addons + Firefox for Android addons + Firefox for Android addons Download Firefox Add-on @@ -38,7 +38,7 @@ title="Navigate to opera addons"> Opera Extension - Opera Extension + Opera Extension Download Opera Add-on