Test: add editor test coverage (#3598)

This commit is contained in:
Erez Rokah
2020-04-14 11:18:48 +03:00
committed by GitHub
parent 36ae69c96e
commit 166b070cb1
8 changed files with 288 additions and 73 deletions

View File

@ -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;
},
});

View 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,
};