зеркало из https://github.com/mozilla/bedrock.git
Remove mozilla.social links and invite page (#15234)
This commit is contained in:
Родитель
e3c41e75bd
Коммит
009357a68d
|
@ -18,7 +18,6 @@
|
|||
<h2 class="moz24-footer-heading-social">{{ ftl('footer-refresh-follow-mozilla') }}</h2>
|
||||
<ul class="moz24-footer-links-social">
|
||||
<li><a class="twitter" href="{{ mozilla_twitter_url() }}" data-link-type="footer" data-link-text="Twitter (@mozilla)">{{ ftl('footer-refresh-x-formerly-twitter', fallback='footer-twitter') }}<span> (@mozilla)</span></a></li>
|
||||
<li><a class="mastodon" href="https://mozilla.social/@Mozilla" rel="me" data-link-type="footer" data-link-text="Mastodon (@mozilla)">{{ ftl('footer-refresh-mastodon') }}<span> (@mozilla)</span></a></li>
|
||||
<li><a class="instagram" href="{{ mozilla_instagram_url() }}" data-link-type="footer" data-link-text="Instagram (@mozilla)">{{ ftl('footer-refresh-instagram') }}<span> (@mozilla)</span></a></li>
|
||||
<li><a class="linkedin" href="https://www.linkedin.com/company/mozilla-corporation/" data-link-type="footer" data-link-text="LinkedIn (@mozilla)">{{ ftl('footer-refresh-linkedin') }}<span> (@mozilla)</span></a></li>
|
||||
<li><a class="tiktok" href="https://www.tiktok.com/@mozilla" data-link-type="footer" data-link-text="TikTok (@mozilla)">{{ ftl('footer-refresh-tiktok') }}<span> (@mozilla)</span></a></li>
|
||||
|
|
|
@ -86,7 +86,6 @@
|
|||
<h2 class="mzp-c-footer-heading-social">{{ ftl('footer-follow-mozilla') }}</h2>
|
||||
<ul class="mzp-c-footer-links-social">
|
||||
<li><a class="twitter" href="{{ mozilla_twitter_url() }}" data-link-type="footer" data-link-text="Twitter (@mozilla)">{{ ftl('footer-x-formerly-twitter', fallback='footer-twitter') }}<span> (@mozilla)</span></a></li>
|
||||
<li><a class="mastodon" href="https://mozilla.social/@Mozilla" rel="me" data-link-type="footer" data-link-text="Mastodon (@mozilla)">{{ ftl('footer-mastodon') }}<span> (@mozilla)</span></a></li>
|
||||
<li><a class="instagram" href="{{ mozilla_instagram_url() }}" data-link-type="footer" data-link-text="Instagram (@mozilla)">{{ ftl('footer-instagram') }}<span> (@mozilla)</span></a></li>
|
||||
<li><a class="linkedin" href="https://www.linkedin.com/company/mozilla-corporation/" data-link-type="footer" data-link-text="LinkedIn (@mozilla)">{{ ftl('footer-linkedin') }}<span> (@mozilla)</span></a></li>
|
||||
<li><a class="tiktok" href="https://www.tiktok.com/@mozilla" data-link-type="footer" data-link-text="TikTok (@mozilla)">{{ ftl('footer-tiktok') }}<span> (@mozilla)</span></a></li>
|
||||
|
|
|
@ -8,8 +8,3 @@ from bedrock.newsletter.forms import NewsletterFooterForm
|
|||
class VPNWaitlistForm(NewsletterFooterForm):
|
||||
def __init__(self, locale, data=None, *args, **kwargs):
|
||||
super().__init__("guardian-vpn-waitlist", locale, data, *args, **kwargs)
|
||||
|
||||
|
||||
class MozSocialWaitlistForm(NewsletterFooterForm):
|
||||
def __init__(self, locale, data=None, *args, **kwargs):
|
||||
super().__init__("mozilla-social-waitlist", locale, data, *args, **kwargs)
|
||||
|
|
|
@ -14,4 +14,5 @@ redirectpatterns = (
|
|||
# Issue 11875
|
||||
redirect(r"^vpn/download/windows/?$", "products.vpn.windows-download"),
|
||||
redirect(r"^vpn/download/mac/?$", "products.vpn.mac-download"),
|
||||
redirect(r"^products/mozsocial/invite/?$", "products.landing"),
|
||||
)
|
||||
|
|
|
@ -1,106 +0,0 @@
|
|||
{#
|
||||
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 https://mozilla.org/MPL/2.0/.
|
||||
#}
|
||||
|
||||
{% extends "base-protocol.html" %}
|
||||
|
||||
{% block page_css %}
|
||||
{{ css_bundle('protocol-newsletter') }}
|
||||
{{ css_bundle('mozsocial-invite') }}
|
||||
{% endblock %}
|
||||
|
||||
{% block page_title %}{{ ftl('mozsocial-invite-join-the-waitlist') }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<main class="mzp-l-content mzp-t-content-xl">
|
||||
<section class="mzp-c-newsletter c-mozsocial-invite">
|
||||
<div class="mzp-c-newsletter-image">
|
||||
{{ resp_img(
|
||||
url='img/products/mozsocial/waitlist-tree.png',
|
||||
srcset={
|
||||
'img/products/mozsocial/waitlist-tree-high-res.png': '2x'
|
||||
},
|
||||
optional_attributes={
|
||||
"height": "424",
|
||||
"width": "424"
|
||||
}
|
||||
)}}
|
||||
</div>
|
||||
|
||||
<form id="newsletter-form" class="mzp-c-newsletter-form c-waitlist-form" name="newsletter-form" action="{{ action }}" method="post">
|
||||
<div hidden>
|
||||
{{ newsletter_form.newsletters|safe }}
|
||||
</div>
|
||||
<input type="hidden" name="source_url" value="{{ request.build_absolute_uri() }}">
|
||||
|
||||
<h1 class="mzp-c-form-header">{{ ftl('mozsocial-invite-welcome-to-mozillasocial') }}</h1>
|
||||
<p class="mzp-c-form-subtitle">{{ ftl('mozsocial-invite-please-join-our-waitlist') }}</p>
|
||||
|
||||
<fieldset class="mzp-c-newsletter-content">
|
||||
<div class="mzp-c-form-errors hide-from-legacy-ie hidden" id="newsletter-errors">
|
||||
<ul class="mzp-u-list-styled">
|
||||
<li class="error-email-invalid hidden">{{ ftl('newsletter-form-please-enter-a-valid') }}</li>
|
||||
<li class="error-select-country hidden">{{ ftl('newsletter-form-please-select-country') }}</li>
|
||||
<li class="error-try-again-later hidden">{{ ftl('newsletter-form-we-are-sorry-but-there') }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="mzp-c-field">
|
||||
<label class="mzp-c-field-label" for="id_first_name">{{ ftl('mozsocial-invite-first-name-label') }} <em class="mzp-c-fieldnote">{{ ftl('mozsocial-invite-required-label') }}</em></label>
|
||||
<input class="mzp-c-field-control" id="id_first_name" name="first_name" type="text" required="" aria-required="true">
|
||||
</div>
|
||||
|
||||
<div class="mzp-c-field">
|
||||
<label class="mzp-c-field-label" for="id_last_name">{{ ftl('mozsocial-invite-last-name-label') }} <em class="mzp-c-fieldnote">{{ ftl('mozsocial-invite-required-label') }}</em></label>
|
||||
<input class="mzp-c-field-control" id="id_last_name" name="last_name" type="text" required="" aria-required="true">
|
||||
</div>
|
||||
|
||||
<div class="mzp-c-field">
|
||||
<label class="mzp-c-field-label" for="id_email">{{ ftl('mozsocial-invite-your-email-address-label') }} <em class="mzp-c-fieldnote">{{ ftl('mozsocial-invite-required-label') }}</em></label>
|
||||
<input type="email" class="mzp-js-email-field mzp-c-field-control" id="id_email" name="email" placeholder="{{ ftl('newsletter-form-yournameexamplecom') }}" required="" aria-required="true">
|
||||
</div>
|
||||
|
||||
<div class="mzp-c-field">
|
||||
<label for="id_country">{{ ftl('mozsocial-invite-country-label') }} <em class="mzp-c-fieldnote">{{ ftl('mozsocial-invite-required-label') }}</em></label>
|
||||
{{ newsletter_form.country|safe }}
|
||||
</div>
|
||||
|
||||
<div class="mzp-c-field">
|
||||
<label class="mzp-c-field-label" for="id_twitter">{{ ftl('mozsocial-invite-twitter-handle-label') }}</label>
|
||||
<input class="mzp-c-field-control" id="id_twitter" name="mozilla_social_twitter_handle" type="text">
|
||||
</div>
|
||||
|
||||
<div class="mzp-c-field">
|
||||
<label class="mzp-c-field-label" for="id_mastodon">{{ ftl('mozsocial-invite-mastodon-handle-label') }}</label>
|
||||
<input class="mzp-c-field-control" id="id_mastodon" name="mozilla_social_mastodon_handle" type="text">
|
||||
</div>
|
||||
|
||||
<div class="mzp-c-choices">
|
||||
<div class="mzp-c-choice">
|
||||
<input class="mzp-c-choice-control" type="checkbox" id="privacy" required="" aria-required="true">
|
||||
<label class="mzp-c-choice-label" for="privacy">{{ ftl('newsletter-form-im-okay-with-mozilla', url=url('privacy.notices.subscription-services')) }}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="mzp-c-form-submit">
|
||||
<button type="submit" id="newsletter-submit" class="mzp-c-button button-dark" data-cta-type="mozsocial-waitlist-signup" data-cta-text="Sign me up">
|
||||
{{ ftl('newsletter-form-sign-me-up') }}
|
||||
</button>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<div id="newsletter-thanks" class="mozsocial-invite-success hidden">
|
||||
<h3>{{ ftl('mozsocial-invite-thanks-youre-on-the-list') }}</h3>
|
||||
<p>{{ ftl('newsletter-form-if-you-havent-previously') }}</p>
|
||||
<p>{{ ftl('mozsocial-invite-mozillasocial-is-currently') }}</p>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
{{ js_bundle('mozsocial-waitlist') }}
|
||||
{% endblock %}
|
|
@ -46,7 +46,6 @@ urlpatterns = (
|
|||
views.resource_center_article_view,
|
||||
name="products.vpn.resource-center.article",
|
||||
),
|
||||
path("mozsocial/invite/", views.mozsocial_waitlist_page, name="products.mozsocial.invite"),
|
||||
path("monitor/waitlist-plus/", views.monitor_waitlist_plus_page, name="products.monitor.waitlist-plus"),
|
||||
path("monitor/waitlist-scan/", views.monitor_waitlist_scan_page, name="products.monitor.waitlist-scan"),
|
||||
)
|
||||
|
|
|
@ -21,7 +21,7 @@ from bedrock.contentful.constants import (
|
|||
)
|
||||
from bedrock.contentful.models import ContentfulEntry
|
||||
from bedrock.contentful.utils import locales_with_available_content
|
||||
from bedrock.products.forms import MozSocialWaitlistForm, VPNWaitlistForm
|
||||
from bedrock.products.forms import VPNWaitlistForm
|
||||
from lib import l10n_utils
|
||||
from lib.l10n_utils import L10nTemplateView
|
||||
from lib.l10n_utils.fluent import ftl_file_is_active
|
||||
|
@ -413,18 +413,6 @@ def resource_center_article_view(request, slug):
|
|||
)
|
||||
|
||||
|
||||
@require_safe
|
||||
def mozsocial_waitlist_page(request):
|
||||
template_name = "products/mozsocial/invite.html"
|
||||
ftl_files = ["products/mozsocial/invite"]
|
||||
locale = l10n_utils.get_locale(request)
|
||||
newsletter_form = MozSocialWaitlistForm(locale)
|
||||
|
||||
ctx = {"action": settings.BASKET_SUBSCRIBE_URL, "newsletter_form": newsletter_form, "product": "mozilla-social-waitlist"}
|
||||
|
||||
return l10n_utils.render(request, template_name, ctx, ftl_files=ftl_files)
|
||||
|
||||
|
||||
@require_safe
|
||||
def monitor_waitlist_scan_page(request):
|
||||
template_name = "products/monitor/waitlist/scan.html"
|
||||
|
|
|
@ -272,9 +272,6 @@ locales = [
|
|||
[[paths]]
|
||||
reference = "en/privacy/*.ftl"
|
||||
l10n = "{locale}/privacy/*.ftl"
|
||||
[[paths]]
|
||||
reference = "en/products/mozsocial/*.ftl"
|
||||
l10n = "{locale}/products/mozsocial/*.ftl"
|
||||
[[paths]]
|
||||
reference = "en/products/vpn/landing.ftl"
|
||||
l10n = "{locale}/products/vpn/landing.ftl"
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
# 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 https://mozilla.org/MPL/2.0/.
|
||||
|
||||
### URL: https://www-dev.allizom.org/products/mozsocial/invite/
|
||||
|
||||
# HTML page title
|
||||
mozsocial-invite-join-the-waitlist = Join the waitlist for { -brand-name-mozilla-social }
|
||||
mozsocial-invite-welcome-to-mozillasocial = Welcome to { -brand-name-mozilla-social }!
|
||||
mozsocial-invite-please-join-our-waitlist = Please join our waitlist by completing the form below.
|
||||
mozsocial-invite-required-label = Required
|
||||
mozsocial-invite-first-name-label = First name
|
||||
mozsocial-invite-last-name-label = Last name
|
||||
mozsocial-invite-your-email-address-label = Your email address
|
||||
mozsocial-invite-country-label = Country
|
||||
|
||||
# "Handle" is jargon for a user name.
|
||||
mozsocial-invite-twitter-handle-label = Twitter handle?
|
||||
|
||||
# Mastodon is a brand name. "Handle" is jargon for a user name.
|
||||
mozsocial-invite-mastodon-handle-label = Mastodon handle?
|
||||
mozsocial-invite-thanks-youre-on-the-list = Thanks! You’re on the list
|
||||
mozsocial-invite-mozillasocial-is-currently = { -brand-name-mozilla-social } is currently available to a closed beta group as we experiment, gain input from participants, learn, and improve the experience. We’ll email you an invitation as we gradually expand.
|
|
@ -1,27 +0,0 @@
|
|||
// 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 https://mozilla.org/MPL/2.0/.
|
||||
|
||||
@use '~@mozilla-protocol/core/protocol/css/includes/lib' as *;
|
||||
@use '~@mozilla-protocol/core/protocol/css/components/forms/form';
|
||||
@use '~@mozilla-protocol/core/protocol/css/components/forms/field';
|
||||
@use '~@mozilla-protocol/core/protocol/css/components/forms/choice';
|
||||
@use '~@mozilla-protocol/core/protocol/css/components/forms/status';
|
||||
@use '~@mozilla-protocol/core/protocol/css/components/forms/set';
|
||||
|
||||
.mzp-c-newsletter {
|
||||
padding: 0;
|
||||
column-gap: $h-grid-md;
|
||||
|
||||
.mzp-c-newsletter-form {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.mzp-c-form-header {
|
||||
@include text-title-md;
|
||||
}
|
||||
|
||||
.mzp-c-field-control {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
Двоичные данные
media/img/products/mozsocial/waitlist-tree-high-res.png
Двоичные данные
media/img/products/mozsocial/waitlist-tree-high-res.png
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 69 KiB |
Двоичные данные
media/img/products/mozsocial/waitlist-tree.png
Двоичные данные
media/img/products/mozsocial/waitlist-tree.png
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 23 KiB |
|
@ -1,161 +0,0 @@
|
|||
/*
|
||||
* 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 https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import FormUtils from '../../newsletter/form-utils.es6';
|
||||
|
||||
let form;
|
||||
|
||||
const WaitListForm = {
|
||||
handleFormError: (msg) => {
|
||||
let error;
|
||||
|
||||
FormUtils.enableFormFields(form);
|
||||
|
||||
form.querySelector('.mzp-c-form-errors').classList.remove('hidden');
|
||||
|
||||
switch (msg) {
|
||||
case FormUtils.errorList.EMAIL_INVALID_ERROR:
|
||||
error = form.querySelector('.error-email-invalid');
|
||||
break;
|
||||
case FormUtils.errorList.COUNTRY_ERROR:
|
||||
error = form.querySelector('.error-select-country');
|
||||
break;
|
||||
default:
|
||||
error = form.querySelector('.error-try-again-later');
|
||||
}
|
||||
|
||||
if (error) {
|
||||
error.classList.remove('hidden');
|
||||
}
|
||||
},
|
||||
|
||||
handleFormSuccess: () => {
|
||||
const thanks = document.getElementById('newsletter-thanks');
|
||||
const newsletter = form.querySelector(
|
||||
'input[name="newsletters"]'
|
||||
).value;
|
||||
|
||||
// show thanks message
|
||||
form.classList.add('hidden');
|
||||
thanks.classList.remove('hidden');
|
||||
window.scrollTo(0, 0);
|
||||
|
||||
if (window.dataLayer) {
|
||||
window.dataLayer.push({
|
||||
event: 'newsletter-signup-success',
|
||||
newsletter: newsletter
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
validateFields: () => {
|
||||
const email = form.querySelector('input[type="email"]').value;
|
||||
const countrySelect = form.querySelector('select[name="country"]');
|
||||
|
||||
// Really basic client side email validity check.
|
||||
if (!FormUtils.checkEmailValidity(email)) {
|
||||
form.handleFormError(FormUtils.errorList.EMAIL_INVALID_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check for country selection value.
|
||||
if (countrySelect && !countrySelect.value) {
|
||||
WaitListForm.handleFormError(FormUtils.errorList.COUNTRY_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
serialize: () => {
|
||||
// First name
|
||||
const first_name = encodeURIComponent(
|
||||
form.querySelector('input[name="first_name"]').value
|
||||
);
|
||||
|
||||
// Last name
|
||||
const last_name = encodeURIComponent(
|
||||
form.querySelector('input[name="last_name"]').value
|
||||
);
|
||||
|
||||
// Email address
|
||||
const email = encodeURIComponent(
|
||||
form.querySelector('input[type="email"]').value
|
||||
);
|
||||
|
||||
// Country
|
||||
const country = form.querySelector('select[name="country"]').value;
|
||||
|
||||
// Twitter handle
|
||||
const twitter = encodeURIComponent(
|
||||
form.querySelector('input[name="mozilla_social_twitter_handle"]')
|
||||
.value
|
||||
);
|
||||
|
||||
// Mastodon handle
|
||||
const mastodon = encodeURIComponent(
|
||||
form.querySelector('input[name="mozilla_social_mastodon_handle"]')
|
||||
.value
|
||||
);
|
||||
|
||||
// Newsletter ID
|
||||
const newsletter = form.querySelector(
|
||||
'input[name="newsletters"]'
|
||||
).value;
|
||||
|
||||
// Source URL (hidden field)
|
||||
const sourceUrl = encodeURIComponent(
|
||||
form.querySelector('input[name="source_url"]').value
|
||||
);
|
||||
|
||||
return `first_name=${first_name}&last_name=${last_name}&email=${email}&country=${country}&mozilla_social_twitter_handle=${twitter}&mozilla_social_mastodon_handle=${mastodon}&newsletters=${newsletter}&format=H&source_url=${sourceUrl}`;
|
||||
},
|
||||
|
||||
newsletterSubscribe: (e) => {
|
||||
const email = form.querySelector('input[type="email"]').value;
|
||||
const url = form.getAttribute('action');
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
// Disable form fields until POST has completed.
|
||||
FormUtils.disableFormFields(form);
|
||||
|
||||
// Clear any prior messages that might have been displayed.
|
||||
FormUtils.clearFormErrors(form);
|
||||
|
||||
// Perform client side form field validation.
|
||||
if (!WaitListForm.validateFields()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const params = WaitListForm.serialize();
|
||||
|
||||
FormUtils.postToBasket(
|
||||
email,
|
||||
params,
|
||||
url,
|
||||
WaitListForm.handleFormSuccess,
|
||||
WaitListForm.handleFormError
|
||||
);
|
||||
},
|
||||
|
||||
init: () => {
|
||||
form = document.getElementById('newsletter-form');
|
||||
|
||||
if (!form) {
|
||||
return;
|
||||
}
|
||||
|
||||
form.addEventListener(
|
||||
'submit',
|
||||
WaitListForm.newsletterSubscribe,
|
||||
false
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
WaitListForm.init();
|
|
@ -1202,12 +1202,6 @@
|
|||
],
|
||||
"name": "monitor-waitlist"
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"css/products/mozsocial/invite.scss"
|
||||
],
|
||||
"name": "mozsocial-invite"
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"css/mozorg/antiharassment-tool.scss"
|
||||
|
@ -1850,12 +1844,6 @@
|
|||
],
|
||||
"name": "firefox-nothing-personal"
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"js/products/mozsocial/invite.es6.js"
|
||||
],
|
||||
"name": "mozsocial-waitlist"
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"js/mozorg/home/monitor-banner.es6.js"
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
# 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 https://mozilla.org/MPL/2.0/.
|
||||
|
||||
import pytest
|
||||
|
||||
from pages.products.mozsocial.invite import MozsocialInvitePage
|
||||
|
||||
|
||||
@pytest.mark.nondestructive
|
||||
def test_sign_up_success(base_url, selenium):
|
||||
page = MozsocialInvitePage(selenium, base_url).open()
|
||||
page.type_first_name("Peter")
|
||||
page.type_last_name("Parker")
|
||||
page.type_email("success@example.com")
|
||||
page.select_country("United States")
|
||||
page.newsletter.accept_privacy_policy()
|
||||
page.click_sign_me_up()
|
||||
assert page.is_form_success_displayed
|
||||
|
||||
|
||||
@pytest.mark.nondestructive
|
||||
def test_sign_up_failure(base_url, selenium):
|
||||
page = MozsocialInvitePage(selenium, base_url).open()
|
||||
page.type_first_name("Peter")
|
||||
page.type_last_name("Parker")
|
||||
page.type_email("invalid@email")
|
||||
page.select_country("United States")
|
||||
page.newsletter.accept_privacy_policy()
|
||||
page.click_sign_me_up(expected_result="error")
|
||||
assert page.is_form_error_displayed
|
|
@ -1,66 +0,0 @@
|
|||
# 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 https://mozilla.org/MPL/2.0/.
|
||||
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.support import expected_conditions as expected
|
||||
from selenium.webdriver.support.select import Select
|
||||
|
||||
from pages.base import BasePage
|
||||
|
||||
|
||||
class MozsocialInvitePage(BasePage):
|
||||
_URL_TEMPLATE = "/{locale}/products/mozsocial/invite/"
|
||||
|
||||
_first_name_locator = (By.ID, "id_first_name")
|
||||
_last_name_locator = (By.ID, "id_last_name")
|
||||
_email_locator = (By.ID, "id_email")
|
||||
_country_locator = (By.ID, "id_country")
|
||||
_submit_button_locator = (By.ID, "newsletter-submit")
|
||||
_thank_you_locator = (By.ID, "newsletter-thanks")
|
||||
_error_list_locator = (By.ID, "newsletter-errors")
|
||||
|
||||
@property
|
||||
def first_name(self):
|
||||
return self.find_element(*self._first_name_locator).get_attribute("value")
|
||||
|
||||
def type_first_name(self, value):
|
||||
self.find_element(*self._first_name_locator).send_keys(value)
|
||||
|
||||
@property
|
||||
def last_name(self):
|
||||
return self.find_element(*self._last_name_locator).get_attribute("value")
|
||||
|
||||
def type_last_name(self, value):
|
||||
self.find_element(*self._last_name_locator).send_keys(value)
|
||||
|
||||
@property
|
||||
def email(self):
|
||||
return self.find_element(*self._email_locator).get_attribute("value")
|
||||
|
||||
def type_email(self, value):
|
||||
self.find_element(*self._email_locator).send_keys(value)
|
||||
|
||||
@property
|
||||
def country(self):
|
||||
el = self.find_element(*self._country_locator)
|
||||
return el.find_element(By.CSS_SELECTOR, "option[selected]").text
|
||||
|
||||
def select_country(self, value):
|
||||
el = self.find_element(*self._country_locator)
|
||||
Select(el).select_by_visible_text(value)
|
||||
|
||||
@property
|
||||
def is_form_success_displayed(self):
|
||||
return self.is_element_displayed(*self._thank_you_locator)
|
||||
|
||||
@property
|
||||
def is_form_error_displayed(self):
|
||||
return self.is_element_displayed(*self._error_list_locator)
|
||||
|
||||
def click_sign_me_up(self, expected_result=None):
|
||||
self.find_element(*self._submit_button_locator).click()
|
||||
if expected_result == "error":
|
||||
self.wait.until(expected.visibility_of_element_located(self._error_list_locator))
|
||||
else:
|
||||
self.wait.until(expected.visibility_of_element_located(self._thank_you_locator))
|
|
@ -1301,5 +1301,6 @@ URLS = flatten(
|
|||
url_test("/try-picture-in-picture/", "/firefox/features/picture-in-picture/"),
|
||||
# issue 15075
|
||||
url_test("/newsletter/knowledge-is-power{,/,/confirm,/confirm/token}", "/newsletter/firefox/"),
|
||||
url_test("/products/mozsocial/invite/", "/products/"),
|
||||
)
|
||||
)
|
||||
|
|
Загрузка…
Ссылка в новой задаче