I have photos of products that are on my local drive. I write the path to them in a variable.
...
const addImage1 = path.join(__dirname, '../path/products/add/addImage1.jpeg');
...
After which I use them in tests
...
.attach('store_photos', fs.readFileSync(addImage1), 'addImage1.jpeg')
...
How can I load a photo from a link into a variable and use it for tests? I am using the library faker. She has a place image Example:
import faker from 'faker';
faker.image.image() // http://lorempixel.com/640/480/food
faker.image.avatar() // https://s3.amazonaws.com/uifaces/faces/twitter/nerdgr8/128.jpg
You can see here the library methods https://rawgit.com/Marak/faker.js/master/examples/browser/index.html
Aucun commentaire:
Enregistrer un commentaire