mirror of
https://github.com/balena-io/etcher.git
synced 2025-04-24 15:27:17 +00:00
Disable spectron tests on macOS
Change-type: patch
This commit is contained in:
parent
d0c66b2c48
commit
3be372d49f
@ -15,46 +15,52 @@
|
||||
*/
|
||||
|
||||
import { expect } from 'chai';
|
||||
import { platform } from 'os';
|
||||
import { Application } from 'spectron';
|
||||
import * as electronPath from 'electron';
|
||||
|
||||
describe('Spectron', function () {
|
||||
// Mainly for CI jobs
|
||||
this.timeout(40000);
|
||||
// TODO: spectron fails to start on the CI with:
|
||||
// Error: Failed to create session.
|
||||
// unknown error: Chrome failed to start: exited abnormally
|
||||
if (platform() !== 'darwin') {
|
||||
describe('Spectron', function () {
|
||||
// Mainly for CI jobs
|
||||
this.timeout(40000);
|
||||
|
||||
const app = new Application({
|
||||
path: (electronPath as unknown) as string,
|
||||
args: ['--no-sandbox', '.'],
|
||||
});
|
||||
|
||||
before('app:start', async () => {
|
||||
await app.start();
|
||||
});
|
||||
|
||||
after('app:stop', async () => {
|
||||
if (app && app.isRunning()) {
|
||||
await app.stop();
|
||||
}
|
||||
});
|
||||
|
||||
describe('Browser Window', () => {
|
||||
it('should open a browser window', async () => {
|
||||
// We can't use `isVisible()` here as it won't work inside
|
||||
// a Windows Docker container, but we can approximate it
|
||||
// with these set of checks:
|
||||
const bounds = await app.browserWindow.getBounds();
|
||||
expect(bounds.height).to.be.above(0);
|
||||
expect(bounds.width).to.be.above(0);
|
||||
expect(await app.browserWindow.isMinimized()).to.be.false;
|
||||
expect(
|
||||
(await app.browserWindow.isVisible()) ||
|
||||
(await app.browserWindow.isFocused()),
|
||||
).to.be.true;
|
||||
const app = new Application({
|
||||
path: (electronPath as unknown) as string,
|
||||
args: ['--no-sandbox', '.'],
|
||||
});
|
||||
|
||||
it('should set a proper title', async () => {
|
||||
// @ts-ignore (SpectronClient.getTitle exists)
|
||||
return expect(await app.client.getTitle()).to.equal('Etcher');
|
||||
before('app:start', async () => {
|
||||
await app.start();
|
||||
});
|
||||
|
||||
after('app:stop', async () => {
|
||||
if (app && app.isRunning()) {
|
||||
await app.stop();
|
||||
}
|
||||
});
|
||||
|
||||
describe('Browser Window', () => {
|
||||
it('should open a browser window', async () => {
|
||||
// We can't use `isVisible()` here as it won't work inside
|
||||
// a Windows Docker container, but we can approximate it
|
||||
// with these set of checks:
|
||||
const bounds = await app.browserWindow.getBounds();
|
||||
expect(bounds.height).to.be.above(0);
|
||||
expect(bounds.width).to.be.above(0);
|
||||
expect(await app.browserWindow.isMinimized()).to.be.false;
|
||||
expect(
|
||||
(await app.browserWindow.isVisible()) ||
|
||||
(await app.browserWindow.isFocused()),
|
||||
).to.be.true;
|
||||
});
|
||||
|
||||
it('should set a proper title', async () => {
|
||||
// @ts-ignore (SpectronClient.getTitle exists)
|
||||
return expect(await app.client.getTitle()).to.equal('Etcher');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user