mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
test: fixup test failures on linux (#49068)
* test: fixup spec runner to properly fail on linux when tests fail * test: fixup dbus tests * test: disable context menu spellcheck tests on linux https://github.com/electron/electron/pull/48657 broke those tests (cherry picked from commitcc3c999148) * test:rebuild native modules (cherry picked from commitbb8e2a924b) * fix: wait for devtools blur event in focus test to avoid race condition (cherry picked from commit6fd2575cbc) * fix: wait for devtools blur event in focus test to avoid race condition (cherry picked from commitea830139af) --------- Co-authored-by: Alice Zhao <alicelovescake@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
933f0d50d1
commit
32fcfe4505
2
spec/ambient.d.ts
vendored
2
spec/ambient.d.ts
vendored
@@ -1,2 +1,4 @@
|
||||
declare let standardScheme: string;
|
||||
declare let serviceWorkerScheme: string;
|
||||
|
||||
declare module 'dbus-native';
|
||||
|
||||
@@ -10,7 +10,7 @@ import { nativeImage } from 'electron/common';
|
||||
import { app } from 'electron/main';
|
||||
|
||||
import { expect } from 'chai';
|
||||
import * as dbus from 'dbus-ts';
|
||||
import * as dbus from 'dbus-native';
|
||||
|
||||
import * as path from 'node:path';
|
||||
import { promisify } from 'node:util';
|
||||
@@ -40,9 +40,10 @@ ifdescribe(!skip)('Notification module (dbus)', () => {
|
||||
const path = '/org/freedesktop/Notifications';
|
||||
const iface = 'org.freedesktop.DBus.Mock';
|
||||
console.log(`session bus: ${process.env.DBUS_SESSION_BUS_ADDRESS}`);
|
||||
const bus = await dbus.sessionBus();
|
||||
const bus = dbus.sessionBus();
|
||||
const service = bus.getService(serviceName);
|
||||
mock = await service.getInterface(path, iface);
|
||||
const getInterface = promisify(service.getInterface.bind(service));
|
||||
mock = await getInterface(path, iface);
|
||||
getCalls = promisify(mock.GetCalls.bind(mock));
|
||||
reset = promisify(mock.Reset.bind(mock));
|
||||
});
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// See https://pypi.python.org/pypi/python-dbusmock for more information about
|
||||
// python-dbusmock.
|
||||
import { expect } from 'chai';
|
||||
import * as dbus from 'dbus-ts';
|
||||
import * as dbus from 'dbus-native';
|
||||
|
||||
import { once } from 'node:events';
|
||||
import { setTimeout } from 'node:timers/promises';
|
||||
@@ -20,9 +20,10 @@ describe('powerMonitor', () => {
|
||||
|
||||
ifdescribe(process.platform === 'linux' && process.env.DBUS_SYSTEM_BUS_ADDRESS != null)('when powerMonitor module is loaded with dbus mock', () => {
|
||||
before(async () => {
|
||||
const systemBus = await dbus.systemBus();
|
||||
const systemBus = dbus.systemBus();
|
||||
const loginService = systemBus.getService('org.freedesktop.login1');
|
||||
logindMock = await loginService.getInterface('/org/freedesktop/login1', 'org.freedesktop.DBus.Mock');
|
||||
const getInterface = promisify(loginService.getInterface.bind(loginService));
|
||||
logindMock = await getInterface('/org/freedesktop/login1', 'org.freedesktop.DBus.Mock');
|
||||
getCalls = promisify(logindMock.GetCalls.bind(logindMock));
|
||||
emitSignal = promisify(logindMock.EmitSignal.bind(logindMock));
|
||||
reset = promisify(logindMock.Reset.bind(logindMock));
|
||||
|
||||
@@ -1019,13 +1019,15 @@ describe('webContents module', () => {
|
||||
assert(devToolsWebContents !== null);
|
||||
|
||||
const windowFocused = once(window, 'focus');
|
||||
const devToolsBlurred = once(devToolsWebContents, 'blur');
|
||||
window.focus();
|
||||
await windowFocused;
|
||||
await Promise.all([windowFocused, devToolsBlurred]);
|
||||
|
||||
expect(devToolsWebContents.isFocused()).to.be.false();
|
||||
const devToolsWebContentsFocused = once(devToolsWebContents, 'focus');
|
||||
const windowBlurred = once(window, 'blur');
|
||||
window.webContents.inspectElement(100, 100);
|
||||
await devToolsWebContentsFocused;
|
||||
await Promise.all([devToolsWebContentsFocused, windowBlurred]);
|
||||
|
||||
expect(devToolsWebContents.isFocused()).to.be.true();
|
||||
expect(window.isFocused()).to.be.false();
|
||||
|
||||
@@ -27,12 +27,13 @@
|
||||
"@types/uuid": "^3.4.6",
|
||||
"@types/w3c-web-serial": "^1.0.7",
|
||||
"@types/ws": "^7.2.0",
|
||||
"abstract-socket": "github:deepak1556/node-abstractsocket#928cc591decd12aff7dad96449da8afc29832c19",
|
||||
"basic-auth": "^2.0.1",
|
||||
"busboy": "^1.6.0",
|
||||
"chai": "^4.2.0",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"coffeescript": "^2.4.1",
|
||||
"dbus-ts": "^0.0.7",
|
||||
"dbus-native": "github:nornagon/dbus-native#master",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"express": "^4.20.0",
|
||||
"graceful-fs": "^4.1.15",
|
||||
|
||||
@@ -88,8 +88,8 @@ ifdescribe(features.isBuiltinSpellCheckerEnabled())('spellchecker', function ()
|
||||
await closeWindow(w);
|
||||
});
|
||||
|
||||
// Context menu test can not run on Windows.
|
||||
const shouldRun = process.platform !== 'win32';
|
||||
// Context menu test can not run on Windows or Linux (https://github.com/electron/electron/pull/48657 broke linux).
|
||||
const shouldRun = process.platform !== 'win32' && process.platform !== 'linux';
|
||||
|
||||
ifit(shouldRun)('should detect correctly spelled words as correct', async () => {
|
||||
await w.webContents.executeJavaScript('document.body.querySelector("textarea").value = "typography"');
|
||||
|
||||
Reference in New Issue
Block a user