|
| 1 | +/* |
| 2 | + * Copyright 2023 The Backstage Authors |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +import { defineConfig } from '@playwright/test'; |
| 18 | +import { generateProjects } from '@backstage/e2e-test-utils/playwright'; |
| 19 | + |
| 20 | +/** |
| 21 | + * See https://playwright.dev/docs/test-configuration. |
| 22 | + */ |
| 23 | +export default defineConfig({ |
| 24 | + timeout: 30_000, |
| 25 | + |
| 26 | + expect: { |
| 27 | + timeout: 5_000, |
| 28 | + }, |
| 29 | + |
| 30 | + // Run your local dev server before starting the tests |
| 31 | + webServer: process.env.CI |
| 32 | + ? [] |
| 33 | + : [ |
| 34 | + { |
| 35 | + command: 'yarn start', |
| 36 | + port: 3000, |
| 37 | + reuseExistingServer: true, |
| 38 | + timeout: 60_000, |
| 39 | + }, |
| 40 | + // TODO: Before encouraging e2e tests for backend we'll want to provide better utilities for mocking auth |
| 41 | + // { |
| 42 | + // command: 'yarn start-backend', |
| 43 | + // port: 7007, |
| 44 | + // reuseExistingServer: true, |
| 45 | + // timeout: 60_000, |
| 46 | + // }, |
| 47 | + ], |
| 48 | + |
| 49 | + forbidOnly: !!process.env.CI, |
| 50 | + |
| 51 | + retries: process.env.CI ? 2 : 0, |
| 52 | + |
| 53 | + reporter: [['html', { open: 'never', outputFolder: 'e2e-test-report' }]], |
| 54 | + |
| 55 | + use: { |
| 56 | + actionTimeout: 0, |
| 57 | + baseURL: |
| 58 | + process.env.PLAYWRIGHT_URL ?? |
| 59 | + (process.env.CI ? 'http://localhost:7007' : 'http://localhost:3000'), |
| 60 | + screenshot: 'only-on-failure', |
| 61 | + trace: 'on-first-retry', |
| 62 | + }, |
| 63 | + |
| 64 | + outputDir: 'node_modules/.cache/e2e-test-results', |
| 65 | + |
| 66 | + projects: generateProjects(), // Find all packages with e2e-test folders |
| 67 | +}); |
0 commit comments