Skip to content

Feature request: A TestCase that automatically finds and tests PageFactory subclasses #45

@ababic

Description

@ababic

Imagine a test case that magically find all of the PageFactory subclasses within a project, and for each class found, test that:

  • It can successfully create an instance of that page type
  • The created page doesn't error when viewed normally
  • The created page doesn't error when viewed in 'preview' mode

I think this could easily be achieved by keeping a 'reference' dict that gets populated via a metaclass when subclasses are defined (a bit like what Wagtail does with wagtail.core.models.PAGE_MODEL_CLASSES)

We could ignore any factories that do not specify a model value in their Meta class. And maybe even introduce a new/optional Meta option that could be used to explicitly opt-out of testing for a specific factory class.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions