Enable webview tests (#114059)

These tests were disable due to some occasional failures on build machines. This PR enables them but with flakySuite while I track down possible causes of these failures
This commit is contained in:
Matt Bierner 2021-01-08 15:57:28 -08:00 committed by GitHub
parent a12a996d78
commit 01c6003c29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 4 deletions

View file

@ -7,7 +7,7 @@ import * as assert from 'assert';
import 'mocha';
import * as os from 'os';
import * as vscode from 'vscode';
import { closeAllEditors, delay, disposeAll } from '../utils';
import { closeAllEditors, delay, disposeAll, flakySuite } from '../utils';
const webviewId = 'myWebview';
@ -17,7 +17,7 @@ function workspaceFile(...segments: string[]) {
const testDocument = workspaceFile('bower.json');
suite.skip('vscode API - webview', () => {
flakySuite('vscode API - webview', () => {
const disposables: vscode.Disposable[] = [];
function _register<T extends vscode.Disposable>(disposable: T) {
@ -212,7 +212,7 @@ suite.skip('vscode API - webview', () => {
assert.strictEqual(Math.round(secondResponse.value), 100);
});
test('webviews with retainContextWhenHidden should be able to recive messages while hidden', async () => {
test('webviews with retainContextWhenHidden should be able to receive messages while hidden', async () => {
const webview = _register(vscode.window.createWebviewPanel(webviewId, 'title', { viewColumn: vscode.ViewColumn.One }, { enableScripts: true, retainContextWhenHidden: true }));
const ready = getMesssage(webview);

View file

@ -3,9 +3,25 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { Suite } from 'mocha';
import * as vscode from 'vscode';
import { TestFS } from './memfs';
import * as assert from 'assert';
export function flakySuite(title: string, fn: (this: Suite) => void): Suite {
return suite(title, function () {
// Flaky suites need retries and timeout to complete
// e.g. because they access the file system which can
// be unreliable depending on the environment.
this.retries(3);
this.timeout(1000 * 20);
// Invoke suite ensuring that `this` is
// properly wired in.
fn.call(this);
});
}
export function rndName() {
return Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 10);