Skip to content

Commit 72ee2f6

Browse files
authored
Fix e2e test config (#50)
- Use yarn glsp repo over npx to start commands (unpinned npx might resolve an unwanted version) - Fix startup for browser only
1 parent c1c6099 commit 72ee2f6

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

examples/workflow-test/configs/utils.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,12 @@ export function getVsixId(): string {
8080

8181
export function findVsixPath(): string {
8282
const subCommand = useWebExtension() ? 'web-vsix-path' : 'vsix-path';
83-
return execSync(`npx glsp repo -d ${getRepoDir()} vscode ${subCommand}`, { encoding: 'utf-8' }).trim();
83+
return execSync(`yarn --silent glsp repo -d ${getRepoDir()} vscode ${subCommand}`, { encoding: 'utf-8' }).trim();
84+
}
85+
86+
export function getBrowserServerBundlePath(): string {
87+
const serverRoot = execSync(`yarn --silent glsp repo -d ${getRepoDir()} server-node pwd`, { encoding: 'utf-8' }).trim();
88+
return path.resolve(serverRoot, 'examples', 'workflow-server-bundled-web', 'wf-glsp-server-webworker.js');
8489
}
8590

8691
function parseRequestedProjects(): ProjectName[] | undefined {

examples/workflow-test/configs/webserver.config.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
1515
********************************************************************************/
1616

17-
import * as path from 'path';
1817
import { PlaywrightTestConfig } from '@playwright/test';
19-
import { ProjectName, getPort, getRepoDir, getRepoPath, needsGlspServer } from './utils';
18+
import * as path from 'path';
19+
import { ProjectName, getBrowserServerBundlePath, getPort, getRepoDir, getRepoPath, needsGlspServer } from './utils';
2020

2121
type WebServerConfig = Extract<NonNullable<PlaywrightTestConfig['webServer']>, unknown[]>[number];
2222

@@ -30,7 +30,7 @@ interface ProjectServerConfig {
3030
export function buildWebServers(activeProjects: ProjectName[]): PlaywrightTestConfig['webServer'] {
3131
// Resolved lazily inside the function: top-level evaluation would run at import time,
3232
// before `dotenv.config()` in playwright.config.ts, so GLSP_REPO_DIR would not be picked up.
33-
const repo = `npx glsp repo -d ${getRepoDir()}`;
33+
const repo = `yarn --silent glsp repo -d ${getRepoDir()}`;
3434
const theiaAppDir = path.resolve(getRepoPath('glsp-theia-integration'), 'examples', 'browser-app');
3535

3636
const GLSP_SERVER_COMMANDS: Record<string, string> = {
@@ -42,7 +42,7 @@ export function buildWebServers(activeProjects: ProjectName[]): PlaywrightTestCo
4242
const standalonePort = getPort('STANDALONE_PORT');
4343
const standaloneBrowserPort = getPort('STANDALONE_BROWSER_PORT');
4444
const theiaPort = getPort('THEIA_PORT');
45-
45+
const browserServerBundle = getBrowserServerBundlePath();
4646
const configs: Partial<Record<ProjectName, ProjectServerConfig>> = {
4747
standalone: {
4848
command: `${repo} client start --external-server --no-open`,
@@ -51,7 +51,7 @@ export function buildWebServers(activeProjects: ProjectName[]): PlaywrightTestCo
5151
path: '/diagram.html'
5252
},
5353
'standalone-browser': {
54-
command: `${repo} client start --browser --no-open`,
54+
command: `${repo} client start --browser --no-open --external-server ${browserServerBundle}`,
5555
port: standaloneBrowserPort,
5656
env: { CLIENT_PORT: String(standaloneBrowserPort) },
5757
path: '/diagram.html'

examples/workflow-test/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"prepare": "playwright install",
3939
"repo": "yarn glsp repo -d .repositories",
4040
"repo:clean": "rimraf .repositories",
41-
"repo:setup": "npx ts-node scripts/setup.ts",
41+
"repo:setup": "ts-node scripts/setup.ts",
4242
"test": "playwright test",
4343
"test:standalone": "yarn test --project=standalone",
4444
"test:standalone-browser": "yarn test --project=standalone-browser",

0 commit comments

Comments
 (0)