Browse Source

feat(testing): Fixed CI config for playwright

pull/3848/head
Muhammed Mustafa 2 years ago
parent
commit
5fe1ee53dc
  1. 31
      packages/nocodb/src/lib/services/test/TestResetService/setupSakilaSqlite.ts

31
packages/nocodb/src/lib/services/test/TestResetService/setupSakilaSqlite.ts

@ -2,29 +2,20 @@ import fs from 'fs';
import Knex from 'knex'; import Knex from 'knex';
const setupSakilaSqlite = async (metaKnex: Knex) => { const setupSakilaSqlite = async (metaKnex: Knex) => {
const config = metaKnex.client.config; const testsDir = __dirname.replace(
await metaKnex.destroy(); '/src/lib/services/test/TestResetService',
const rootDir = __dirname.replace( '/tests'
'packages/nocodb/src/lib/services/test/TestResetService',
''
);
if (fs.existsSync(`${rootDir}/packages/nocodb/test_noco.db`)) {
fs.unlinkSync(`${rootDir}/packages/nocodb/test_noco.db`);
}
fs.copyFileSync(
`${rootDir}/scripts/cypress/fixtures/sqlite-sakila/sakila.db`,
`${rootDir}/packages/nocodb/test_noco.db`
); );
metaKnex = Knex(config); const schemaFile = fs
console.log('config', config); .readFileSync(`${testsDir}/pg-sakila-db/01-sqlite-sakila-schema.sql`)
.toString();
const dataFile = fs
.readFileSync(`${testsDir}/pg-sakila-db/02-sqlite-sakila-insert-data.sql`)
.toString();
// await metaKnex.client.destroy(); await metaKnex.raw(schemaFile);
// console.log('destroyed'); await metaKnex.raw(dataFile);
// await metaKnex.client.initializePool(config);
// console.log('initializePool');
// await metaKnex.client.acquireConnection();
// console.log('acquireConnection');
}; };
export default setupSakilaSqlite; export default setupSakilaSqlite;

Loading…
Cancel
Save