mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
addded Preferences page helm repo test
Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>
This commit is contained in:
parent
d8297e44bc
commit
8b36349951
@ -47,18 +47,25 @@ describe("Lens integration tests", () => {
|
|||||||
await clickWhatsNew(app)
|
await clickWhatsNew(app)
|
||||||
})
|
})
|
||||||
|
|
||||||
// Todo figure out how to access main menu to get these to work
|
|
||||||
it('shows "add cluster"', async () => {
|
it('shows "add cluster"', async () => {
|
||||||
await app.electron.ipcRenderer.send('test-menu-item-click', "File", "Add Cluster")
|
await app.electron.ipcRenderer.send('test-menu-item-click', "File", "Add Cluster")
|
||||||
await app.client.waitUntilTextExists("h2", "Add Cluster")
|
await app.client.waitUntilTextExists("h2", "Add Cluster")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe("preferences page", () => {
|
||||||
it('shows "preferences"', async () => {
|
it('shows "preferences"', async () => {
|
||||||
let appName: string = process.platform === "darwin" ? "Lens" : "File"
|
let appName: string = process.platform === "darwin" ? "Lens" : "File"
|
||||||
await app.electron.ipcRenderer.send('test-menu-item-click', appName, "Preferences")
|
await app.electron.ipcRenderer.send('test-menu-item-click', appName, "Preferences")
|
||||||
await app.client.waitUntilTextExists("h2", "Preferences")
|
await app.client.waitUntilTextExists("h2", "Preferences")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('ensures helm repos', async () => {
|
||||||
|
await app.client.waitUntilTextExists("div.repos #message-stable", "stable") // wait for the helm-cli to fetch the stable repo
|
||||||
|
await app.client.click("#HelmRepoSelect") // click the repo select to activate the drop-down
|
||||||
|
await app.client.waitUntilTextExists("div.Select__option", "") // wait for at least one option to appear (any text)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
it.skip('quits Lens"', async () => {
|
it.skip('quits Lens"', async () => {
|
||||||
await app.client.keys(['Meta', 'Q'])
|
await app.client.keys(['Meta', 'Q'])
|
||||||
await app.client.keys('Meta')
|
await app.client.keys('Meta')
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { app, BrowserWindow, dialog, ipcMain, IpcMainEvent, Menu, MenuItem, MenuItemConstructorOptions, webContents, shell } from "electron"
|
import { app, BrowserWindow, dialog, ipcMain, IpcMainEvent, Menu, MenuItem, MenuItemConstructorOptions, webContents, shell } from "electron"
|
||||||
import { autorun } from "mobx";
|
import { autorun } from "mobx";
|
||||||
import { WindowManager } from "./window-manager";
|
import { WindowManager } from "./window-manager";
|
||||||
import { appName, isMac, isWindows } from "../common/vars";
|
import { appName, isMac, isWindows, isTestEnv } from "../common/vars";
|
||||||
import { addClusterURL } from "../renderer/components/+add-cluster/add-cluster.route";
|
import { addClusterURL } from "../renderer/components/+add-cluster/add-cluster.route";
|
||||||
import { preferencesURL } from "../renderer/components/+preferences/preferences.route";
|
import { preferencesURL } from "../renderer/components/+preferences/preferences.route";
|
||||||
import { whatsNewURL } from "../renderer/components/+whats-new/whats-new.route";
|
import { whatsNewURL } from "../renderer/components/+whats-new/whats-new.route";
|
||||||
@ -236,7 +236,9 @@ export function buildMenu(windowManager: WindowManager) {
|
|||||||
const menu = Menu.buildFromTemplate(Object.values(appMenu));
|
const menu = Menu.buildFromTemplate(Object.values(appMenu));
|
||||||
Menu.setApplicationMenu(menu);
|
Menu.setApplicationMenu(menu);
|
||||||
|
|
||||||
if (!!process.env.JEST_WORKER_ID) {
|
if (isTestEnv) {
|
||||||
|
// this is a workaround for the test environment (spectron) not being able to directly access
|
||||||
|
// the application menus (https://github.com/electron-userland/spectron/issues/21)
|
||||||
ipcMain.on('test-menu-item-click', (event: IpcMainEvent, ...names: string[]) => {
|
ipcMain.on('test-menu-item-click', (event: IpcMainEvent, ...names: string[]) => {
|
||||||
let menu: Menu = Menu.getApplicationMenu()
|
let menu: Menu = Menu.getApplicationMenu()
|
||||||
const parentLabels: string[] = [];
|
const parentLabels: string[] = [];
|
||||||
@ -251,18 +253,19 @@ export function buildMenu(windowManager: WindowManager) {
|
|||||||
menu = menuItem.submenu;
|
menu = menuItem.submenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let menuPath: string = parentLabels.join(" -> ")
|
||||||
if (!menuItem) {
|
if (!menuItem) {
|
||||||
logger.info(`[MENU:test-menu-item-click] Cannot find menu item ${parentLabels.join(" -> ")}`);
|
logger.info(`[MENU:test-menu-item-click] Cannot find menu item ${menuPath}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { enabled, visible, click } = menuItem;
|
const { enabled, visible, click } = menuItem;
|
||||||
if (enabled === false || visible === false || typeof click !== 'function') {
|
if (enabled === false || visible === false || typeof click !== 'function') {
|
||||||
logger.info(`[MENU:test-menu-item-click] Menu item ${parentLabels.join(" -> ")} not clickable`);
|
logger.info(`[MENU:test-menu-item-click] Menu item ${menuPath} not clickable`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info(`[MENU:test-menu-item-click] Menu item ${parentLabels.join(" -> ")} click!`);
|
logger.info(`[MENU:test-menu-item-click] Menu item ${menuPath} click!`);
|
||||||
menuItem.click();
|
menuItem.click();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -128,7 +128,7 @@ export class Preferences extends React.Component {
|
|||||||
<KubectlBinaries preferences={preferences}/>
|
<KubectlBinaries preferences={preferences}/>
|
||||||
|
|
||||||
<h2><Trans>Helm</Trans></h2>
|
<h2><Trans>Helm</Trans></h2>
|
||||||
<Select
|
<Select id="HelmRepoSelect"
|
||||||
placeholder={<Trans>Repositories</Trans>}
|
placeholder={<Trans>Repositories</Trans>}
|
||||||
isLoading={this.helmLoading}
|
isLoading={this.helmLoading}
|
||||||
isDisabled={this.helmLoading}
|
isDisabled={this.helmLoading}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user