Skip to content

Commit

Permalink
fix: Integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ashchan committed Oct 21, 2019
1 parent 02be3af commit 14008f6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
3 changes: 1 addition & 2 deletions packages/neuron-wallet/tests-e2e/application/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,7 @@ export default class Application {
async gotoSettingPageFromMenu() {
if (this.osPlatform.includes("darwin")) {
await this.clickMenu(['Electron', 'Preferences...'])
} else if(this.osPlatform.includes("win32")) {
this.wait(300)
} else {
await this.clickMenu(['Help', 'Settings'])
}
}
Expand Down
16 changes: 9 additions & 7 deletions packages/neuron-wallet/tests-e2e/application/preload.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const electron = require("electron");
const controllers_app = require("../../dist/controllers/app");
const services_networks = __importDefault(require("../../dist/services/networks"));
const CommandSubject = require("../../dist/models/subjects/command").default;
const servicesNetworks = require("../../dist/services/networks").default;

electron.ipcMain.on('E2E_EDIT_WALLET', function (event, arg) {
const walletId = arg[0];
// TODO: fix navTo
controllers_app.default.navTo(`/editwallet/${walletId}`);
const window = electron.BrowserWindow.getFocusedWindow()
CommandSubject.next({ winID: window.id, type: 'nav', payload: `/editwallet/${walletId}` })
});

electron.ipcMain.on('E2E_EDIT_NETWORK', function (event, arg) {
const networkId = arg[0];
// TODO: fix navTo
controllers_app.default.navTo(`/network/${networkId}`);
const window = electron.BrowserWindow.getFocusedWindow()
CommandSubject.next({ winID: window.id, type: 'nav', payload: `/network/${networkId}` })
});

electron.ipcMain.on('E2E_DELETE_NETWORK', function (event, arg) {
const networkId = arg[0];
const networksService = services_networks.default.getInstance();
const networksService = servicesNetworks.getInstance();
networksService.delete(networkId);
})

Expand All @@ -31,6 +31,7 @@ function findItem(menuItems, labels) {
}
return findItem(foundItem.submenu.items, rest);
}

electron.ipcMain.on('E2E_GET_MENU_ITEM', function (e, labels) {
var menuItem = findItem(electron.Menu.getApplicationMenu().items, labels);
if (menuItem) {
Expand All @@ -47,6 +48,7 @@ electron.ipcMain.on('E2E_GET_MENU_ITEM', function (e, labels) {
});
}
});

electron.ipcMain.on('E2E_CLICK_MENU_ITEM', function (e, labels) {
var item = findItem(electron.Menu.getApplicationMenu().items, labels);
item.click();
Expand Down
4 changes: 3 additions & 1 deletion packages/neuron-wallet/tests-e2e/tests/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ export default (app: Application) => {
await client.waitUntilWindowLoaded()

// Go to setting page
await app.gotoSettingPageFromMenu()
const networkElement = await app.element('//FOOTER/DIV[1]/DIV[2]')
expect(networkElement.value).not.toBeNull()
await client.elementIdClick(networkElement.value.ELEMENT)
await app.waitUntilLoaded()

// Switch to wallet setting
Expand Down

0 comments on commit 14008f6

Please sign in to comment.