mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-04 07:05:41 +00:00 
			
		
		
		
	[CI] Playwright improvements (#9395)
* Allow port 4173 (vite preview) * Change 'base' attr based on vite command * Allow api_host to be specified separately * Harden API host functionality * Adjust server selections * Cleanup vite.config.ts * Adjust playwright configuration - Allow to run in "production" mode - Builds the code first - Runs only the backend web server - Not suitable for coverage * Tweak github actions * Tweak QC file * Reduce number of steps * Tweak CI file * Fix typo * Ensure translation before build * Fix hard-coded test * Test tweaks * uncomment * Revert some changes * Run with gunicorn, single worker * Reduce log output in DEBUG mode * Update deps * Add global-setup func * Fix for .gitignore file * Cached auth state * Tweak login func * Updated tests * Enable parallel workers again * Simplify config * Try with a single worker again * Single retry mode * Run auth setup first - Prevent issues with parallel test doing login * Improve test setup process * Tweaks * Bump to 3 workers * Tweak playwright settings * Revert change * Revert change
This commit is contained in:
		
							
								
								
									
										28
									
								
								.github/workflows/qc_checks.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										28
									
								
								.github/workflows/qc_checks.yaml
									
									
									
									
										vendored
									
									
								
							@@ -554,7 +554,7 @@ jobs:
 | 
			
		||||
          chmod +rw /home/runner/work/InvenTree/db.sqlite3
 | 
			
		||||
          invoke migrate
 | 
			
		||||
 | 
			
		||||
  platform_ui:
 | 
			
		||||
  web_ui:
 | 
			
		||||
    name: Tests - Web UI
 | 
			
		||||
    runs-on: ubuntu-24.04
 | 
			
		||||
    timeout-minutes: 60
 | 
			
		||||
@@ -584,7 +584,6 @@ jobs:
 | 
			
		||||
      INVENTREE_DB_PASSWORD: inventree_password
 | 
			
		||||
      INVENTREE_DEBUG: true
 | 
			
		||||
      INVENTREE_PLUGINS_ENABLED: false
 | 
			
		||||
      VITE_COVERAGE: true
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4.2.2
 | 
			
		||||
@@ -599,13 +598,19 @@ jobs:
 | 
			
		||||
          apt-dependency: postgresql-client libpq-dev
 | 
			
		||||
          pip-dependency: psycopg2
 | 
			
		||||
      - name: Set up test data
 | 
			
		||||
        run: invoke dev.setup-test -iv
 | 
			
		||||
      - name: Rebuild thumbnails
 | 
			
		||||
        run: invoke int.rebuild-thumbnails
 | 
			
		||||
        run: |
 | 
			
		||||
          invoke dev.setup-test -iv
 | 
			
		||||
          invoke int.rebuild-thumbnails
 | 
			
		||||
      - name: Install dependencies
 | 
			
		||||
        run: invoke int.frontend-compile
 | 
			
		||||
      - name: Install Playwright Browsers
 | 
			
		||||
        run: cd src/frontend && npx playwright install --with-deps
 | 
			
		||||
        run: |
 | 
			
		||||
          invoke int.frontend-compile
 | 
			
		||||
          cd src/frontend && npx playwright install --with-deps
 | 
			
		||||
      - name: Set Production Mode
 | 
			
		||||
        if: github.event_name == 'pull_request'
 | 
			
		||||
        run: echo "VITE_PRODUCTION_BUILD=true" >> $GITHUB_ENV
 | 
			
		||||
      - name: Set Coverage Mode
 | 
			
		||||
        if: github.event_name != 'pull_request'
 | 
			
		||||
        run: echo "VITE_COVERAGE_BUILD=true" >> $GITHUB_ENV
 | 
			
		||||
      - name: Run Playwright tests
 | 
			
		||||
        id: tests
 | 
			
		||||
        run: cd src/frontend && npx nyc playwright test
 | 
			
		||||
@@ -616,16 +621,17 @@ jobs:
 | 
			
		||||
          path: src/frontend/playwright-report/
 | 
			
		||||
          retention-days: 14
 | 
			
		||||
      - name: Report coverage
 | 
			
		||||
        if: always()
 | 
			
		||||
        if: github.event_name != 'pull_request'
 | 
			
		||||
        run: cd src/frontend && npx nyc report --report-dir ./coverage --temp-dir .nyc_output --reporter=lcov --exclude-after-remap false
 | 
			
		||||
      - name: Upload coverage reports to Codecov
 | 
			
		||||
        uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # pin@v5.4.0
 | 
			
		||||
        if: always()
 | 
			
		||||
        if: github.event_name != 'pull_request'
 | 
			
		||||
        with:
 | 
			
		||||
          token: ${{ secrets.CODECOV_TOKEN }}
 | 
			
		||||
          slug: inventree/InvenTree
 | 
			
		||||
          flags: web
 | 
			
		||||
      - name: Upload bundler info
 | 
			
		||||
        if: github.event_name != 'pull_request'
 | 
			
		||||
        env:
 | 
			
		||||
          CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
 | 
			
		||||
        run: |
 | 
			
		||||
@@ -633,7 +639,7 @@ jobs:
 | 
			
		||||
          yarn install
 | 
			
		||||
          yarn run build
 | 
			
		||||
 | 
			
		||||
  platform_ui_build:
 | 
			
		||||
  web_ui_build:
 | 
			
		||||
    name: Build - Web UI
 | 
			
		||||
    runs-on: ubuntu-24.04
 | 
			
		||||
    timeout-minutes: 60
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user