Skip to content

Commit

Permalink
Test(repo): Use unified demo app for visual testing
Browse files Browse the repository at this point in the history
  • Loading branch information
literat committed Mar 15, 2024
1 parent 25cff86 commit 8da6463
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions packages/common/constants/servers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@ const SERVERS = {
web: {
host: 'localhost',
https: false,
port: 5172,
port: 3456,
strictPort: true,
path: 'packages/web/',
},
// @see: https://vitejs.dev/config/server-options.html
'web-react': {
host: 'localhost',
https: false,
port: 5173,
port: 3456,
strictPort: true,
path: 'packages/web-react/',
},
'web-twig': {
host: 'localhost',
Expand All @@ -37,16 +39,16 @@ const SERVERS = {
},
},
TESTING: {
web: process.env.DEMO_WEB_URL || 'https://spirit-design-system-demo.netlify.app/',
'web-react': process.env.DEMO_WEB_REACT_URL || 'https://spirit-design-system-react.netlify.app/',
web: `${process.env.WEBSITE_URL || 'https://spirit-design-system.netlify.app'}/packages/web/`,
'web-react': `${process.env.WEBSITE_URL || 'https://spirit-design-system.netlify.app/'}/packages/web-react/`,
'web-twig': process.env.DEMO_WEB_TWIG_URL || '',
},
};

const getDevelopmentEndpointUri = (packageName, { isDocker } = { isDocker: false }) => {
const { https, host, port } = SERVERS.DEVELOPMENT[packageName];
const { https, host, port, path } = SERVERS.DEVELOPMENT[packageName];

return `http${https ? 's' : ''}://${isDocker ? 'host.docker.internal' : host}:${port}`;
return `http${https ? 's' : ''}://${isDocker ? 'host.docker.internal' : host}:${port}/${path}`;
};

module.exports = { SERVERS, getDevelopmentEndpointUri };
2 changes: 1 addition & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default defineConfig({
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',
baseURL: process.env.WEBSITE_URL,

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/demo-components-compare.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { isTesting as isTestingEnvironment } from '@lmc-eu/spirit-common/constants/environments';
import { SERVERS, getDevelopmentEndpointUri } from '@lmc-eu/spirit-common/constants/servers';
import { readdirSync } from 'fs';
import { expect, test } from '@playwright/test';
import { readdirSync } from 'fs';

// Tests that are intentionally broken, but will be fixed in the future
const IGNORED_TESTS = [
Expand Down

0 comments on commit 8da6463

Please sign in to comment.