LeanAdmin / feature-discussions

The place for discussing new features
6 stars 0 forks source link

Testing #26

Open stancl opened 3 years ago

stancl commented 3 years ago

I'm thinking of ways to make testing easier.

First, low-level testing of fields and actions should definitely be documented.

Second, I'm thinking that it'd be nice to have some automated tests. You'd specify user interactions, like:

  1. Create Product, title: MacBook Pro 16", price: 1500, description: Foo. Assert no errors.
  2. Create a child Variant, title: Color, values: Space Gray and Silver. Assert no errors.
  3. Create a child Variant, title: Color, values whatever, Assert validation error variant title has to be unique
  4. Create Order with address ABC. Assert no errors.
  5. Create OrderProduct for order #1, linking to the MacBook Pro 16" product. Quantity: 2 Assert no errors
  6. Assert total of OrderProduct
  7. Create OrderProduct again for MacBook Pro 16", assert error - unique rule
  8. Create Order with address DEF. Assert missing ZIP code
  9. Edit order #1, change address to XYZ. Assert no errors.
  10. Go to order index, assert order #1 total is a formatted string that looks like $11,120

This would test that your admin panel didn't start behaving in random ways when you made a minor change to some field definition (this was pretty common in Nova when I was using it) and it would make sure that no pages and actions show errors. This would be done on Livewire level, but we might have a version that does these things with Dusk too to make sure that everything works in the browser as well. That would of course be an optional extra feature.