Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade puppeteer to 23.1.0. #14261

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dev-packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
"log-update": "^4.0.0",
"mocha": "^10.1.0",
"patch-package": "^8.0.0",
"puppeteer": "19.7.2",
"puppeteer-core": "19.7.2",
"puppeteer": "23.1.0",
"puppeteer-core": "23.1.0",
"puppeteer-to-istanbul": "1.4.0",
"temp": "^0.9.1",
"tslib": "^2.6.2",
Expand Down
1 change: 1 addition & 0 deletions dev-packages/cli/src/run-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,5 @@ export default async function runTest(options: TestOptions): Promise<void> {
? `http://[${address}]:${port}`
: `http://${address}:${port}`;
await testPage.goto(url);
await testPage.bringToFront();
}
10 changes: 8 additions & 2 deletions dev-packages/cli/src/theia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,10 @@ async function theiaCli(): Promise<void> {
if (!process.env.THEIA_CONFIG_DIR) {
process.env.THEIA_CONFIG_DIR = temp.track().mkdirSync('theia-test-config-dir');
}
const args = ['--no-sandbox'];
if (!testInspect) {
args.push('--headless=old');
}
await runTest({
start: () => new Promise((resolve, reject) => {
const serverProcess = manager.start(toStringArray(theiaArgs));
Expand All @@ -596,11 +600,13 @@ async function theiaCli(): Promise<void> {
serverProcess.on('close', (code, signal) => reject(`Server process exited unexpectedly: ${code ?? signal}`));
}),
launch: {
args: ['--no-sandbox'],
args: args,
// eslint-disable-next-line no-null/no-null
defaultViewport: null, // view port can take available space instead of 800x600 default
devtools: testInspect,
executablePath: executablePath()
headless: testInspect ? false : 'shell',
executablePath: executablePath(),
protocolTimeout: 600000
},
files: {
extension: testExtension,
Expand Down
18 changes: 0 additions & 18 deletions examples/api-tests/src/explorer-open-close.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ describe('Explorer and Editor - open and close', function () {

async function openEditor() {
await editorManager.open(fileUri, { mode: 'activate' });
await waitLanguageServerReady();
const activeEditor = /** @type {MonacoEditor} */ MonacoEditor.get(editorManager.activeEditor);
assert.isDefined(activeEditor);
assert.equal(activeEditor.uri.resolveToAbsolute().toString(), fileUri.resolveToAbsolute().toString());
Expand All @@ -135,21 +134,4 @@ describe('Explorer and Editor - open and close', function () {
assert.isUndefined(activeEditor);
}

async function waitLanguageServerReady() {
// quite a bit of jitter in the "Initializing LS" status bar entry,
// so we want to read a few times in a row that it's done (undefined)
const MAX_N = 5
let n = MAX_N;
while (n > 0) {
await pause(1);
if (progressStatusBarItem.currentProgress) {
n = MAX_N;
} else {
n--;
}
if (n < MAX_N) {
console.debug('n = ' + n);
}
}
}
});
19 changes: 0 additions & 19 deletions examples/api-tests/src/find-replace.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,28 +143,9 @@ describe('Find and Replace', function () {

async function openEditor() {
await editorManager.open(fileUri, { mode: 'activate' });
await waitLanguageServerReady();
const activeEditor = /** @type {MonacoEditor} */ MonacoEditor.get(editorManager.activeEditor);
assert.isDefined(activeEditor);
// @ts-ignore
assert.equal(activeEditor.uri.resolveToAbsolute().toString(), fileUri.resolveToAbsolute().toString());
}

async function waitLanguageServerReady() {
// quite a bit of jitter in the "Initializing LS" status bar entry,
// so we want to read a few times in a row that it's done (undefined)
const MAX_N = 5
let n = MAX_N;
while (n > 0) {
await pause(1);
if (progressStatusBarItem.currentProgress) {
n = MAX_N;
} else {
n--;
}
if (n < 5) {
console.debug('n = ' + n);
}
}
}
});
12 changes: 9 additions & 3 deletions examples/api-tests/src/scm.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
// *****************************************************************************




// @ts-check
describe('SCM', function () {

Expand All @@ -31,6 +28,8 @@ describe('SCM', function () {
const { ScmService } = require('@theia/scm/lib/browser/scm-service');
const { ScmWidget } = require('@theia/scm/lib/browser/scm-widget');
const { CommandRegistry } = require('@theia/core/lib/common');
const { PreferenceService } = require('@theia/core/lib/browser');


/** @type {import('inversify').Container} */
const container = window['theia'].container;
Expand All @@ -40,6 +39,7 @@ describe('SCM', function () {
const service = container.get(ScmService);
const commandRegistry = container.get(CommandRegistry);
const pluginService = container.get(HostedPluginSupport);
const preferences = container.get(PreferenceService);

/** @type {ScmWidget} */
let scmWidget;
Expand Down Expand Up @@ -81,6 +81,12 @@ describe('SCM', function () {
return success;
}


before(async () => {
preferences.set('git.autoRepositoryDetection', true);
preferences.set('git.openRepositoryInParentFolders', 'always');
});

beforeEach(async () => {
if (!pluginService.getPlugin(gitPluginId)) {
throw new Error(gitPluginId + ' should be started');
Expand Down
40 changes: 36 additions & 4 deletions examples/api-tests/src/typescript.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

// @ts-check
describe('TypeScript', function () {
this.timeout(30_000);
this.timeout(200_000);

const { assert } = chai;
const { timeout } = require('@theia/core/lib/common/promise-util');
Expand Down Expand Up @@ -94,6 +94,24 @@ describe('TypeScript', function () {
await preferences.set('files.autoSave', originalAutoSaveValue);
})

async function waitLanguageServerReady() {
// quite a bit of jitter in the "Initializing LS" status bar entry,
// so we want to read a few times in a row that it's done (undefined)
const MAX_N = 5
let n = MAX_N;
while (n > 0) {
await timeout(1000);
if (progressStatusBarItem.currentProgress) {
n = MAX_N;
} else {
n--;
}
if (n < 5) {
console.debug('n = ' + n);
}
}
}

/**
* @param {Uri.default} uri
* @param {boolean} preview
Expand All @@ -106,8 +124,8 @@ describe('TypeScript', function () {
// wait till tsserver is running, see:
// https://github.com/microsoft/vscode/blob/93cbbc5cae50e9f5f5046343c751b6d010468200/extensions/typescript-language-features/src/extension.ts#L98-L103
await waitForAnimation(() => contextKeyService.match('typescript.isManagedFile'));
// https://github.com/microsoft/vscode/blob/4aac84268c6226d23828cc6a1fe45ee3982927f0/extensions/typescript-language-features/src/typescriptServiceClient.ts#L911
await waitForAnimation(() => !progressStatusBarItem.currentProgress);

waitLanguageServerReady();
return /** @type {MonacoEditor} */ (editor);
}

Expand Down Expand Up @@ -388,6 +406,14 @@ describe('TypeScript', function () {
assert.isTrue(contextKeyService.match('editorTextFocus'));
assert.isTrue(contextKeyService.match('suggestWidgetVisible'));


const suggestController = editor.getControl().getContribution('editor.contrib.suggestController');

waitForAnimation(() => {
const content = nodeAsString(suggestController ? ['_widget']?.['_value']?.['element']?.['domNode']);
return !content.includes('loading');
});

// May need a couple extra "Enter" being sent for the suggest to be accepted
keybindings.dispatchKeyDown('Enter');
await waitForAnimation(() => {
Expand All @@ -398,7 +424,7 @@ describe('TypeScript', function () {
return false;
}
return true;
}, 5000, 'Suggest widget has not been dismissed despite attempts to accept suggestion');
}, 20000, 'Suggest widget has not been dismissed despite attempts to accept suggestion');

assert.isTrue(contextKeyService.match('editorTextFocus'));
assert.isFalse(contextKeyService.match('suggestWidgetVisible'));
Expand Down Expand Up @@ -542,6 +568,7 @@ describe('TypeScript', function () {
});

it('editor.action.showHover', async function () {

const editor = await openEditor(demoFileUri);
// class |DemoClass);
editor.getControl().setPosition({ lineNumber: 8, column: 7 });
Expand All @@ -558,6 +585,11 @@ describe('TypeScript', function () {
assert.isTrue(contextKeyService.match('editorHoverVisible'));
assert.isTrue(contextKeyService.match('editorTextFocus'));

waitForAnimation(() => {
const content = nodeAsString(hover['_contentWidget']?.['_widget']?.['_hover']?.['contentsDomNode']);
return !content.includes('loading');
});

assert.deepEqual(nodeAsString(hover['_contentWidget']?.['_widget']?.['_hover']?.['contentsDomNode']).trim(), `
DIV {
DIV {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
"node-gyp": "^9.0.0",
"nsfw": "^2.2.4",
"nyc": "^15.0.0",
"puppeteer": "19.7.2",
"puppeteer-core": "19.7.2",
"puppeteer": "23.1.0",
"puppeteer-core": "23.1.0",
"puppeteer-to-istanbul": "1.4.0",
"rimraf": "^2.6.1",
"sinon": "^12.0.0",
Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/browser/widgets/react-widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ export abstract class ReactWidget extends BaseWidget {

protected override onUpdateRequest(msg: Message): void {
super.onUpdateRequest(msg);
this.nodeRoot.render(<React.Fragment>{this.render()}</React.Fragment>);
if (!this.isDisposed) {
this.nodeRoot.render(<React.Fragment>{this.render()}</React.Fragment>);
}
}

/**
Expand Down
Loading
Loading