-
Notifications
You must be signed in to change notification settings - Fork 265
/
cypress.config.js
34 lines (33 loc) · 927 Bytes
/
cypress.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { defineConfig } from 'cypress';
import { faker } from '@faker-js/faker';
import { clear } from './dataBase';
module.exports = defineConfig({
e2e: {
baseUrl: 'http://localhost:3000',
setupNodeEvents(on, config) {
on('task', {
generateUser() {
let randomNumber = Math.ceil(Math.random(1000) * 1000);
let userName = faker.name.firstName() + `${randomNumber}`;
return {
username: userName.toLowerCase(),
email: 'test'+`${randomNumber}`+'@mail.com',
password: '12345Qwert!',
};
},
generateArticle() {
return {
title: faker.lorem.word(),
description: faker.lorem.words(),
body: faker.lorem.words(),
tag: faker.lorem.word()
};;
},
'db:clear'() {
clear();
return null;
},
});
},
},
});