Browse Source

Merge pull request #6524 from nocodb/chore/one-worker-test

PW Worker count for each dbtype in CI changed
pull/6531/head
Muhammed Mustafa 1 year ago committed by GitHub
parent
commit
87ae30366f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      .github/workflows/ci-cd.yml
  2. 8
      tests/playwright/package.json
  3. 12
      tests/playwright/pages/Dashboard/Form/index.ts
  4. 4
      tests/playwright/pages/Dashboard/Grid/Row.ts
  5. 11
      tests/playwright/playwright.config.ts
  6. 4
      tests/playwright/tests/db/features/undo-redo.spec.ts

10
.github/workflows/ci-cd.yml

@ -130,7 +130,7 @@ jobs:
uses: ./.github/workflows/playwright-test-workflow.yml
with:
db: mysql
shard: 4
shard: 4
playwright-sqlite-1:
needs: pre-build-for-playwright
if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }}
@ -151,14 +151,14 @@ jobs:
uses: ./.github/workflows/playwright-test-workflow.yml
with:
db: sqlite
shard: 3
shard: 3
playwright-sqlite-4:
needs: pre-build-for-playwright
if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }}
uses: ./.github/workflows/playwright-test-workflow.yml
with:
db: sqlite
shard: 4
shard: 4
playwright-pg-shard-1:
needs: pre-build-for-playwright
if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }}
@ -179,11 +179,11 @@ jobs:
uses: ./.github/workflows/playwright-test-workflow.yml
with:
db: pg
shard: 3
shard: 3
playwright-pg-shard-4:
needs: pre-build-for-playwright
if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }}
uses: ./.github/workflows/playwright-test-workflow.yml
with:
db: pg
shard: 4
shard: 4

8
tests/playwright/package.json

@ -30,10 +30,10 @@
"test:debug:watch": "pnpm dlx nodemon -e ts -w ./ -x \"pnpm run test:debug\"",
"test:debug:quick:sqlite": "./startPlayWrightServer.sh; PW_QUICK_TEST=1 PW_TEST_REUSE_CONTEXT=1 PW_TEST_CONNECT_WS_ENDPOINT=ws://127.0.0.1:31000/ PWDEBUG=console pnpm exec playwright test -c playwright.config.ts --headed --project=chromium --retries 0 --timeout 5 --workers 1 --max-failures=1",
"ci:test": "pnpm exec playwright test --workers=2",
"ci:test:shard:1": "pnpm exec playwright test --workers=2 --shard=1/4",
"ci:test:shard:2": "pnpm exec playwright test --workers=2 --shard=2/4",
"ci:test:shard:3": "pnpm exec playwright test --workers=2 --shard=3/4",
"ci:test:shard:4": "pnpm exec playwright test --workers=2 --shard=4/4",
"ci:test:shard:1": "pnpm exec playwright test --shard=1/4",
"ci:test:shard:2": "pnpm exec playwright test --shard=2/4",
"ci:test:shard:3": "pnpm exec playwright test --shard=3/4",
"ci:test:shard:4": "pnpm exec playwright test --shard=4/4",
"ci:test:flaky:repeat": "pnpm exec playwright test --workers=4 --grep @flaky --repeat-each=3",
"ci:test:mysql": "E2E_DB_TYPE=mysql pnpm exec playwright test --workers=2",
"ci:test:pg": "E2E_DB_TYPE=pg pnpm exec playwright test --workers=2",

12
tests/playwright/pages/Dashboard/Form/index.ts

@ -105,6 +105,9 @@ export class FormPage extends BasePage {
}
async reorderFields({ sourceField, destinationField }: { sourceField: string; destinationField: string }) {
// TODO: Otherwise form input boxes are not visible sometimes
await this.rootPage.waitForTimeout(650);
await expect(this.get().locator(`.nc-form-drag-${sourceField}`)).toBeVisible();
await expect(this.get().locator(`.nc-form-drag-${destinationField}`)).toBeVisible();
const src = this.get().locator(`.nc-form-drag-${sourceField.replace(' ', '')}`);
@ -113,6 +116,9 @@ export class FormPage extends BasePage {
}
async removeField({ field, mode }: { mode: string; field: string }) {
// TODO: Otherwise form input boxes are not visible sometimes
await this.rootPage.waitForTimeout(650);
if (mode === 'dragDrop') {
const src = this.get().locator(`.nc-form-drag-${field.replace(' ', '')}`);
const dst = this.get().locator(`[data-testid="nc-drag-n-drop-to-hide"]`);
@ -124,6 +130,9 @@ export class FormPage extends BasePage {
}
async addField({ field, mode }: { mode: string; field: string }) {
// TODO: Otherwise form input boxes are not visible sometimes
await this.rootPage.waitForTimeout(650);
if (mode === 'dragDrop') {
const src = this.get().locator(`[data-testid="nc-form-hidden-column-${field}"] > div.ant-card-body`);
const dst = this.get().locator(`[data-testid="nc-form-input-Country"]`);
@ -138,6 +147,9 @@ export class FormPage extends BasePage {
}
async removeAllFields() {
// TODO: Otherwise form input boxes are not visible sometimes
await this.rootPage.waitForTimeout(1000);
await this.removeAllButton.click();
}

4
tests/playwright/pages/Dashboard/Grid/Row.ts

@ -13,13 +13,13 @@ export class RowPageObject extends BasePage {
return this.rootPage.locator('tr.nc-grid-row');
}
async getRecord(index: number) {
getRecord(index: number) {
return this.get().nth(index);
}
// style="height: 3rem;"
async getRecordHeight(index: number) {
const record = await this.getRecord(index);
const record = this.getRecord(index);
const style = await record.getAttribute('style');
return style.split(':')[1].split(';')[0].trim();
}

11
tests/playwright/playwright.config.ts

@ -10,6 +10,14 @@ require('dotenv').config();
* See https://playwright.dev/docs/test-configuration.
*/
let workers = 4;
if (process.env.CI) {
if (process.env.E2E_DB_TYPE === 'sqlite') workers = 1;
if (process.env.E2E_DB_TYPE === 'mysql') workers = 3;
if (process.env.E2E_DB_TYPE === 'pg') workers = 3;
}
export default defineConfig({
testDir: process.env.PW_QUICK_TEST ? './quickTests' : './tests',
/* Maximum time one test can run for. */
@ -29,8 +37,7 @@ export default defineConfig({
/* Retry on CI only */
retries: process.env.CI ? 3 : 0,
/* Opt out of parallel tests on CI. */
// workers: process.env.CI ? 2 : 4,
workers: process.env.CI ? 2 : 4,
workers: workers,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */

4
tests/playwright/tests/db/features/undo-redo.spec.ts

@ -294,9 +294,7 @@ test.describe('Undo Redo', () => {
test('Row height', async ({ page }) => {
async function verifyRowHeight({ height }: { height: string }) {
await dashboard.grid.rowPage.getRecordHeight(0).then(readValue => {
expect(readValue).toBe(height);
});
await expect(dashboard.grid.rowPage.getRecord(0)).toHaveAttribute('style', `height: ${height};`);
}
// close 'Team & Auth' tab

Loading…
Cancel
Save