# 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/.

import pytest

from pages.home import HomePage


@pytest.mark.skip_if_firefox(reason="Download button is displayed only to non-Firefox users")
@pytest.mark.sanity
@pytest.mark.smoke
@pytest.mark.nondestructive
@pytest.mark.parametrize("locale", ["en-US", "de", "fr"])
def test_download_button_is_displayed(locale, base_url, selenium):
    page = HomePage(selenium, base_url, locale=locale).open()
    assert page.is_primary_download_button_displayed
    assert page.is_secondary_download_button_displayed


@pytest.mark.skip_if_not_firefox(reason="Firefox Accounts CTA is displayed only to Firefox users")
@pytest.mark.nondestructive
@pytest.mark.parametrize("locale", ["de", "fr"])
def test_accounts_button_is_displayed_rest_tier_1(locale, base_url, selenium):
    page = HomePage(selenium, base_url, locale=locale).open()
    assert page.is_primary_accounts_button_displayed
    assert page.is_secondary_accounts_button_displayed
    assert not page.is_primary_download_button_displayed
    assert not page.is_secondary_download_button_displayed


@pytest.mark.skip_if_not_firefox(reason="Alternative CTA is displayed only to Firefox users")
@pytest.mark.nondestructive
def test_accounts_button_is_displayed(base_url, selenium):
    page = HomePage(selenium, base_url, locale="en-US").open()
    assert page.is_primary_alt_button_displayed
    assert page.is_secondary_accounts_button_displayed
    assert not page.is_primary_download_button_displayed
    assert not page.is_secondary_download_button_displayed


@pytest.mark.skip_if_firefox(reason="Download button is displayed only to non-Firefox users")
@pytest.mark.nondestructive
def test_legacy_download_button_is_displayed(base_url, selenium):
    page = HomePage(selenium, base_url, locale="it").open()
    assert page.is_primary_download_button_displayed

@@ -443,17 +443,8 @@
 %22, %5B
-%22en-US%22, 
 %22de%22
@@ -1247,36 +1247,32 @@
 st.mark.skip_if_
-not_
 firefox(reason=%22
@@ -1275,23 +1275,23 @@
 on=%22
-Alternative CTA
+Download button
  is 
@@ -1300,32 +1300,36 @@
 splayed only to 
+non-
 Firefox users%22)%0A
@@ -1361,32 +1361,39 @@
 ve%0Adef test_
-accounts
+legacy_download
 _button_is_d
@@ -1474,13 +1474,10 @@
 le=%22
-en-US
+it
 %22).o
@@ -1513,174 +1513,8 @@
 ary_
-alt_button_displayed%0A    assert page.is_secondary_accounts_button_displayed%0A    assert not page.is_primary_download_button_displayed%0A    assert not page.is_secondary_
 down
@@ -1550,32 +1550,36 @@
 st.mark.skip_if_
+not_
 firefox(reason=%22
@@ -1574,39 +1574,39 @@
 fox(reason=%22
-Download button
+Alternative CTA
  is displaye
@@ -1607,36 +1607,32 @@
 splayed only to 
-non-
 Firefox users%22)%0A
@@ -1664,39 +1664,32 @@
 ve%0Adef test_
-legacy_download
+accounts
 _button_is_d
@@ -1781,32 +1781,84 @@
 en()%0A    assert 
+page.is_primary_alt_button_displayed%0A    assert not 
 page.is_primary_

Update home page functional tests [#10560]