UNPKG

@applitools/eyes-storybook

Version:
18 lines (15 loc) 454 B
const getClientAPI = require('./getClientAPI'); async function getStoryByIndex(index) { let api; try { api = await getClientAPI(); const stories = await api.getStories(); if (!stories[index]) { console.log('error cannot get story', index); } return stories[index]; } catch (ex) { throw new Error(JSON.stringify({message: ex.message, version: api ? api.version : undefined})); } } module.exports = getStoryByIndex;