Browse Source

feat(testing): Improved multi db support

pull/3848/head
Muhammed Mustafa 2 years ago
parent
commit
0b87b3527a
  1. 1
      scripts/playwright/.env.example
  2. 1
      scripts/playwright/.gitignore
  3. 16
      scripts/playwright/package-lock.json
  4. 3
      scripts/playwright/package.json
  5. 2
      scripts/playwright/playwright.config.ts
  6. 4
      scripts/playwright/setup/index.ts

1
scripts/playwright/.env.example

@ -0,0 +1 @@
E2E_DEV_DB_TYPE=sqlite

1
scripts/playwright/.gitignore vendored

@ -2,3 +2,4 @@ node_modules/
/test-results/
/playwright-report/
/playwright/.cache/
.env

16
scripts/playwright/package-lock.json generated

@ -11,6 +11,7 @@
"devDependencies": {
"@playwright/test": "^1.26.1",
"axios": "^0.24.0",
"dotenv": "^16.0.3",
"mysql2": "^2.3.3",
"promised-sqlite3": "^1.2.0"
}
@ -137,6 +138,15 @@
"node": ">=0.10"
}
},
"node_modules/dotenv": {
"version": "16.0.3",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz",
"integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==",
"dev": true,
"engines": {
"node": ">=12"
}
},
"node_modules/emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
@ -1046,6 +1056,12 @@
"integrity": "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==",
"dev": true
},
"dotenv": {
"version": "16.0.3",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz",
"integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==",
"dev": true
},
"emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",

3
scripts/playwright/package.json

@ -6,7 +6,7 @@
"scripts": {
"test": "npx playwright test --workers=4",
"test-debug": "./startPlayWrightServer.sh; PW_TEST_REUSE_CONTEXT=1 PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:3010/ npx playwright test -c playwright.config.ts --headed --project=chromium --repeat-each 1 --retries 0 --timeout 0 --workers 1 --max-failures=1",
"ci-test-mysql": "E2E_TYPE=mysql npx playwright test --workers=2"
"ci-test-mysql": "E2E_DB_TYPE=mysql npx playwright test --workers=2"
},
"keywords": [],
"author": "",
@ -14,6 +14,7 @@
"devDependencies": {
"@playwright/test": "^1.26.1",
"axios": "^0.24.0",
"dotenv": "^16.0.3",
"mysql2": "^2.3.3",
"promised-sqlite3": "^1.2.0"
}

2
scripts/playwright/playwright.config.ts

@ -5,7 +5,7 @@ import { devices } from '@playwright/test';
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();
require('dotenv').config();
/**
* See https://playwright.dev/docs/test-configuration.

4
scripts/playwright/setup/index.ts

@ -7,8 +7,8 @@ export interface NcContext {
dbType?: string;
}
const setup = async ({page, typeOnLocalSetup}: {page: Page, typeOnLocalSetup?: string}): Promise<NcContext> => {
let dbType = process.env.CI ? process.env.E2E_TYPE : typeOnLocalSetup;
const setup = async ({page}: {page: Page}): Promise<NcContext> => {
let dbType = process.env.CI ? process.env.E2E_DB_TYPE : process.env.E2E_DEV_DB_TYPE;
dbType = dbType || 'mysql';
const response = await axios.post(`http://localhost:8080/api/v1/meta/test/reset`, {

Loading…
Cancel
Save