Test: add editor test coverage (#3598)
This commit is contained in:
@ -11,6 +11,7 @@
|
||||
// This function is called when a project is opened or re-opened (e.g. due to
|
||||
// the project's config changing)
|
||||
require('dotenv').config();
|
||||
const { merge } = require('lodash');
|
||||
const { addMatchImageSnapshotPlugin } = require('cypress-image-snapshot/plugin');
|
||||
|
||||
const {
|
||||
@ -34,8 +35,8 @@ const {
|
||||
teardownBitBucketTest,
|
||||
} = require('./bitbucket');
|
||||
const { setupProxy, teardownProxy, setupProxyTest, teardownProxyTest } = require('./proxy');
|
||||
|
||||
const { copyBackendFiles, switchVersion } = require('../utils/config');
|
||||
const { setupTestBackend } = require('./testBackend');
|
||||
const { copyBackendFiles, switchVersion, updateConfig } = require('../utils/config');
|
||||
|
||||
module.exports = async (on, config) => {
|
||||
// `on` is used to hook into various events Cypress emits
|
||||
@ -61,6 +62,9 @@ module.exports = async (on, config) => {
|
||||
case 'proxy':
|
||||
result = await setupProxy(options);
|
||||
break;
|
||||
case 'test':
|
||||
result = await setupTestBackend(options);
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -161,6 +165,13 @@ module.exports = async (on, config) => {
|
||||
|
||||
await switchVersion(version);
|
||||
|
||||
return null;
|
||||
},
|
||||
async updateConfig(config) {
|
||||
await updateConfig(current => {
|
||||
merge(current, config);
|
||||
});
|
||||
|
||||
return null;
|
||||
},
|
||||
});
|
||||
|
14
cypress/plugins/testBackend.js
Normal file
14
cypress/plugins/testBackend.js
Normal file
@ -0,0 +1,14 @@
|
||||
const { updateConfig } = require('../utils/config');
|
||||
const { merge } = require('lodash');
|
||||
|
||||
async function setupTestBackend(options) {
|
||||
await updateConfig(current => {
|
||||
merge(current, options);
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
setupTestBackend,
|
||||
};
|
Reference in New Issue
Block a user