-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcypress.config.js
34 lines (33 loc) · 922 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";
const faker = require("faker");
const { clear } = require("./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;
},
});
},
},
});