2021-06-14 23:44:43 +05:30
|
|
|
// ***********************************************************
|
|
|
|
// This example plugins/index.js can be used to load plugins
|
|
|
|
//
|
|
|
|
// You can change the location of this file or turn off loading
|
|
|
|
// the plugins file with the 'pluginsFile' configuration option.
|
|
|
|
//
|
|
|
|
// You can read more here:
|
|
|
|
// https://on.cypress.io/plugins-guide
|
|
|
|
// ***********************************************************
|
2021-06-14 18:37:52 +02:00
|
|
|
|
2021-06-14 23:44:43 +05:30
|
|
|
// This function is called when a project is opened or re-opened (e.g. due to
|
|
|
|
// the project's config changing)
|
|
|
|
/* eslint-disable no-unused-vars */
|
2021-08-24 20:26:48 +02:00
|
|
|
|
|
|
|
const { execSync } = require('child_process');
|
|
|
|
const { existsSync } = require('fs');
|
2021-11-29 19:30:28 +01:00
|
|
|
require('dotenv').config();
|
2021-08-24 20:26:48 +02:00
|
|
|
|
2021-06-14 23:44:43 +05:30
|
|
|
module.exports = (on, config) => {
|
2021-11-29 19:30:28 +01:00
|
|
|
// `on` is used to hook into various events Cypress emits
|
|
|
|
// `config` is the resolved Cypress config
|
|
|
|
config.env = config.env || {};
|
2021-08-24 20:26:48 +02:00
|
|
|
on('before:run', () => {
|
|
|
|
if (!existsSync('../../config/curriculum.json')) {
|
|
|
|
execSync('npm run build:curriculum');
|
|
|
|
}
|
|
|
|
});
|
2021-11-29 19:30:28 +01:00
|
|
|
|
2022-01-18 16:52:49 +02:00
|
|
|
config.env.API_LOCATION = process.env.API_LOCATION;
|
2021-11-29 19:30:28 +01:00
|
|
|
return config;
|
2019-10-05 23:38:38 +01:00
|
|
|
};
|