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

Created factory for donate's "Ways to give" page and added it to Percy tests #12297

Merged
merged 5 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion network-api/networkapi/donate/factory/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from . import help_page, landing_page
from . import help_page, landing_page, ways_to_give_page


def generate(seed):
# these are not, and should not be, alphabetically ordered.
landing_page.generate(seed)
help_page.generate(seed)
ways_to_give_page.generate(seed)


__all__ = [
Expand Down
28 changes: 28 additions & 0 deletions network-api/networkapi/donate/factory/ways_to_give_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from factory import Faker
from wagtail_factories import PageFactory

from networkapi.donate.models import DonateLandingPage
from networkapi.utility.faker import StreamfieldProvider
from networkapi.utility.faker.helpers import reseed
from networkapi.wagtailpages.models import OpportunityPage

Faker.add_provider(StreamfieldProvider)

streamfield_fields = ["paragraph", "linkbutton", "spacer", "quote"]


class DonateWaysToGivePageFactory(PageFactory):
class Meta:
# Using OpportunityPage AKA "Default Page" model
danielfmiranda marked this conversation as resolved.
Show resolved Hide resolved
model = OpportunityPage

title = Faker("sentence", nb_words=2)
body = Faker("streamfield", fields=streamfield_fields)


def generate(seed):
reseed(seed)

print('Generating a Donate "Ways to give" page')
donate_home_page = DonateLandingPage.objects.get(title="Donate Now")
DonateWaysToGivePageFactory(parent=donate_home_page, title="Ways to Give", header="", slug="ways-to-give")
1 change: 1 addition & 0 deletions tests/foundation-urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module.exports = {
"/publication-page-with-chapter-pages/fixed-title-chapter-page/fixed-title-article-page",
Donate: "/donate",
"Donate Help": "/donate/help",
"Donate Ways To Give": "/donate/ways-to-give",
PNI: "/privacynotincluded",
"PNI (filtered for category)": "/privacynotincluded/categories/toys-games",
"PNI general product page": "/privacynotincluded/general-percy-product",
Expand Down
Loading