-
Notifications
You must be signed in to change notification settings - Fork 352
/
cypress.config.js
44 lines (41 loc) · 1.11 KB
/
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
35
36
37
38
39
40
41
42
43
44
const { defineConfig } = require('cypress');
const faker = require('@faker-js/faker');
const { clear } = require('./server/db');
const { seed } = require('./server/db');
const {
addMatchImageSnapshotPlugin
} = require('cypress-image-snapshot/plugin');
module.exports = defineConfig({
e2e: {
baseUrl: 'http://localhost:1667/',
setupNodeEvents(on, config) {
on('task', {
generateUser() {
const randomNumber = Math.ceil(Math.random(1000) * 1000);
return {
username: faker.name.firstName() + `${randomNumber}`,
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;
},
'db:seed'() {
seed();
return null;
}
});
addMatchImageSnapshotPlugin(on, config);
}
}
});