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';
const setupSakilaSqlite = async (metaKnex: Knex) => {
const config = metaKnex.client.config;
await metaKnex.destroy();
const rootDir = __dirname.replace(
'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`
const testsDir = __dirname.replace(
'/src/lib/services/test/TestResetService',
'/tests'
);
metaKnex = Knex(config);
console.log('config', config);
const schemaFile = fs
.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();
// console.log('destroyed');
// await metaKnex.client.initializePool(config);
// console.log('initializePool');
// await metaKnex.client.acquireConnection();
// console.log('acquireConnection');
await metaKnex.raw(schemaFile);
await metaKnex.raw(dataFile);
};
export default setupSakilaSqlite;

Loading…
Cancel
Save