StoryConfig
Settings for the current story.
device
The device on which the test is running.
Example of a desktop device:
const desktop: Device = {
name: 'desktop',
width: 1480,
height: 920,
};
Example of a mobile device:
const mobile: Device = {
name: 'mobile',
userAgent:
'Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1',
width: 414,
height: 896,
};
tip
The list of available devices can be found here.
journal
Represents an instance of a journal.
record
Records a method call, preserving its name and arguments.
it('...', {
arrange: (externals, config) => ({
createUser: (body) => {
config.journal.record('createUser', body);
return externals.createUser(body);
},
}),
});
note
Implementation depends on the preview client. For example, in @storyshots/next, the method is asynchronous.
asRecordable
Wraps a function to log its calls.
it('...', {
arrange: (externals, config) => ({
createUser: config.journal.asRecordable('createUser', externals.createUser),
}),
});