international-labour-organization / designsystem

A design system for the International Labour Organization
Apache License 2.0
1 stars 3 forks source link

Twig: Expand Tests #1100

Open justintemps opened 2 months ago

justintemps commented 2 months ago

this ticket is a stub for expanding tests in the Twig package. Right now, they're mostly just checking to see if the component renders, but now we should add tests for variants and edge cases.

@Shashika6 our first job here is to expand this ticket and determine a reasonable scope for another round of adding tickets. Please embelish this ticket with a scope describing what level of additional tests you think we should add and which components those tests should be applied to.

Shashika6 commented 1 month ago

Scope for tests.

  1. We have to refactor all tests to use the new endpoint exposed that allows us to pass custom field values/variant.

@justintemps Small question here :- 1. Can we use the default preview values for some components that do not have things features like additional variants or as a practice do we have to always pass the values using json.

http://localhost:8081/pattern-preview?id=button&fields=%7b%0a%22label%22%3a%20%22Button%22%2c%0a%22type%22%3a%20%22primary%22%2c%0a%22kind%22%3a%20%22button%22%2c%0a%22size%22%3a%20%22medium%22%0a%7d
  1. Expand tests to check functionality of components. Eg :- Action events.

  2. Where available use the variant endpoint to render and test out key features of variants as well.

CC :- @justintemps @GGKapanadze @bashlk

bashlk commented 1 month ago

@Shashika6 IMO it is better to explicitly pass the values to each components so that the behavior being tested is fixed.

But it should be alright even if you rely on the defaults. If they change, the tests should fail 😉.

bashlk commented 1 month ago

Also @Shashika6 , I think it would be good if you create a cypress command that takes the props and constructs the page URL - instead of having it hardcoded in the tests.

Shashika6 commented 1 month ago

Thats the plan @bashlk :')