Skip to content

Commit 547cf4e

Browse files
Tyriarbpasero
andauthored
Run smoke tests against actual build (#83799)
* Run web against actual server Part of #80308 * Fix strict null check errors * Fix folder arg * Disable unit tests and integration tests temporarily * Allow running on node 12 * Fix smoke test condition * Disable continue on error * Add web to server dir * fix smoke test to use build for web * enable in product build Co-authored-by: Benjamin Pasero <[email protected]>
1 parent c489883 commit 547cf4e

File tree

3 files changed

+70
-48
lines changed

3 files changed

+70
-48
lines changed

build/azure-pipelines/darwin/product-build-darwin.yml

+10-10
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,16 @@ steps:
114114
displayName: Run integration tests
115115
condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
116116

117-
# Web Smoke Tests disabled due to https://github.com/microsoft/vscode/issues/80308
118-
# - script: |
119-
# set -e
120-
# cd test/smoke
121-
# yarn compile
122-
# cd -
123-
# yarn smoketest --web --headless
124-
# continueOnError: true
125-
# displayName: Run web smoke tests
126-
# condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
117+
- script: |
118+
set -e
119+
cd test/smoke
120+
yarn compile
121+
cd -
122+
VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-web-darwin" \
123+
yarn smoketest --web --headless
124+
continueOnError: true
125+
displayName: Run web smoke tests
126+
condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
127127

128128
- script: |
129129
set -e

test/automation/src/puppeteerDriver.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,14 @@ export async function launch(_args: string[]): Promise<void> {
9898
VSCODE_AGENT_FOLDER: agentFolder,
9999
...process.env
100100
};
101+
let serverLocation: string | undefined;
102+
if (process.env.VSCODE_REMOTE_SERVER_PATH) {
103+
serverLocation = join(process.env.VSCODE_REMOTE_SERVER_PATH, `server.${process.platform === 'win32' ? 'cmd' : 'sh'}`);
104+
} else {
105+
serverLocation = join(args[0], `resources/server/web.${process.platform === 'win32' ? 'bat' : 'sh'}`);
106+
}
101107
server = spawn(
102-
join(args[0], `resources/server/web.${process.platform === 'win32' ? 'bat' : 'sh'}`),
108+
serverLocation,
103109
['--browser', 'none', '--driver', 'web'],
104110
{ env }
105111
);
@@ -140,7 +146,7 @@ export function connect(headless: boolean, outPath: string, handle: string): Pro
140146
});
141147
const page = (await browser.pages())[0];
142148
await page.setViewport({ width, height });
143-
await page.goto(`${endpoint}&folder=${args![1]}`);
149+
await page.goto(`${endpoint}&folder=vscode-remote://localhost:9888${args![1]}`);
144150
const result = {
145151
client: { dispose: () => teardown },
146152
driver: buildDriver(browser, page)

test/smoke/src/main.ts

+52-36
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ import { setup as setupDataMultirootTests } from './areas/multiroot/multiroot.te
3737
import { setup as setupDataLocalizationTests } from './areas/workbench/localization.test';
3838
import { setup as setupLaunchTests } from './areas/workbench/launch.test';
3939

40-
if (!/^v10/.test(process.version)) {
41-
console.error('Error: Smoketest must be run using Node 10. Currently running', process.version);
40+
if (!/^v10/.test(process.version) && !/^v12/.test(process.version)) {
41+
console.error('Error: Smoketest must be run using Node 10/12. Currently running', process.version);
4242
process.exit(1);
4343
}
4444

@@ -73,7 +73,6 @@ const extensionsPath = path.join(testDataPath, 'extensions-dir');
7373
mkdirp.sync(extensionsPath);
7474

7575
const screenshotsPath = opts.screenshots ? path.resolve(opts.screenshots) : null;
76-
7776
if (screenshotsPath) {
7877
mkdirp.sync(screenshotsPath);
7978
}
@@ -83,10 +82,6 @@ function fail(errorMessage): void {
8382
process.exit(1);
8483
}
8584

86-
if (parseInt(process.version.substr(1)) < 6) {
87-
fail('Please update your Node version to greater than 6 to run the smoke test.');
88-
}
89-
9085
const repoPath = path.join(__dirname, '..', '..', '..');
9186

9287
function getDevElectronPath(): string {
@@ -122,44 +117,65 @@ function getBuildElectronPath(root: string): string {
122117
}
123118
}
124119

125-
let testCodePath = opts.build;
126-
let stableCodePath = opts['stable-build'];
127-
let electronPath: string;
128-
let stablePath: string | undefined = undefined;
120+
let quality: Quality;
121+
122+
if (!opts.web) {
123+
let testCodePath = opts.build;
124+
let stableCodePath = opts['stable-build'];
125+
let electronPath: string;
126+
let stablePath: string | undefined = undefined;
127+
128+
if (testCodePath) {
129+
electronPath = getBuildElectronPath(testCodePath);
130+
131+
if (stableCodePath) {
132+
stablePath = getBuildElectronPath(stableCodePath);
133+
}
134+
} else {
135+
testCodePath = getDevElectronPath();
136+
electronPath = testCodePath;
137+
process.env.VSCODE_REPOSITORY = repoPath;
138+
process.env.VSCODE_DEV = '1';
139+
process.env.VSCODE_CLI = '1';
140+
}
141+
142+
if (!fs.existsSync(electronPath || '')) {
143+
fail(`Can't find VSCode at ${electronPath}.`);
144+
}
129145

130-
if (testCodePath) {
131-
electronPath = getBuildElectronPath(testCodePath);
146+
if (typeof stablePath === 'string' && !fs.existsSync(stablePath)) {
147+
fail(`Can't find Stable VSCode at ${stablePath}.`);
148+
}
132149

133-
if (stableCodePath) {
134-
stablePath = getBuildElectronPath(stableCodePath);
150+
if (process.env.VSCODE_DEV === '1') {
151+
quality = Quality.Dev;
152+
} else if (electronPath.indexOf('Code - Insiders') >= 0 /* macOS/Windows */ || electronPath.indexOf('code-insiders') /* Linux */ >= 0) {
153+
quality = Quality.Insiders;
154+
} else {
155+
quality = Quality.Stable;
135156
}
136157
} else {
137-
testCodePath = getDevElectronPath();
138-
electronPath = testCodePath;
139-
process.env.VSCODE_REPOSITORY = repoPath;
140-
process.env.VSCODE_DEV = '1';
141-
process.env.VSCODE_CLI = '1';
142-
}
158+
let testCodeServerPath = process.env.VSCODE_REMOTE_SERVER_PATH;
143159

144-
if (!opts.web && !fs.existsSync(electronPath || '')) {
145-
fail(`Can't find Code at ${electronPath}.`);
146-
}
160+
if (typeof testCodeServerPath === 'string' && !fs.existsSync(testCodeServerPath)) {
161+
fail(`Can't find Code server at ${testCodeServerPath}.`);
162+
}
163+
164+
if (!testCodeServerPath) {
165+
process.env.VSCODE_REPOSITORY = repoPath;
166+
process.env.VSCODE_DEV = '1';
167+
process.env.VSCODE_CLI = '1';
168+
}
147169

148-
if (typeof stablePath === 'string' && !fs.existsSync(stablePath)) {
149-
fail(`Can't find Stable Code at ${stablePath}.`);
170+
if (process.env.VSCODE_DEV === '1') {
171+
quality = Quality.Dev;
172+
} else {
173+
quality = Quality.Insiders;
174+
}
150175
}
151176

152177
const userDataDir = path.join(testDataPath, 'd');
153178

154-
let quality: Quality;
155-
if (process.env.VSCODE_DEV === '1') {
156-
quality = Quality.Dev;
157-
} else if (electronPath.indexOf('Code - Insiders') >= 0 /* macOS/Windows */ || electronPath.indexOf('code-insiders') /* Linux */ >= 0) {
158-
quality = Quality.Insiders;
159-
} else {
160-
quality = Quality.Stable;
161-
}
162-
163179
async function setupRepository(): Promise<void> {
164180
if (opts['test-repo']) {
165181
console.log('*** Copying test project repository:', opts['test-repo']);
@@ -246,7 +262,7 @@ after(async function () {
246262
});
247263

248264
if (!opts.web) {
249-
setupDataMigrationTests(stableCodePath, testDataPath);
265+
setupDataMigrationTests(opts['stable-build'], testDataPath);
250266
}
251267

252268
describe('Running Code', () => {

0 commit comments

Comments
 (0)