From 4b359a57a59ac6b8255cb5976b9caad0c2ded45d Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Wed, 12 Feb 2020 12:07:40 +0100 Subject: [PATCH] build - address some issues - run local and remote integration tests separately - enable playwright on Linux with -no-sandbox trick --- .../darwin/product-build-darwin.yml | 10 +++++ .../linux/product-build-linux.yml | 42 +++++++++---------- .../win32/product-build-win32.yml | 10 +++++ scripts/test-integration.bat | 4 -- scripts/test-integration.sh | 6 --- test/integration/browser/src/index.ts | 3 +- test/unit/browser/index.js | 4 +- 7 files changed, 45 insertions(+), 34 deletions(-) diff --git a/build/azure-pipelines/darwin/product-build-darwin.yml b/build/azure-pipelines/darwin/product-build-darwin.yml index 2348594adb4..6be05972f7f 100644 --- a/build/azure-pipelines/darwin/product-build-darwin.yml +++ b/build/azure-pipelines/darwin/product-build-darwin.yml @@ -118,6 +118,16 @@ steps: displayName: Run integration tests (Electron) condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) +- script: | + set -e + APP_ROOT=$(agent.builddirectory)/VSCode-darwin + APP_NAME="`ls $APP_ROOT | head -n 1`" + INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME/Contents/MacOS/Electron" \ + VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-darwin" \ + ./resources/server/test/test-remote-integration.sh + displayName: Run remote integration tests (Electron) + condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) + - script: | set -e VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-web-darwin" \ diff --git a/build/azure-pipelines/linux/product-build-linux.yml b/build/azure-pipelines/linux/product-build-linux.yml index 46e112b79d2..cbe3bf051e6 100644 --- a/build/azure-pipelines/linux/product-build-linux.yml +++ b/build/azure-pipelines/linux/product-build-linux.yml @@ -104,16 +104,11 @@ steps: displayName: Run unit tests (Electron) condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) -# Playwright currently does not run on the Linux docker container we use -# given our dependencies. Someone with some energy should follow up and -# find out what is still missing to get Chrome started in the container. -# Refs: https://github.com/microsoft/vscode-linux-build-agent/blob/master/x64/Dockerfile -# -# - script: | -# set -e -# DISPLAY=:10 yarn test-browser --build --browser chromium -# displayName: Run unit tests (Browser) -# condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) +- script: | + set -e + DISPLAY=:10 yarn test-browser --build --browser chromium + displayName: Run unit tests (Browser) + condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) - script: | # Figure out the full absolute path of the product we just built @@ -128,17 +123,22 @@ steps: displayName: Run integration tests (Electron) condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) -# Playwright currently does not run on the Linux docker container we use -# given our dependencies. Someone with some energy should follow up and -# find out what is still missing to get Chrome started in the container. -# Refs: https://github.com/microsoft/vscode-linux-build-agent/blob/master/x64/Dockerfile -# - script: | -# set -e -# VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-web-linux-x64" \ -# DISPLAY=:10 ./resources/server/test/test-web-integration.sh --browser chromium -# continueOnError: true -# displayName: Run integration tests (Browser) -# condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) +- script: | + set -e + APP_ROOT=$(agent.builddirectory)/VSCode-linux-x64 + APP_NAME=$(node -p "require(\"$APP_ROOT/resources/app/product.json\").applicationName") + INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME" \ + VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-linux-x64" \ + DISPLAY=:10 ./resources/server/test/test-remote-integration.sh + displayName: Run remote integration tests (Electron) + condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) + +- script: | + set -e + VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-web-linux-x64" \ + DISPLAY=:10 ./resources/server/test/test-web-integration.sh --browser chromium + displayName: Run integration tests (Browser) + condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) - script: | set -e diff --git a/build/azure-pipelines/win32/product-build-win32.yml b/build/azure-pipelines/win32/product-build-win32.yml index d69f9c73c25..f1f6915e47b 100644 --- a/build/azure-pipelines/win32/product-build-win32.yml +++ b/build/azure-pipelines/win32/product-build-win32.yml @@ -132,6 +132,16 @@ steps: displayName: Run integration tests (Electron) condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) +- powershell: | + . build/azure-pipelines/win32/exec.ps1 + $ErrorActionPreference = "Stop" + $AppRoot = "$(agent.builddirectory)\VSCode-win32-$(VSCODE_ARCH)" + $AppProductJson = Get-Content -Raw -Path "$AppRoot\resources\app\product.json" | ConvertFrom-Json + $AppNameShort = $AppProductJson.nameShort + exec { $env:INTEGRATION_TEST_ELECTRON_PATH = "$AppRoot\$AppNameShort.exe"; $env:VSCODE_REMOTE_SERVER_PATH = "$(agent.builddirectory)\vscode-reh-win32-$(VSCODE_ARCH)"; .\resources\server\test\test-remote-integration.bat } + displayName: Run remote integration tests (Electron) + condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) + - powershell: | . build/azure-pipelines/win32/exec.ps1 $ErrorActionPreference = "Stop" diff --git a/scripts/test-integration.bat b/scripts/test-integration.bat index c52092b694b..b8d673f70d4 100644 --- a/scripts/test-integration.bat +++ b/scripts/test-integration.bat @@ -63,10 +63,6 @@ if %errorlevel% neq 0 exit /b %errorlevel% call .\scripts\node-electron.bat .\node_modules\mocha\bin\_mocha .\extensions\*\server\out\test\**\*.test.js if %errorlevel% neq 0 exit /b %errorlevel% -if exist ".\resources\server\test\test-remote-integration.bat" ( - call .\resources\server\test\test-remote-integration.bat -) - rmdir /s /q %VSCODEUSERDATADIR% popd diff --git a/scripts/test-integration.sh b/scripts/test-integration.sh index 52edd9c01da..9aff685b7c6 100755 --- a/scripts/test-integration.sh +++ b/scripts/test-integration.sh @@ -49,12 +49,6 @@ fi "$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $ROOT/extensions/emmet/out/test/test-fixtures --extensionDevelopmentPath=$ROOT/extensions/emmet --extensionTestsPath=$ROOT/extensions/emmet/out/test --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --user-data-dir=$VSCODEUSERDATADIR "$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $(mktemp -d 2>/dev/null) --extensionDevelopmentPath=$ROOT/extensions/git --extensionTestsPath=$ROOT/extensions/git/out/test --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --user-data-dir=$VSCODEUSERDATADIR - -# Remote Integration Tests -if [ -f ./resources/server/test/test-remote-integration.sh ]; then - ./resources/server/test/test-remote-integration.sh -fi - # Tests in commonJS cd $ROOT/extensions/css-language-features/server && $ROOT/scripts/node-electron.sh test/index.js cd $ROOT/extensions/html-language-features/server && $ROOT/scripts/node-electron.sh test/index.js diff --git a/test/integration/browser/src/index.ts b/test/integration/browser/src/index.ts index a6406371b47..2ed75099d31 100644 --- a/test/integration/browser/src/index.ts +++ b/test/integration/browser/src/index.ts @@ -29,7 +29,8 @@ const width = 1200; const height = 800; async function runTestsInBrowser(browserType: string, endpoint: url.UrlWithStringQuery, server: cp.ChildProcess): Promise { - const browser = await playwright[browserType].launch({ headless: !Boolean(optimist.argv.debug) }); + const args = process.platform === 'linux' && browserType === 'chromium' ? ['--no-sandbox'] : undefined; // disable sandbox to run chrome on certain Linux distros + const browser = await playwright[browserType].launch({ headless: !Boolean(optimist.argv.debug), dumpio: true, args }); const page = (await browser.defaultContext().pages())[0]; await page.setViewport({ width, height }); diff --git a/test/unit/browser/index.js b/test/unit/browser/index.js index 32ebdc1c87b..884cb5de667 100644 --- a/test/unit/browser/index.js +++ b/test/unit/browser/index.js @@ -118,8 +118,8 @@ const testModules = (async function () { async function runTestsInBrowser(testModules, browserType) { - - const browser = await playwright[browserType].launch({ headless: !Boolean(argv.debug) }); + const args = process.platform === 'linux' && browserType === 'chromium' ? ['--no-sandbox'] : undefined; // disable sandbox to run chrome on certain Linux distros + const browser = await playwright[browserType].launch({ headless: !Boolean(argv.debug), dumpio: true, args }); const page = (await browser.defaultContext().pages())[0] const target = url.pathToFileURL(path.join(__dirname, 'renderer.html')); if (argv.build) { -- GitLab