diff --git a/.github/workflows/playwright-test-workflow.yml b/.github/workflows/playwright-test-workflow.yml index f2b8b92fca..c081910a21 100644 --- a/.github/workflows/playwright-test-workflow.yml +++ b/.github/workflows/playwright-test-workflow.yml @@ -14,6 +14,7 @@ on: jobs: playwright: runs-on: ubuntu-20.04 + timeout-minutes: 30 steps: # Reference: https://github.com/pierotofy/set-swap-space/blob/master/action.yml - name: Set 5gb swap @@ -55,34 +56,36 @@ jobs: - name: setup mysql if: ${{ inputs.db == 'mysql' }} working-directory: ./ - run: docker-compose -f ./packages/nc-gui/tests/playwright/scripts/docker-compose-mysql-playwright.yml up -d & + run: docker-compose -f ./tests/playwright/scripts/docker-compose-mysql-playwright.yml up -d & - name: setup pg if: ${{ inputs.db == 'pg' }} working-directory: ./ - run: docker-compose -f ./packages/nc-gui/tests/playwright/scripts/docker-compose-playwright-pg.yml up -d & + run: docker-compose -f ./tests/playwright/scripts/docker-compose-playwright-pg.yml up -d & - name: setup pg for quick tests if: ${{ inputs.db == 'sqlite' && inputs.shard == '1' }} working-directory: ./ - run: docker-compose -f ./packages/nc-gui/tests/playwright/scripts/docker-compose-pg-pw-quick.yml up -d & + run: docker-compose -f ./tests/playwright/scripts/docker-compose-pg-pw-quick.yml up -d & - name: run frontend working-directory: ./packages/nc-gui run: npm run ci:run - name: Run backend working-directory: ./packages/nocodb - run: npm run ci:run & + run: | + npm install + npm run watch:run:playwright > ${{ inputs.db }}_${{ inputs.shard }}_test_backend.log & - name: Cache playwright npm modules uses: actions/cache@v3 id: playwright-cache with: path: | - **/playwright/node_modules - key: cache-nc-playwright-${{ hashFiles('**/playwright/package-lock.json') }} + **/tests/playwright/node_modules + key: cache-nc-playwright-${{ hashFiles('**/tests/playwright/package-lock.json') }} - name: Install dependencies if: steps.playwright-cache.outputs.cache-hit != 'true' - working-directory: ./packages/nc-gui/tests/playwright + working-directory: ./tests/playwright run: npm install - name: Install Playwright Browsers - working-directory: ./packages/nc-gui/tests/playwright + working-directory: ./tests/playwright run: npx playwright install chromium --with-deps - name: Wait for backend run: | @@ -92,7 +95,7 @@ jobs: done - name: Run Playwright tests - working-directory: ./packages/nc-gui/tests/playwright + working-directory: ./tests/playwright run: E2E_DB_TYPE=${{ inputs.db }} npm run ci:test:shard:${{ inputs.shard }} # Quick tests (pg on sqlite shard 0 and sqlite on sqlite shard 1) @@ -102,26 +105,43 @@ jobs: run: | kill -9 $(lsof -t -i:8080) npm run watch:run:playwright:pg:cyquick & - cd ../nc-gui/tests/playwright - npm run test:quick - name: Run quick server and tests (sqlite) if: ${{ inputs.db == 'sqlite' && inputs.shard == '2' }} working-directory: ./packages/nocodb run: | kill -9 $(lsof -t -i:8080) - npm run watch:run:playwright:quick & - cd ../nc-gui/tests/playwright - npm run test:quick - + npm run watch:run:playwright:quick > quick_${{ inputs.shard }}_test_backend.log & + - name: Wait for backend & run quick tests + if: ${{ inputs.db == 'sqlite' }} + working-directory: ./tests/playwright + run: | + while ! curl --output /dev/null --silent --head --fail http://localhost:8080; do + printf '.' + sleep 2 + done + PLAYWRIGHT_HTML_REPORT=playwright-report-quick npm run test:quick + - uses: actions/upload-artifact@v3 + if: ${{ inputs.db == 'sqlite' }} + with: + name: quick-backend-log-${{ inputs.shard }} + path: ./packages/nocodb/quick_${{ inputs.shard }}_test_backend.log + retention-days: 2 + - uses: actions/upload-artifact@v3 + if: ${{ inputs.db == 'sqlite' }} + with: + name: playwright-report-quick-${{ inputs.shard }} + path: ./tests/playwright/playwright-report-quick/ + retention-days: 2 + - uses: actions/upload-artifact@v3 if: always() with: name: playwright-report-${{ inputs.db }}-${{ inputs.shard }} - path: ./packages/nc-gui/tests/playwright/playwright-report/ + path: ./tests/playwright/playwright-report/ retention-days: 2 - uses: actions/upload-artifact@v3 if: always() with: name: backend-logs-${{ inputs.db }}-${{ inputs.shard }} - path: ./packages/nocodb/mysql_test_backend.log + path: ./packages/nocodb/${{ inputs.db }}_${{ inputs.shard }}_test_backend.log retention-days: 2 \ No newline at end of file diff --git a/package.json b/package.json index b2ffc567ca..6e6296ac11 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ ] }, "scripts": { - "lint:staged:playwright": "cd packages/nc-gui/tests/playwright; npx lint-staged; cd -", + "lint:staged:playwright": "cd ./tests/playwright; npx lint-staged; cd -", "build:common": "cd ./packages/nocodb-sdk; npm install; npm run build", "install:common": "cd ./packages/nocodb; npm install ../nocodb-sdk; cd ../nc-gui; npm install ../nocodb-sdk", "start:api": "npm run build:common ; cd ./packages/nocodb; npm install ../nocodb-sdk; npm install; NC_DISABLE_CACHE=true NC_DISABLE_TELE=true npm run watch:run:cypress", diff --git a/packages/nc-gui/components/cell/MultiSelect.vue b/packages/nc-gui/components/cell/MultiSelect.vue index 2bffd5ff04..0da8f1f871 100644 --- a/packages/nc-gui/components/cell/MultiSelect.vue +++ b/packages/nc-gui/components/cell/MultiSelect.vue @@ -155,7 +155,7 @@ watch(isOpen, (n, _o) => { v-for="op of options" :key="op.id" :value="op.title" - :data-nc="`select-option-${column.title}-${rowIndex}`" + :data-testid="`select-option-${column.title}-${rowIndex}`" @click.stop > diff --git a/packages/nc-gui/components/cell/SingleSelect.vue b/packages/nc-gui/components/cell/SingleSelect.vue index 53e7579a31..cb9258505c 100644 --- a/packages/nc-gui/components/cell/SingleSelect.vue +++ b/packages/nc-gui/components/cell/SingleSelect.vue @@ -86,7 +86,7 @@ watch(isOpen, (n, _o) => { v-for="op of options" :key="op.title" :value="op.title" - :data-nc="`select-option-${column.title}-${rowIndex}`" + :data-testid="`select-option-${column.title}-${rowIndex}`" @click.stop > diff --git a/packages/nc-gui/components/cell/attachment/index.vue b/packages/nc-gui/components/cell/attachment/index.vue index 0541f60272..f4be61efd5 100644 --- a/packages/nc-gui/components/cell/attachment/index.vue +++ b/packages/nc-gui/components/cell/attachment/index.vue @@ -161,7 +161,7 @@ watch( v-if="!isReadonly" :class="{ 'mx-auto px-4': !visibleItems.length }" class="group cursor-pointer flex gap-1 items-center active:(ring ring-accent ring-opacity-100) rounded border-1 p-1 shadow-sm hover:(bg-primary bg-opacity-10) dark:(!bg-slate-500)" - data-nc="attachment-cell-file-picker-button" + data-testid="attachment-cell-file-picker-button" @click.stop="open" > diff --git a/packages/nc-gui/components/dashboard/TreeView.vue b/packages/nc-gui/components/dashboard/TreeView.vue index f57eaabfc4..1d6d5ea031 100644 --- a/packages/nc-gui/components/dashboard/TreeView.vue +++ b/packages/nc-gui/components/dashboard/TreeView.vue @@ -331,13 +331,13 @@ const onSearchCloseIconClick = () => { class="nc-tree-item text-sm cursor-pointer group" :data-order="table.order" :data-id="table.id" - :data-nc="`tree-view-table-${table.title}`" + :data-testid="`tree-view-table-${table.title}`" @click="addTableTab(table)" >
-
+
{