test: migrate to helpers & disabled tests list (#37513)
* test: migrate to helpers & disabled tests list * can't disable a test suite * correct condition * address review comments
This commit is contained in:
parent
58f3c0ee37
commit
b8a21dbcd7
20 changed files with 95 additions and 117 deletions
|
@ -188,12 +188,7 @@ describe('app module', () => {
|
|||
expect(code).to.equal(123, 'exit code should be 123, if you see this please tag @MarshallOfSound');
|
||||
});
|
||||
|
||||
it('exits gracefully', async function () {
|
||||
if (!['darwin', 'linux'].includes(process.platform)) {
|
||||
this.skip();
|
||||
return;
|
||||
}
|
||||
|
||||
ifit(['darwin', 'linux'].includes(process.platform))('exits gracefully', async function () {
|
||||
const electronPath = process.execPath;
|
||||
const appPath = path.join(fixturesPath, 'api', 'singleton');
|
||||
appProcess = cp.spawn(electronPath, [appPath]);
|
||||
|
@ -409,13 +404,7 @@ describe('app module', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('app.setUserActivity(type, userInfo)', () => {
|
||||
before(function () {
|
||||
if (process.platform !== 'darwin') {
|
||||
this.skip();
|
||||
}
|
||||
});
|
||||
|
||||
ifdescribe(process.platform === 'darwin')('app.setUserActivity(type, userInfo)', () => {
|
||||
it('sets the current activity', () => {
|
||||
app.setUserActivity('com.electron.testActivity', { testData: '123' });
|
||||
expect(app.getCurrentActivityType()).to.equal('com.electron.testActivity');
|
||||
|
@ -737,9 +726,7 @@ describe('app module', () => {
|
|||
expect(app.getLoginItemSettings().openAtLogin).to.equal(false);
|
||||
});
|
||||
|
||||
it('correctly sets and unsets the LoginItem as hidden', function () {
|
||||
if (process.platform !== 'darwin') this.skip();
|
||||
|
||||
ifit(process.platform === 'darwin')('correctly sets and unsets the LoginItem as hidden', function () {
|
||||
expect(app.getLoginItemSettings().openAtLogin).to.equal(false);
|
||||
expect(app.getLoginItemSettings().openAsHidden).to.equal(false);
|
||||
|
||||
|
@ -1099,13 +1086,10 @@ describe('app module', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('select-client-certificate event', () => {
|
||||
ifdescribe(process.platform !== 'linux')('select-client-certificate event', () => {
|
||||
let w: BrowserWindow;
|
||||
|
||||
before(function () {
|
||||
if (process.platform === 'linux') {
|
||||
this.skip();
|
||||
}
|
||||
session.fromPartition('empty-certificate').setCertificateVerifyProc((req, cb) => { cb(0); });
|
||||
});
|
||||
|
||||
|
@ -1134,7 +1118,7 @@ describe('app module', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('setAsDefaultProtocolClient(protocol, path, args)', () => {
|
||||
ifdescribe(process.platform === 'win32')('setAsDefaultProtocolClient(protocol, path, args)', () => {
|
||||
const protocol = 'electron-test';
|
||||
const updateExe = path.resolve(path.dirname(process.execPath), '..', 'Update.exe');
|
||||
const processStartArgs = [
|
||||
|
@ -1146,16 +1130,12 @@ describe('app module', () => {
|
|||
let classesKey: any;
|
||||
|
||||
before(function () {
|
||||
if (process.platform !== 'win32') {
|
||||
this.skip();
|
||||
} else {
|
||||
Winreg = require('winreg');
|
||||
Winreg = require('winreg');
|
||||
|
||||
classesKey = new Winreg({
|
||||
hive: Winreg.HKCU,
|
||||
key: '\\Software\\Classes\\'
|
||||
});
|
||||
}
|
||||
classesKey = new Winreg({
|
||||
hive: Winreg.HKCU,
|
||||
key: '\\Software\\Classes\\'
|
||||
});
|
||||
});
|
||||
|
||||
after(function (done) {
|
||||
|
@ -1240,14 +1220,11 @@ describe('app module', () => {
|
|||
});
|
||||
|
||||
describe('getApplicationNameForProtocol()', () => {
|
||||
it('returns application names for common protocols', function () {
|
||||
// TODO: Linux CI doesn't have registered http & https handlers
|
||||
ifit(!(process.env.CI && process.platform === 'linux'))('returns application names for common protocols', function () {
|
||||
// We can't expect particular app names here, but these protocols should
|
||||
// at least have _something_ registered. Except on our Linux CI
|
||||
// environment apparently.
|
||||
if (process.platform === 'linux') {
|
||||
this.skip();
|
||||
}
|
||||
|
||||
const protocols = [
|
||||
'http://',
|
||||
'https://'
|
||||
|
@ -1492,28 +1469,25 @@ describe('app module', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('sandbox options', () => {
|
||||
ifdescribe(!(process.platform === 'linux' && (process.arch === 'arm64' || process.arch === 'arm')))('sandbox options', () => {
|
||||
// Our ARM tests are run on VSTS rather than CircleCI, and the Docker
|
||||
// setup on VSTS disallows syscalls that Chrome requires for setting up
|
||||
// sandboxing.
|
||||
// See:
|
||||
// - https://docs.docker.com/engine/security/seccomp/#significant-syscalls-blocked-by-the-default-profile
|
||||
// - https://chromium.googlesource.com/chromium/src/+/70.0.3538.124/sandbox/linux/services/credentials.cc#292
|
||||
// - https://github.com/docker/docker-ce/blob/ba7dfc59ccfe97c79ee0d1379894b35417b40bca/components/engine/profiles/seccomp/seccomp_default.go#L497
|
||||
// - https://blog.jessfraz.com/post/how-to-use-new-docker-seccomp-profiles/
|
||||
//
|
||||
// Adding `--cap-add SYS_ADMIN` or `--security-opt seccomp=unconfined`
|
||||
// to the Docker invocation allows the syscalls that Chrome needs, but
|
||||
// are probably more permissive than we'd like.
|
||||
|
||||
let appProcess: cp.ChildProcess = null as any;
|
||||
let server: net.Server = null as any;
|
||||
const socketPath = process.platform === 'win32' ? '\\\\.\\pipe\\electron-mixed-sandbox' : '/tmp/electron-mixed-sandbox';
|
||||
|
||||
beforeEach(function (done) {
|
||||
if (process.platform === 'linux' && (process.arch === 'arm64' || process.arch === 'arm')) {
|
||||
// Our ARM tests are run on VSTS rather than CircleCI, and the Docker
|
||||
// setup on VSTS disallows syscalls that Chrome requires for setting up
|
||||
// sandboxing.
|
||||
// See:
|
||||
// - https://docs.docker.com/engine/security/seccomp/#significant-syscalls-blocked-by-the-default-profile
|
||||
// - https://chromium.googlesource.com/chromium/src/+/70.0.3538.124/sandbox/linux/services/credentials.cc#292
|
||||
// - https://github.com/docker/docker-ce/blob/ba7dfc59ccfe97c79ee0d1379894b35417b40bca/components/engine/profiles/seccomp/seccomp_default.go#L497
|
||||
// - https://blog.jessfraz.com/post/how-to-use-new-docker-seccomp-profiles/
|
||||
//
|
||||
// Adding `--cap-add SYS_ADMIN` or `--security-opt seccomp=unconfined`
|
||||
// to the Docker invocation allows the syscalls that Chrome needs, but
|
||||
// are probably more permissive than we'd like.
|
||||
this.skip();
|
||||
return;
|
||||
}
|
||||
fs.unlink(socketPath, () => {
|
||||
server = net.createServer();
|
||||
server.listen(socketPath);
|
||||
|
@ -1613,8 +1587,7 @@ describe('app module', () => {
|
|||
});
|
||||
});
|
||||
|
||||
const dockDescribe = process.platform === 'darwin' ? describe : describe.skip;
|
||||
dockDescribe('dock APIs', () => {
|
||||
ifdescribe(process.platform === 'darwin')('dock APIs', () => {
|
||||
after(async () => {
|
||||
await app.dock.show();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue