39 lines
1.4 KiB
Plaintext
39 lines
1.4 KiB
Plaintext
import { defineConfig } from '@playwright/test';
|
|
import { nxE2EPreset } from '@nx/playwright/preset';
|
|
<% if(!webServerCommand || !webServerAddress) { %>// eslint-disable-next-line @typescript-eslint/no-unused-vars <% } %>
|
|
import { workspaceRoot } from '@nx/devkit';
|
|
|
|
// For CI, you may want to set BASE_URL to the deployed application.
|
|
const baseURL = process.env['BASE_URL'] || '<% if(webServerAddress) {%><%= webServerAddress %><% } else {%>http://localhost:3000<% } %>';
|
|
|
|
/**
|
|
* Read environment variables from file.
|
|
* https://github.com/motdotla/dotenv
|
|
*/
|
|
// require('dotenv').config();
|
|
|
|
/**
|
|
* See https://playwright.dev/docs/test-configuration.
|
|
*/
|
|
export default defineConfig({
|
|
...nxE2EPreset(__filename, { testDir: './<%= directory %>' }),
|
|
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
|
use: {
|
|
baseURL,
|
|
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
|
trace: 'on-first-retry',
|
|
},
|
|
/* Run your local dev server before starting the tests */<% if(webServerCommand && webServerAddress) {%>
|
|
webServer: {
|
|
command: '<%= webServerCommand %>',
|
|
url: '<%= webServerAddress %>',
|
|
reuseExistingServer: !process.env.CI,
|
|
cwd: workspaceRoot
|
|
},<% } else {%>// webServer: {
|
|
// command: 'npm run start',
|
|
// url: 'http://127.0.0.1:3000',
|
|
// reuseExistingServer: !process.env.CI,
|
|
// cwd: workspaceRoot,
|
|
// },<% } %>
|
|
});
|