Skip to content

Commit 2cfa45a

Browse files
committed
tmp openvscode server
1 parent 85db8f1 commit 2cfa45a

File tree

5 files changed

+42
-41
lines changed

5 files changed

+42
-41
lines changed

build/integration/openvscode-server/Jenkinsfile

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
pipeline {
22
agent any
33

4+
tools {
5+
jdk 'temurin-jdk-21.0.6.7'
6+
maven '3.9'
7+
}
8+
49
options {
510
buildDiscarder(logRotator(numToKeepStr: '60', artifactNumToKeepStr: '2'))
611
disableConcurrentBuilds()
@@ -14,38 +19,42 @@ pipeline {
1419
string(name: 'engineDownloadUrl', defaultValue: 'https://jenkins.ivyteam.io/job/core_product-engine/job/master/lastSuccessfulBuild/artifact/workspace/ch.ivyteam.ivy.server.product/target/products/*_Slim_*.zip/*zip*/products.zip', description: 'engine that will be packaged')
1520
}
1621

22+
environment {
23+
JAVA_OPTS_IVY_SYSTEM = '-Divy.engine.testheadless=true'
24+
CI = 'true'
25+
RUN_IN_BRWOSER = 'true'
26+
}
27+
1728
stages {
1829
stage('Build') {
19-
agent {
20-
dockerfile {
21-
filename 'build/Dockerfile'
22-
reuseNode true
23-
}
24-
}
25-
2630
steps {
2731
script {
28-
sh 'npm run update:axonivy:next'
29-
sh 'npm install'
30-
sh 'npm run build:production'
31-
sh 'npm run download:engine ' + params.engineDownloadUrl
32-
sh 'npm run package'
32+
nodejs(nodeJSInstallationName: '22.11.0') {
33+
sh 'npm run update:axonivy:next'
34+
sh 'npm install'
35+
sh 'npm run build:production'
36+
sh 'npm run download:engine ' + params.engineDownloadUrl
37+
sh 'wget https://github.com/gitpod-io/openvscode-server/releases/download/openvscode-server-v1.96.4/openvscode-server-v1.96.4-linux-arm64.tar.gz'
38+
sh 'tar -xzf openvscode-server-v1.96.4-linux-arm64.tar.gz'
39+
sh 'cp -r extension/. openvscode-server-v1.96.4-linux-arm64/extensions/extension'
40+
sh 'nohup extension/AxonIvyEngine/bin/AxonIvyEngine &'
41+
sh 'nohup openvscode-server-v1.96.4-linux-arm64/bin/openvscode-server --host 0.0.0.0 --without-connection-token --disable-workspace-trust &'
42+
sh 'npx playwright install --with-deps chromium'
43+
}
3344
}
3445
}
3546
}
3647

3748
stage('Playwright Tests') {
3849
steps {
3950
script {
40-
docker.build('openvscode-server', '-f build/integration/openvscode-server/Dockerfile .').withRun("--network host", "--disable-workspace-trust") { container ->
41-
docker.image('docker-registry.ivyteam.io/axonivy/playwright-base:dev').inside("--network host -e RUN_IN_BRWOSER=true") {
42-
catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') {
43-
sh 'npm run test:playwright:browser'
44-
}
45-
archiveArtifacts artifacts: '**/playwright/test-results/**', allowEmptyArchive: true
46-
withChecks('WebTests') {
47-
junit testDataPublishers: [[$class: 'StabilityTestDataPublisher']], testResults: '**/node_modules/**/report.xml'
48-
}
51+
nodejs(nodeJSInstallationName: '22.11.0') {
52+
catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') {
53+
sh 'npm run test:playwright:browser'
54+
}
55+
archiveArtifacts artifacts: '**/playwright/test-results/**', allowEmptyArchive: true
56+
withChecks('WebTests') {
57+
junit testDataPublishers: [[$class: 'StabilityTestDataPublisher']], testResults: '**/node_modules/**/report.xml'
4958
}
5059
}
5160
}

playwright/playwright.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { defineConfig } from '@playwright/test';
33
export default defineConfig({
44
use: {
55
permissions: ['clipboard-read'],
6-
trace: 'retain-on-failure'
6+
trace: 'retain-on-failure',
7+
headless: true
78
},
89
testDir: './tests',
910
workers: 1,

playwright/tests/fixtures/baseTest.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,17 @@ const runBrowserTest = async (workspace: string, take: (r: Page) => Promise<void
2525
const browser = await chromium.launch();
2626
const page = await browser.newPage();
2727
await page.setViewportSize({ width: 1920, height: 1080 });
28-
await page.goto(`http://localhost:3000/?folder=/home/workspace/${workspace.split('/tests/workspaces/')[1]}`);
28+
const tmpWorkspace = await createTmpWorkspace(workspace);
29+
await page.goto(`http://localhost:3000/?folder=${tmpWorkspace}`);
2930
await initialize(page);
3031
await take(page);
3132
await browser.close();
33+
await fs.promises.rm(tmpWorkspace, { recursive: true });
3234
};
3335

3436
const runElectronAppTest = async (workspace: string, take: (r: Page) => Promise<void>) => {
3537
const vscodePath = await downloadAndUnzipVSCode(downloadVersion);
36-
const tempDir = await createTempDir();
37-
await fs.promises.cp(workspace, tempDir, { recursive: true });
38+
const tmpWorkspace = await createTmpWorkspace(workspace);
3839
const electronApp = await _electron.launch({
3940
executablePath: vscodePath,
4041
args: [
@@ -45,7 +46,7 @@ const runElectronAppTest = async (workspace: string, take: (r: Page) => Promise<
4546
'--skip-release-notes',
4647
'--disable-workspace-trust',
4748
`--extensionDevelopmentPath=${path.resolve(__dirname, '../../../extension/')}`,
48-
tempDir
49+
tmpWorkspace
4950
]
5051
});
5152
const page = await electronApp.firstWindow();
@@ -61,17 +62,16 @@ const runElectronAppTest = async (workspace: string, take: (r: Page) => Promise<
6162
test.info().attachments.push({ name: 'screenshot', path: tracePath, contentType: 'image/png' });
6263
}
6364
await electronApp.close();
64-
await fs.promises.rm(tempDir, { recursive: true });
65+
await fs.promises.rm(tmpWorkspace, { recursive: true });
6566
};
6667

6768
const initialize = async (page: Page) => {
6869
const fileExplorer = new FileExplorer(page);
6970
await fileExplorer.hasIvyStatusBarIcon();
70-
await fileExplorer.saveAllFiles();
71-
await fileExplorer.closeAllTabs();
72-
await fileExplorer.collapseFolders();
7371
};
7472

75-
const createTempDir = async () => {
76-
return await fs.promises.realpath(await fs.promises.mkdtemp(path.join(os.tmpdir(), 'playwrightTestWorkspace')));
73+
const createTmpWorkspace = async (workspace: string) => {
74+
const tmpDir = await fs.promises.realpath(await fs.promises.mkdtemp(path.join(os.tmpdir(), 'playwrightTestWorkspace')));
75+
await fs.promises.cp(workspace, tmpDir, { recursive: true });
76+
return tmpDir;
7777
};

playwright/tests/page-objects/explorer-view.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,6 @@ export class FileExplorer extends ExplorerView {
107107
await this.provideUserInput(dataClass);
108108
await this.provideUserInput(namespace);
109109
}
110-
111-
async collapseFolders() {
112-
await this.executeCommand('Collapse Folders in Explorer');
113-
}
114110
}
115111

116112
export class ProjectExplorerView extends ExplorerView {

playwright/tests/page-objects/page-object.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,6 @@ export class PageObject {
5151
await this.quickInputBox().press('Enter');
5252
}
5353

54-
async closeAllTabs() {
55-
await this.executeCommand('View: Close All Editor Groups');
56-
await expect(this.page.locator('div.tab')).toBeHidden();
57-
}
58-
5954
async isTabWithNameVisible(name: string) {
6055
const tabSelector = `div.tab:has-text("${name}")`;
6156
await expect(this.page.locator(tabSelector)).toBeVisible();

0 commit comments

Comments
 (0)