wagtail / wagtail-factories

Factory boy classes for wagtail
http://wagtail-factories.readthedocs.io/en/latest/
MIT License
102 stars 41 forks source link

Add TestCase that automatically test PageFactory subclasses #61

Open ababic opened 2 years ago

ababic commented 2 years ago

Dependant on #62 Resolves #45

PageAutoTestCase is an importable test case that provides an instantly high level of coverage for custom page types in a standard (non-headless) Wagtail project.

All developers need to do is:

The edit-ability, serve-ability (for multiple routes), and preview-ability (for all preview modes) should then be tested for each type.

Developers can add autotest=False to the Meta class to exclude factories from these tests. For example, where a factory is created as a 'base' for a series of subclasses, and isn't intended to be used directly.

What if my page types aren't a good fit?

If none of them are, simply don't import PageAutoTestCase into your project, and the tests should not run as part of your test suite.

If only a few page types are incompatible with PageAutoTestCase, you may wish to add autotest=False to the Meta class for those factories to exclude them.

Can I customise PageAutoTestCase?

PageAutoTestCase isn't designed to be subclassed. However, if you wanted to define something similar,, you could subclass PageFeaturesTestCase, which would give you access to the following assertions: