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..a3c386c02 100644 --- a/tests/unit/test_rendering.py +++ b/tests/unit/test_rendering.py @@ -16,8 +16,12 @@ # 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 +SAFARI_UA = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.2 Safari/605.1.15' # 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 +73,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