adini121 / mcom-tests

Tests for Mozilla's website.
https://www.mozilla.org/
0 stars 0 forks source link

Investigate fixing/changing the static homepage-link tests (test_major_link_destinations_are_correct) #2

Open adini121 opened 8 years ago

adini121 commented 8 years ago

From @stephendonner on January 7, 2015 17:26

Let's re-evaluate the static homepage-link tests, which it looks like (due to frequent changes) we'd have to update often, like to address this recent failure:

09:13:05 =================================== FAILURES =================================== 09:13:05 ____ TestHomePage.test_major_link_destinations_arecorrect ____ 09:13:05 [gw1] darwin -- Python 2.7.5 /Users/Shared/Jenkins/Home/jobs/mozilla.com.dev.saucelabs/workspace/.env/bin/python 09:13:05 self = <tests.test_home.TestHomePage instance at 0x102fce368> 09:13:05 mozwebqa = <pytest_mozwebqa.pytest_mozwebqa.TestSetup instance at 0x102fc3320> 09:13:05 09:13:05 @pytest.mark.nondestructive 09:13:05 def test_major_link_destinations_are_correct(self, mozwebqa): 09:13:05 home_page = HomePage(mozwebqa) 09:13:05 home_page.go_to_page() 09:13:05 bad_links = [] 09:13:05 for link in home_page.major_links_list: 09:13:05 url = home_page.link_destination(link.get('locator')) 09:13:05 if not url.endswith(link.get('url_suffix')): 09:13:05 bad_links.append('%s does not end with %s' % (url, link.get('url_suffix'))) 09:13:05 > Assert.equal(0, len(bad_links), '%s bad links found: ' % len(bad_links) + ', '.join(bad_links)) 09:13:05 09:13:05 tests/testhome.py:36: 09:13:05 _ 09:13:05 09:13:05 self = <class 'unittestzero.Assert'>, first = 0, second = 2 09:13:05 msg = u'2 bad links found: https://webmaker.org/ does not end with //sendto.mozilla....rg_largeblock, https://webmaker.org/appmaker does not end with //webmaker.org/' 09:13:05 09:13:05 @classmethod 09:13:05 def equal(self, first, second, msg=None): 09:13:05 """ 09:13:05 Asserts that 2 elements are the same 09:13:05
09:13:05 :Args: 09:13:05 - First object to be tested 09:13:05 - Second object to be tested 09:13:05 - Message that will be printed if it fails 09:13:05 """ 09:13:05 > assert first == second, msg 09:13:05 E AssertionError: 2 bad links found: https://webmaker.org/ does not end with //sendto.mozilla.org/page/contribute/givenow-seq?preset=2&source=mozillaorg_largeblock&ref=EOYFR2014&utm_campaign=EOYFR2014&utm_source=mozilla.org&utm_medium=referral&utm_content=mozillaorg_largeblock, https://webmaker.org/appmaker does not end with //webmaker.org/ 09:13:05 09:13:05 .env/lib/python2.7/site-packages/unittestzero.py:55: AssertionError 09:13:05 ------------------------------- pytest-mozwebqa -------------------------------- 09:13:05 Failing URL: https://www-dev.allizom.org/en-US/

Page object: https://github.com/mozilla/mcom-tests/blob/master/pages/desktop/home.py#L18 Test: https://github.com/mozilla/mcom-tests/blob/master/tests/test_home.py#L28

Copied from original issue: mozilla/mcom-tests#373

adini121 commented 8 years ago

From @stephendonner on January 7, 2015 17:28

FWIW, the changes that caused this test to need updating were https://github.com/mozilla/bedrock/commit/2001f5b25a632a857d26546f110629d4e361c3de