Kreya icon indicating copy to clipboard operation
Kreya copied to clipboard

Use faker feature inside Script

Open XavierMrg opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. Generate random values in Kreya script section

Describe the solution you'd like We would like to have the possibility to generate random values from faker library (which is used for templating) in Kreya script section (cf screenshot bellow)

Describe alternatives you've considered Unfortunately we have not found an alternative solution

Additional context image

XavierMrg avatar Dec 20 '23 10:12 XavierMrg

This is definitely something we want to add and is already on our internal roadmap.

As a workaround, you could import fakerjs as a "web module":

import { expect } from 'chai';
import { faker } from 'https://esm.sh/@faker-js/faker';

var someId = faker.string.uuid();

kreya.variables.set('myId', someId);

CommonGuy avatar Dec 20 '23 10:12 CommonGuy