Browse Source

feat(testing): Fixed CI config for playwright

pull/3848/head
Muhammed Mustafa 2 years ago
parent
commit
3c39515f63
  1. 46
      packages/nocodb/src/lib/services/test/TestResetService/createProjects.ts
  2. 7
      packages/nocodb/src/lib/services/test/TestResetService/index.ts
  3. 2
      scripts/playwright/playwright.config.ts
  4. 1
      scripts/playwright/setup/index.ts

46
packages/nocodb/src/lib/services/test/TestResetService/createProjects.ts

@ -1,27 +1,27 @@
import axios from 'axios';
const extPgProject = {
title: 'pgExtREST',
bases: [
{
type: 'pg',
config: {
client: 'pg',
connection: {
host: 'localhost',
port: '5432',
user: 'postgres',
password: 'password',
database: 'postgres',
},
searchPath: ['public'],
},
inflection_column: 'camelize',
inflection_table: 'camelize',
},
],
external: true,
};
// const extPgProject = {
// title: 'pgExtREST',
// bases: [
// {
// type: 'pg',
// config: {
// client: 'pg',
// connection: {
// host: 'localhost',
// port: '5432',
// user: 'postgres',
// password: 'password',
// database: 'postgres',
// },
// searchPath: ['public'],
// },
// inflection_column: 'camelize',
// inflection_table: 'camelize',
// },
// ],
// external: true,
// };
const extMysqlProject = {
title: 'externalREST',
@ -47,7 +47,7 @@ const extMysqlProject = {
const createProjects = async (token) => {
return await Promise.all(
[extPgProject, extMysqlProject].map(async (projectAttr) => {
[extMysqlProject].map(async (projectAttr) => {
const response = await axios.post(
'http://localhost:8080/api/v1/db/meta/projects/',
projectAttr,

7
packages/nocodb/src/lib/services/test/TestResetService/index.ts

@ -4,7 +4,6 @@ import Knex from 'knex';
import NocoCache from '../../../cache/NocoCache';
import NcConnectionMgrv2 from '../../../utils/common/NcConnectionMgrv2';
import createProjects from './createProjects';
import { isPgSakilaToBeReset, resetPgSakila } from './resetPgSakila';
import createUser from './createUser';
import resetMeta from './resetMeta';
import { isMysqlSakilaToBeReset, resetMysqlSakila } from './resetMysqlSakila';
@ -20,9 +19,9 @@ export class TestResetService {
try {
await NcConnectionMgrv2.destroyAll();
if (await isPgSakilaToBeReset()) {
await resetPgSakila();
}
// if (await isPgSakilaToBeReset()) {
// await resetPgSakila();
// }
if (await isMysqlSakilaToBeReset()) {
await resetMysqlSakila();

2
scripts/playwright/playwright.config.ts

@ -96,7 +96,7 @@ const config: PlaywrightTestConfig = {
],
/* Folder for test artifacts such as screenshots, videos, traces, etc. */
outputDir: './playwright-report',
outputDir: './output',
/* Run your local dev server before starting the tests */
// webServer: {

1
scripts/playwright/setup/index.ts

@ -4,6 +4,7 @@ import { DashboardPage } from '../pages/Dashboard';
const setup = async ({page}: {page: Page}) => {
const response = await axios.get('http://localhost:8080/api/v1/meta/test/reset');
console.log("setup:res:", response);
if(response.status !== 200) {
console.error('Failed to reset test data', response);
throw new Error('Failed to reset test data');

Loading…
Cancel
Save