ci: Setup cypress tasks for resetting DB, and setting up an owner (#4717)

* ci: Setup cypress tasks for resetting DB, and setting up an owner

* address Ivan's comments
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2022-11-24 18:32:00 +01:00
committed by GitHub
parent aec08275aa
commit e409813ea9
8 changed files with 149 additions and 9 deletions

View File

@@ -1,11 +1,26 @@
const fetch = require('node-fetch');
const { defineConfig } = require('cypress');
const BASE_URL = 'http://localhost:5678';
module.exports = defineConfig({
e2e: {
baseUrl: 'http://localhost:5678',
baseUrl: BASE_URL,
video: false,
screenshotOnRunFailure: true,
experimentalSessionAndOrigin: true,
experimentalInteractiveRunEvents: true,
setupNodeEvents(on) {
on('task', {
'db:reset': () => fetch(BASE_URL + '/e2e/db/reset', { method: 'POST' }),
'db:setup-owner': (payload) =>
fetch(BASE_URL + '/e2e/db/setup-owner', {
method: 'POST',
body: JSON.stringify(payload),
headers: { 'Content-Type': 'application/json' },
}),
});
},
},
});