Browse Source

fix(test): Moved playwright folder from nc-gui

pull/4376/head
Muhammed Mustafa 2 years ago
parent
commit
b5b72e6fac
  1. 22
      .github/workflows/playwright-test-workflow.yml
  2. 8
      tests/playwright/README.md

22
.github/workflows/playwright-test-workflow.yml

@ -56,15 +56,15 @@ 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
@ -78,14 +78,14 @@ jobs:
id: playwright-cache
with:
path: |
**/packages/nc-gui/tests/playwright/node_modules
key: cache-nc-playwright-${{ hashFiles('**/packages/nc-gui/tests/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: |
@ -95,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)
@ -113,7 +113,7 @@ jobs:
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: ./packages/nc-gui/tests/playwright
working-directory: ./tests/playwright
run: |
while ! curl --output /dev/null --silent --head --fail http://localhost:8080; do
printf '.'
@ -130,14 +130,14 @@ jobs:
if: ${{ inputs.db == 'sqlite' }}
with:
name: playwright-report-quick-${{ inputs.shard }}
path: ./packages/nc-gui/tests/playwright/playwright-report-quick/
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()

8
tests/playwright/README.md

@ -2,7 +2,7 @@
## Setup
Make sure to install the dependencies(in the playwright folder):
Make sure to install the dependencies(in the playwright folder, which is `./tests/playwright`):
```bash
npm install
@ -47,13 +47,13 @@ npm run test:debug
For setting up mysql:
```bash
docker-compose -f ./packages/nc-gui/tests/playwright/scripts/docker-compose-mysql-playwright.yml up -d
docker-compose -f ./tests/playwright/scripts/docker-compose-mysql-playwright.yml up -d
```
For setting up postgres:
```bash
docker-compose -f ./packages/nc-gui/tests/playwright/scripts/docker-compose-playwright-pg.yml
docker-compose -f ./tests/playwright/scripts/docker-compose-playwright-pg.yml
```
### Running individual tests
@ -93,7 +93,7 @@ It will have run button beside each test in the file.
- Do not add any logic to the tests. Instead, create a page object for the page you are testing.
All the selection, UI actions and assertions should be in the page object.
Page objects should be in `packages/nc-gui/tests/playwright/pages` folder.
Page objects should be in `./tests/playwright/pages` folder.
## Verify if tests are not flaky

Loading…
Cancel
Save