Skip to content
Permalink
Browse files

[Percy Test] Bannered Campaign Page (#3566)

* intial commit

* testing bcp

* trying again

* Apply suggestions from code review

Co-Authored-By: Pomax <pomax@nihongoresources.com>

* remove donation factory

* fixed some errors

* using create method instead

* Update cypress/integration/endpoint-tests.js

Co-Authored-By: Pomax <pomax@nihongoresources.com>

* signup add attempt

* added signup

* oops
  • Loading branch information...
youriwims committed Aug 22, 2019
1 parent a294e9f commit 2d77f8f93da359ecc6d095df3e9c0ac6dd2614d5
@@ -101,6 +101,17 @@ describe(`Visual regression testing for foundation.mozilla.org`, () => {
cy.percySnapshot();
});

// Bannered Campaign page test

it(`Bannered Campaign Page`, function() {
cy.visit(`/en/campaigns/test-bannered-campaign`);
cy.window()
.its(`main-js:react:finished`)
.should(`equal`, true);
cy.wait(500);
cy.percySnapshot();
});

// Pages specific to the "Privacy Not Included" Buyers Guide

it(`PNI homepage`, function() {
@@ -1,6 +1,7 @@
from . import (
blog,
campaign_page,
bannered_campaign_page,
homepage_features,
homepage,
initiatives_page,
@@ -17,6 +18,7 @@ def generate(seed):
homepage_features.generate(seed)
blog.generate(seed)
campaign_page.generate(seed)
bannered_campaign_page.generate(seed)
initiatives_page.generate(seed)
news_page.generate(seed)
opportunity.generate(seed)
@@ -0,0 +1,53 @@
from factory import (
Trait,
SubFactory
)
from wagtail.core.models import Page as WagtailPage

from networkapi.wagtailpages.models import BanneredCampaignPage
from networkapi.utility.faker.helpers import (
reseed,
get_homepage
)
from .petition import PetitionFactory
from .signup import SignupFactory
from .mini_site_namespace import MiniSiteNamespaceFactory
from .abstract import CMSPageFactory


class BanneredCampaignPageFactory(CMSPageFactory):
class Meta:
model = BanneredCampaignPage

class Params:
no_cta = Trait(cta=None)

cta = SubFactory(PetitionFactory)

signup = SubFactory(SignupFactory)


def generate(seed):
home_page = get_homepage()
reseed(seed)

try:
bannered_campaign_namespace = WagtailPage.objects.get(title='campaigns')
print('Campaigns namespace exists')
except WagtailPage.DoesNotExist:
print('Generating campaigns namespace')
bannered_campaign_namespace = MiniSiteNamespaceFactory.create(
parent=home_page,
title='campaigns',
live=False
)

reseed(seed)

print('Generating Bannered Campaign Pages under namespace')
BanneredCampaignPageFactory.create(
parent=bannered_campaign_namespace,
title="Test Bannered Campaign"
)

reseed(seed)

0 comments on commit 2d77f8f

Please sign in to comment.
You can’t perform that action at this time.