chore: Fix desktop tests
This commit is contained in:
8 files changed
+33
-124
No files matched your search
@@ -46,7 +46,7 @@ export default class ApplicationRoute extends Route {
|
||||
/**
|
||||
* Add OS config on controller
|
||||
*/
|
||||
async setupController(controller, ...args) {
|
||||
async setupController(controller) {
|
||||
controller.set('isMacOS', await this.ipc.invoke('isMacOS'));
|
||||
controller.set('isWindowsOS', await this.ipc.invoke('isWindowsOS'));
|
||||
}
|
||||
|
||||
@@ -141,11 +141,12 @@
|
||||
|
||||
.rose-header {
|
||||
-webkit-app-region: drag;
|
||||
-webkit-user-select: none;
|
||||
min-height: sizing.rems(l) * 2;
|
||||
position: relative;
|
||||
-webkit-user-select: none;
|
||||
|
||||
.rose-header-brand, .rose-header-nav,
|
||||
.rose-header-brand,
|
||||
.rose-header-nav,
|
||||
.rose-header-utilities .rose-dropdown,
|
||||
.rose-header-utilities button {
|
||||
-webkit-app-region: no-drag;
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
{{page-title (app-name)}}
|
||||
|
||||
<Rose::Layout::Global class='{{if this.isWindowsOS ' layout-scroll'}}' as |layout|>
|
||||
<Rose::Layout::Global
|
||||
class='{{if this.isWindowsOS ' layout-scroll'}}'
|
||||
as |layout|
|
||||
>
|
||||
|
||||
<layout.header>
|
||||
<Rose::Header class='{{if (is-loading) ' loading'}} {{if this.isMacOS ' header-cushion'}}' as |header|>
|
||||
<Rose::Header
|
||||
class='{{if (is-loading) ' loading'}}
|
||||
{{if this.isMacOS ' header-cushion'}}'
|
||||
as |header|
|
||||
>
|
||||
<header.brand @logo='logo-app' @text={{app-name}} />
|
||||
{{#if this.session.isAuthenticated}}
|
||||
<header.nav>
|
||||
@@ -14,13 +21,19 @@
|
||||
<header.utilities as |utilities|>
|
||||
{{#if this.isWindowsOS}}
|
||||
<span class='utilities-actions'>
|
||||
<Rose::Button @iconOnly="minus-plain" @style="secondary"
|
||||
<Rose::Button
|
||||
@iconOnly='minus-plain'
|
||||
@style='secondary'
|
||||
{{on 'click' (route-action 'minimize')}}
|
||||
/>
|
||||
<Rose::Button @iconOnly="box-outline" @style="secondary"
|
||||
<Rose::Button
|
||||
@iconOnly='box-outline'
|
||||
@style='secondary'
|
||||
{{on 'click' (route-action 'toggleFullScreen')}}
|
||||
/>
|
||||
<Rose::Button @iconOnly="cancel-plain" @style="warning"
|
||||
<Rose::Button
|
||||
@iconOnly='cancel-plain'
|
||||
@style='warning'
|
||||
{{on 'click' (route-action 'close')}}
|
||||
/>
|
||||
</span>
|
||||
|
||||
@@ -199,17 +199,6 @@ app.on('before-quit', (event) => {
|
||||
|
||||
const buttonId = dialog.showMessageBoxSync(null, dialogOpts);
|
||||
buttonId === 0 ? sessionManager.stopAll() : event.preventDefault();
|
||||
|
||||
// console.log(returnValue.response);
|
||||
// switch (returnValue.response) {
|
||||
// case 0:
|
||||
// sessionManager.stopAll();
|
||||
// break;
|
||||
// default:
|
||||
// event.preventDefault();
|
||||
// break;
|
||||
// }
|
||||
// });
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -19,14 +19,12 @@ import {
|
||||
authenticateSession,
|
||||
invalidateSession,
|
||||
} from 'ember-simple-auth/test-support';
|
||||
import WindowMockIPC from '../helpers/window-mock-ipc';
|
||||
|
||||
module('Acceptance | authentication', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
|
||||
let mockIPC;
|
||||
let messageHandler;
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
global: null,
|
||||
@@ -102,41 +100,11 @@ module('Acceptance | authentication', function (hooks) {
|
||||
urls.targets = `${urls.projects}/targets`;
|
||||
urls.sessions = `${urls.projects}/sessions`;
|
||||
|
||||
class MockIPC {
|
||||
origin = null;
|
||||
|
||||
invoke(method, payload) {
|
||||
return this[method](payload);
|
||||
}
|
||||
|
||||
getOrigin() {
|
||||
return this.origin;
|
||||
}
|
||||
|
||||
setOrigin(origin) {
|
||||
this.origin = origin;
|
||||
return this.origin;
|
||||
}
|
||||
}
|
||||
|
||||
mockIPC = new MockIPC();
|
||||
messageHandler = async function (event) {
|
||||
if (event.origin !== window.location.origin) return;
|
||||
const { method, payload } = event.data;
|
||||
if (method) {
|
||||
const response = await mockIPC.invoke(method, payload);
|
||||
event.ports[0].postMessage(response);
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('message', messageHandler);
|
||||
// Mock the postMessage interface used by IPC.
|
||||
this.owner.register('service:browser/window', WindowMockIPC);
|
||||
setDefaultOrigin(this);
|
||||
});
|
||||
|
||||
hooks.afterEach(function () {
|
||||
window.removeEventListener('message', messageHandler);
|
||||
});
|
||||
|
||||
test('visiting index while unauthenticated redirects to global authenticate method', async function (assert) {
|
||||
assert.expect(2);
|
||||
await visit(urls.index);
|
||||
|
||||
@@ -18,14 +18,12 @@ import {
|
||||
authenticateSession,
|
||||
invalidateSession,
|
||||
} from 'ember-simple-auth/test-support';
|
||||
import WindowMockIPC from '../helpers/window-mock-ipc';
|
||||
|
||||
module('Acceptance | projects', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
|
||||
let mockIPC;
|
||||
let messageHandler;
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
global: null,
|
||||
@@ -103,41 +101,11 @@ module('Acceptance | projects', function (hooks) {
|
||||
urls.authenticate.methods.global = `${urls.authenticate.global}/${instances.authMethods.global.id}`;
|
||||
urls.projects = `${urls.scopes.org}/projects`;
|
||||
|
||||
class MockIPC {
|
||||
origin = null;
|
||||
|
||||
invoke(method, payload) {
|
||||
return this[method](payload);
|
||||
}
|
||||
|
||||
getOrigin() {
|
||||
return this.origin;
|
||||
}
|
||||
|
||||
setOrigin(origin) {
|
||||
this.origin = origin;
|
||||
return this.origin;
|
||||
}
|
||||
}
|
||||
|
||||
mockIPC = new MockIPC();
|
||||
messageHandler = async function (event) {
|
||||
if (event.origin !== window.location.origin) return;
|
||||
const { method, payload } = event.data;
|
||||
if (method) {
|
||||
const response = await mockIPC.invoke(method, payload);
|
||||
event.ports[0].postMessage(response);
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('message', messageHandler);
|
||||
// Mock the postMessage interface used by IPC.
|
||||
this.owner.register('service:browser/window', WindowMockIPC);
|
||||
setDefaultOrigin(this);
|
||||
});
|
||||
|
||||
hooks.afterEach(function () {
|
||||
window.removeEventListener('message', messageHandler);
|
||||
});
|
||||
|
||||
test('visiting index while unauthenticated redirects to global authenticate method', async function (assert) {
|
||||
invalidateSession();
|
||||
assert.expect(2);
|
||||
|
||||
@@ -19,14 +19,12 @@ import {
|
||||
authenticateSession,
|
||||
invalidateSession,
|
||||
} from 'ember-simple-auth/test-support';
|
||||
import WindowMockIPC from '../helpers/window-mock-ipc';
|
||||
|
||||
module('Acceptance | targets', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
|
||||
let mockIPC;
|
||||
let messageHandler;
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
global: null,
|
||||
@@ -106,41 +104,11 @@ module('Acceptance | targets', function (hooks) {
|
||||
urls.projects = `${urls.scopes.org}/projects`;
|
||||
urls.targets = `${urls.projects}/targets`;
|
||||
|
||||
class MockIPC {
|
||||
origin = null;
|
||||
|
||||
invoke(method, payload) {
|
||||
return this[method](payload);
|
||||
}
|
||||
|
||||
getOrigin() {
|
||||
return this.origin;
|
||||
}
|
||||
|
||||
setOrigin(origin) {
|
||||
this.origin = origin;
|
||||
return this.origin;
|
||||
}
|
||||
}
|
||||
|
||||
mockIPC = new MockIPC();
|
||||
messageHandler = async function (event) {
|
||||
if (event.origin !== window.location.origin) return;
|
||||
const { method, payload } = event.data;
|
||||
if (method) {
|
||||
const response = await mockIPC.invoke(method, payload);
|
||||
event.ports[0].postMessage(response);
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('message', messageHandler);
|
||||
// Mock the postMessage interface used by IPC.
|
||||
this.owner.register('service:browser/window', WindowMockIPC);
|
||||
setDefaultOrigin(this);
|
||||
});
|
||||
|
||||
hooks.afterEach(function () {
|
||||
window.removeEventListener('message', messageHandler);
|
||||
});
|
||||
|
||||
test('visiting index while unauthenticated redirects to global authenticate method', async function (assert) {
|
||||
invalidateSession();
|
||||
assert.expect(2);
|
||||
|
||||
@@ -17,6 +17,8 @@ class MockIPC {
|
||||
}
|
||||
|
||||
resetOrigin() {}
|
||||
isMacOS() {}
|
||||
isWindowsOS() {}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user