loki icon indicating copy to clipboard operation
loki copied to clipboard

Testing Simple Interactions

Open anthonyLukes opened this issue 5 years ago • 3 comments

I was just wondering if there was a way to implement testing simple interactions like hovering or clicking on a selector before taking a screenshot... similar to how BackstopJS has clickSelector and hoverSelector as options that can be added to its test scenarios? Maybe they could be added so that they duplicate an existing story like this?

storiesOf('MyComponent', module)
  .add('MyComponent story', () => <MyComponent />)
  .lokiInteraction('with hover', {
    hoverSelector: 'button'
  })
  .lokiInteraction('with click', {
    clickSelector: 'button'
  });

anthonyLukes avatar Mar 21 '19 22:03 anthonyLukes

Do we have any news about this? it would be very useful

inspiratweb avatar Jan 09 '20 14:01 inspiratweb

The CSF 3.0 was recently announced. On top of everything else the release brings a new concept Play functions. At first glance it may solve the problem. Did anyone manage to use it with Loki?

kirilldronkin avatar Jul 14 '21 11:07 kirilldronkin

An alternative could be to use this storybook addon. It allows you to imitate pseudo states like hover in your stories, using parameters. Then you could just add stories for all the pseudo states you want to cover, and loki will take screenshots of them like with any other story.

andre-brdoch avatar Jul 21 '21 12:07 andre-brdoch