Browse Source

feat(testing): Added different db support

pull/3848/head
Muhammed Mustafa 2 years ago
parent
commit
6e575348c8
  1. 5
      scripts/playwright/package.json
  2. 2
      scripts/playwright/pages/ExpandedForm/index.ts
  3. 1
      scripts/playwright/pages/Grid.ts
  4. 6
      scripts/playwright/setup/index.ts

5
scripts/playwright/package.json

@ -4,8 +4,9 @@
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"test": "npx playwright test", "test": "npx playwright test --workers=6",
"test-debug": "npx playwright test -c playwright.config.ts test --headed --project=chromium --repeat-each 1 --retries 0 --timeout 0 --workers 1 --max-failures=1" "test-debug": "PWDEBUG=console npx playwright test -c playwright.config.ts test --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"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",

2
scripts/playwright/pages/ExpandedForm/index.ts

@ -33,6 +33,6 @@ export class ExpandedFormPage {
await this.get().press('Escape'); await this.get().press('Escape');
await this.get().waitFor({state: 'hidden'}); await this.get().waitFor({state: 'hidden'});
await this.base.toastWait({message: `updated successfully.`}); await this.base.toastWait({message: `updated successfully.`});
await this.page.waitForTimeout(400); await this.page.locator('[pw-data="grid-load-spinner"]').waitFor({ state: 'hidden' });
} }
} }

1
scripts/playwright/pages/Grid.ts

@ -56,6 +56,7 @@ export class GridPage {
// Click text=Delete Row // Click text=Delete Row
await this.page.locator('text=Delete Row').click(); await this.page.locator('text=Delete Row').click();
await this.page.locator('span.ant-dropdown-menu-title-content > nc-project-menu-item').waitFor({state: 'hidden'}); await this.page.locator('span.ant-dropdown-menu-title-content > nc-project-menu-item').waitFor({state: 'hidden'});
await this.page.waitForTimeout(300);
} }
async openExpandedRow({index}:{index: number}) { async openExpandedRow({index}:{index: number}) {

6
scripts/playwright/setup/index.ts

@ -2,9 +2,11 @@ import { Page, TestInfo } from '@playwright/test';
import axios from 'axios'; import axios from 'axios';
import { DashboardPage } from '../pages/Dashboard'; import { DashboardPage } from '../pages/Dashboard';
const setup = async ({page}: {page: Page}) => { const setup = async ({page, typeOnLocalSetup}: {page: Page, typeOnLocalSetup?: string}) => {
const type = process.env.CI ? process.env.E2E_TYPE : typeOnLocalSetup;
const response = await axios.post(`http://localhost:8080/api/v1/meta/test/reset`, { const response = await axios.post(`http://localhost:8080/api/v1/meta/test/reset`, {
parallelId: process.env.TEST_PARALLEL_INDEX parallelId: process.env.TEST_PARALLEL_INDEX,
type: type ?? 'sqlite',
}); });
if(response.status !== 200) { if(response.status !== 200) {

Loading…
Cancel
Save