Slide 1

Slide 1 text

Decoupling UI components for better reusability and test with Storybook

Slide 2

Slide 2 text

Frontend world

Slide 3

Slide 3 text

UI Frameworks

Slide 4

Slide 4 text

TEST

Slide 5

Slide 5 text

• Component segmentation for reusability • Problems we encounter when implementing a new component • The solution that we test a new component by storybook Agenda

Slide 6

Slide 6 text

● Action by click or typing ● Integrate API ● Integrate stores What do we do on the page

Slide 7

Slide 7 text

● Handle action event ● Call API ● Manage data from API ● Re-render view
 when data changed Spaghetti man Button Button Button Contents Button

Slide 8

Slide 8 text

Component segmentation for reusability

Slide 9

Slide 9 text

Input Type 1 Input Type 2 Input Type 3

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

Panel for 5 Button and Content Button Button Contents Label Button Button Button ● Render component ● Action by clicked button Focus ● Integrate with API ● Mutate data Out of scope

Slide 12

Slide 12 text

Overview Button Button Contents Panel 1 Button Button Button Panel 3 Button Button Button Panel 2 Button Button Button Button Button Contents Panel 4 Button Button Button Container Container ● Listen event from each panel to handle action ● Action to call API ● Action to stores

Slide 13

Slide 13 text

Problems we encounter when implementing a new component

Slide 14

Slide 14 text

Test and review

Slide 15

Slide 15 text

How do we test > Unit test in each component > Automation test

Slide 16

Slide 16 text

Issues we often encounter during reviews

Slide 17

Slide 17 text

A lot of files changed

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

The solution that we test a new component by storybook

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

Storybook

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

Reviewer Create PR

Slide 25

Slide 25 text

Key takeaways > Making components easily reusable > Storybook helps reduce the time spent on testing and reviewing > Let’s have fun with the storybook

Slide 26

Slide 26 text

No content