Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Bug 1405076, firefox landing page layout and content updates #5195

Merged
merged 1 commit into from Oct 13, 2017
Merged

Fix Bug 1405076, firefox landing page layout and content updates #5195

merged 1 commit into from Oct 13, 2017

Conversation

schalkneethling
Copy link

Description

Updates the /firefox page to mirror the current /firefox/quantum with additional copy updates.

Issue / Bugzilla link

https://bugzilla.mozilla.org/show_bug.cgi?id=1405076

Testing

Ensure that is switch is not enabled the current content hub version of the page is shown.

Copy link
Member

@alexgibson alexgibson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few nits aside but this is looking great 👍

My biggest question on the page is that we're missing the Firefox sub-navigation?

screenshot-2017-10-12 2x faster and 30 less memory firefox browser

I'm guessing this might be intentional from the design, but it seems like we're cutting off a vital piece of navigation to other pages/products. I would flag it as a questionable choice?

Final thing is, this change is bound to break some integration tests. I would push this branch to run-integration-tests to see what fails, and then remove the tests for the current /firefox page. It's a shame to lose coverage, but until bug 1402424 has a solution, we can't add tests for the new page until the switch is enabled.

<h1>{{ _('<strong>Firefox</strong> Quantum') }}</h1>
<h2>{{ _('New. Fast. For good.') }}</h2>
<div class="cta-wrapper">
{{ download_firefox(alt_copy=_('Download Now'), dom_id='firefox-desktop-page', download_location='firefox-header') }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be download_location='primary cta'

<div class="content">
<div class="secondary-download-cta-content">
<h2>{{ _('Start browsing with <strong>Firefox</strong> Quantum') }}</h2>
{{ download_firefox(alt_copy=_('Download Now'), dom_id='firefox-desktop-page', download_location='firefox-secondary') }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be download_location='other'

blog_slugs = 'firefox'
blog_tags = ['home']
template_name = 'firefox/hub/home.html'
if switch('firefox-57-release'):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to have some unit tests that ensure the correct template is loaded for both states of the switch

font-weight: normal;
}

a.download-link.button.button-green {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than overriding styles, it would be nice here to make a new button style and @import it into the stylesheet. Similar to what we've done here. Give it a button name like quantum. This will make it easier for us to consolidate styles between pages in the future.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, the reason I did the override is because I am using the download_firefox helper. Now, although you cannot specify a custom class, I see there is a parameter called button_color with a default value of button-green so, I guess I can use that as a way to specify a custom class, say

{{ download_firefox(alt_copy=_('Download Now'), dom_id='firefox-desktop-page', download_location='other', button_color='quantum-download') }}

@schalkneethling
Copy link
Author

schalkneethling commented Oct 12, 2017

My biggest question on the page is that we're missing the Firefox sub-navigation?

@alexgibson That is my bad, I completely forgot that you have to explicitly import it to the page. Will fix that.

@@ -754,6 +754,22 @@ def test_get_context_data_one_star(self):
self.assertFalse('donate_stars_url' in ctx)


class TestFirefoxHubView(TestCase):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This passes for me locally:

@override_settings(DEV=False)
@patch('bedrock.firefox.views.l10n_utils.render')
class TestFirefoxFeatures(TestCase):
    @patch.object(views, 'lang_file_is_active', lambda *x: True)
    @patch('bedrock.firefox.views.switch', Mock(return_value=True))
    def test_new_firefox_page_loads_with_active_switch(self, render_mock):
        view = views.FirefoxHubView()
        view.request = RequestFactory().get('/firefox/')
        view.request.locale = 'en-US'
        eq_(view.get_template_names(), ['firefox/firefox-quantum.html'])

    @patch.object(views, 'lang_file_is_active', lambda *x: False)
    @patch('bedrock.firefox.views.switch', Mock(return_value=False))
    def test_firefox_hub_page_loads_with_inactive_switch(self, render_mock):
        view = views.FirefoxHubView()
        view.request = RequestFactory().get('/firefox/')
        view.request.locale = 'fr'
        eq_(view.get_template_names(), ['firefox/hub/home.html'])

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, actually - you could probably split this test out further so the switch is tested independently of the locale activation

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh so you mean test that if one of the two is not True then the current page should show. Will do.

<div class="content">
<div class="secondary-download-cta-content">
<h2>{{ _('Start browsing with <strong>Firefox</strong> Quantum') }}</h2>
{{ download_firefox(alt_copy=_('Download Now'), dom_id='firefox-desktop-page', download_location='other', button_color='quantum-download') }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a duplicate ID: dom_id='firefox-desktop-page' - it should be different to the one in the primary cta section at the top of the page

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh!

@alexgibson
Copy link
Member

Download now is not aligned vertically

screen shot 2017-10-12 at 15 47 03

@alexgibson
Copy link
Member

Is this heading a little large maybe? Alternatively, could you shrink the width so "Firefox Quantum" is on the second line together?

screen shot 2017-10-12 at 15 47 40

@schalkneethling
Copy link
Author

Is this heading a little large maybe? Alternatively, could you shrink the width so "Firefox Quantum" is on the second line together?

Agree

@schalkneethling
Copy link
Author

Download now is not aligned vertically

I made the "Firefox Privacy Notice" a smaller font size to match the page you pointed out the other day that also uses the same button style.

@alexgibson
Copy link
Member

I made the "Firefox Privacy Notice" a smaller font size to match the page you pointed out the other day that also uses the same button style.

I don't see the same issue here: https://www-demo3.allizom.org/en-US/firefox/new/

@schalkneethling
Copy link
Author

I don't see the same issue here: www-demo3.allizom.org/en-US/firefox/new

@alexgibson I believe the last update solved the problem. Apologies, my mind is all over the place today...

@peiying2
Copy link
Contributor

@schalkneethling could you post test URL here please?

@@ -71,6 +77,9 @@ def test_newsletter_successful_sign_up(page_class, base_url, selenium):
assert page.newsletter.sign_up_successful


# /firefox Quantum page behind switch, unskip when the switch is removed
@pytest.mark.skipif(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here:

@pytest.mark.parametrize('page_class', [
    HomePage,
    ContributePage,
    pytest.mark.skipif(HomePage, reason='https://bugzilla.mozilla.org/show_bug.cgi?id=1293779')])

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guessing the above should be:

pytest.mark.skipif(FirefoxHomePage, reason='https://bugzilla.mozilla.org/show_bug.cgi?id=1405076')])

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, my bad - thanks!

@@ -58,6 +61,9 @@ def test_newsletter_default_values(page_class, url_kwargs, base_url, selenium):
assert page.newsletter.is_privacy_policy_link_displayed


# /firefox Quantum page behind switch, unskip when the switch is removed
@pytest.mark.skipif(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of skipping all the tests, skip just the failing one:

@pytest.mark.parametrize('page_class', [
    HomePage,
    ContributePage,
    pytest.mark.skipif(HomePage, reason='https://bugzilla.mozilla.org/show_bug.cgi?id=1293779')])

@@ -24,6 +24,9 @@
from pages.smarton.base import SmartOnBasePage


# /firefox Quantum page behind switch, unskip when the switch is removed
@pytest.mark.skipif(
reason='https://bugzilla.mozilla.org/show_bug.cgi?id=1405076')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use this to skip only the failing test:

pytest.mark.skipif((FirefoxHomePage, None), reason='https://bugzilla.mozilla.org/show_bug.cgi?id=1405076')

@@ -7,6 +7,9 @@
from pages.firefox.home import FirefoxHomePage


# /firefox Quantum page behind switch, unskip when the switch is removed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we really need the comments here, as we have the reason referencing the bug.

Copy link
Member

@alexgibson alexgibson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of minor nits for consistency, but otherwise this looks great! r+wc 🍰


.download-title {
color: #0040ab;
@include font-size(14px);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: try and and avoid using arbitraty font sizes. Suggest @include font-size-small; here?

}

.fx-privacy-link a {
@include font-size(14px);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest @include font-size-extra-small; here? Could this also be moved to _buttons.scss?

.download-title {
color: #0040ab;
@include font-size(14px);
font-weight: 700;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not just to use font-weight: bold;?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, I was using the same code as from the reference page that uses the same button style but, bold would work just as well.

@schalkneethling
Copy link
Author

Thanks for the detailed review @alexgibson - updated.

locale = l10n_utils.get_locale(self.request)

if switch('firefox-57-release') and lang_file_is_active(
'firefox/firefox-quantum.lang', locale):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appologies I missed this before, it should be firefox/firefox-quantum? (no .lang)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants