1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

fix showing-details-for-helm-release tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-08-19 12:51:08 -04:00
parent 088934290b
commit 6a92ee2c7c
3 changed files with 118 additions and 47 deletions

View File

@ -596,14 +596,9 @@ exports[`showing details for helm release given application is started when navi
</div>
</div>
<div
class="NoItems flex box grow"
>
<div
class="box center"
>
Item list is empty
</div>
</div>
class="Spinner singleColor center"
data-testid="helm-releases-spinner"
/>
</div>
<div
class="AddRemoveButtons flex gaps"
@ -1412,6 +1407,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@ -1421,7 +1417,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@ -2162,6 +2160,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-namespace/some-name"
id="menu-actions-for-release-menu-for-some-namespace/some-name"
tabindex="0"
>
@ -2243,6 +2242,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-other-namespace/some-other-name"
id="menu-actions-for-release-menu-for-some-other-namespace/some-other-name"
tabindex="0"
>
@ -2323,6 +2323,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@ -2332,7 +2333,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@ -3073,6 +3076,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-namespace/some-name"
id="menu-actions-for-release-menu-for-some-namespace/some-name"
tabindex="0"
>
@ -3154,6 +3158,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-other-namespace/some-other-name"
id="menu-actions-for-release-menu-for-some-other-namespace/some-other-name"
tabindex="0"
>
@ -3234,6 +3239,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@ -3243,7 +3249,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@ -4045,6 +4053,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-namespace/some-name"
id="menu-actions-for-release-menu-for-some-namespace/some-name"
tabindex="0"
>
@ -4126,6 +4135,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-other-namespace/some-other-name"
id="menu-actions-for-release-menu-for-some-other-namespace/some-other-name"
tabindex="0"
>
@ -4206,6 +4216,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@ -4215,7 +4226,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@ -5017,6 +5030,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-namespace/some-name"
id="menu-actions-for-release-menu-for-some-namespace/some-name"
tabindex="0"
>
@ -5098,6 +5112,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-other-namespace/some-other-name"
id="menu-actions-for-release-menu-for-some-other-namespace/some-other-name"
tabindex="0"
>
@ -5178,6 +5193,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@ -5187,7 +5203,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@ -5288,6 +5306,7 @@ exports[`showing details for helm release given application is started when navi
>
<li
class="MenuItem"
data-testid="upgrade-chart-menu-item-for-some-namespace/some-name"
tabindex="0"
>
<i
@ -6243,6 +6262,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-namespace/some-name"
id="menu-actions-for-release-menu-for-some-namespace/some-name"
tabindex="0"
>
@ -6324,6 +6344,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-other-namespace/some-other-name"
id="menu-actions-for-release-menu-for-some-other-namespace/some-other-name"
tabindex="0"
>
@ -6404,6 +6425,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@ -6413,7 +6435,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@ -6514,6 +6538,7 @@ exports[`showing details for helm release given application is started when navi
>
<li
class="MenuItem"
data-testid="upgrade-chart-menu-item-for-some-namespace/some-name"
tabindex="0"
>
<i
@ -7469,6 +7494,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-namespace/some-name"
id="menu-actions-for-release-menu-for-some-namespace/some-name"
tabindex="0"
>
@ -7550,6 +7576,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-other-namespace/some-other-name"
id="menu-actions-for-release-menu-for-some-other-namespace/some-other-name"
tabindex="0"
>
@ -7630,6 +7657,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@ -7639,7 +7667,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@ -7740,6 +7770,7 @@ exports[`showing details for helm release given application is started when navi
>
<li
class="MenuItem"
data-testid="upgrade-chart-menu-item-for-some-namespace/some-name"
tabindex="0"
>
<i
@ -8683,6 +8714,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@ -8692,7 +8724,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@ -8793,6 +8827,7 @@ exports[`showing details for helm release given application is started when navi
>
<li
class="MenuItem"
data-testid="upgrade-chart-menu-item-for-some-namespace/some-name"
tabindex="0"
>
<i
@ -9736,6 +9771,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@ -9745,7 +9781,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@ -9846,6 +9884,7 @@ exports[`showing details for helm release given application is started when navi
>
<li
class="MenuItem"
data-testid="upgrade-chart-menu-item-for-some-namespace/some-name"
tabindex="0"
>
<i
@ -10803,6 +10842,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-namespace/some-name"
id="menu-actions-for-release-menu-for-some-namespace/some-name"
tabindex="0"
>
@ -10884,6 +10924,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-other-namespace/some-other-name"
id="menu-actions-for-release-menu-for-some-other-namespace/some-other-name"
tabindex="0"
>
@ -10964,6 +11005,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@ -10973,7 +11015,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@ -11074,6 +11118,7 @@ exports[`showing details for helm release given application is started when navi
>
<li
class="MenuItem"
data-testid="upgrade-chart-menu-item-for-some-namespace/some-name"
tabindex="0"
>
<i
@ -12029,6 +12074,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-namespace/some-name"
id="menu-actions-for-release-menu-for-some-namespace/some-name"
tabindex="0"
>
@ -12110,6 +12156,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-other-namespace/some-other-name"
id="menu-actions-for-release-menu-for-some-other-namespace/some-other-name"
tabindex="0"
>
@ -12190,6 +12237,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@ -12199,7 +12247,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@ -12239,6 +12289,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-some-tab-id"
tabindex="0"
>
<span
@ -12248,7 +12299,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-some-tab-id"
>
Close ⌘+W
</div>
</div>
@ -12998,6 +13051,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-namespace/some-name"
id="menu-actions-for-release-menu-for-some-namespace/some-name"
tabindex="0"
>
@ -13079,6 +13133,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-other-namespace/some-other-name"
id="menu-actions-for-release-menu-for-some-other-namespace/some-other-name"
tabindex="0"
>
@ -13159,6 +13214,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@ -13168,7 +13224,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@ -13973,6 +14031,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-namespace/some-name"
id="menu-actions-for-release-menu-for-some-namespace/some-name"
tabindex="0"
>
@ -14054,6 +14113,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-other-namespace/some-other-name"
id="menu-actions-for-release-menu-for-some-other-namespace/some-other-name"
tabindex="0"
>
@ -14134,6 +14194,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@ -14143,7 +14204,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@ -14884,6 +14947,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-namespace/some-name"
id="menu-actions-for-release-menu-for-some-namespace/some-name"
tabindex="0"
>
@ -14965,6 +15029,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-other-namespace/some-other-name"
id="menu-actions-for-release-menu-for-some-other-namespace/some-other-name"
tabindex="0"
>
@ -15045,6 +15110,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@ -15054,7 +15120,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>
@ -15856,6 +15924,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-namespace/some-name"
id="menu-actions-for-release-menu-for-some-namespace/some-name"
tabindex="0"
>
@ -15937,6 +16006,7 @@ exports[`showing details for helm release given application is started when navi
<div>
<i
class="Icon material interactive focusable"
data-testid="menu-actions-icon-for-release-menu-for-some-other-namespace/some-other-name"
id="menu-actions-for-release-menu-for-some-other-namespace/some-other-name"
tabindex="0"
>
@ -16017,6 +16087,7 @@ exports[`showing details for helm release given application is started when navi
>
<i
class="Icon material interactive focusable small"
data-testid="dock-tab-close-for-terminal"
tabindex="0"
>
<span
@ -16026,7 +16097,9 @@ exports[`showing details for helm release given application is started when navi
close
</span>
</i>
<div>
<div
data-testid="tooltip-content-for-dock-tab-close-for-terminal"
>
Close ⌘+W
</div>
</div>

View File

@ -11,8 +11,6 @@ import type { AsyncFnMock } from "@async-fn/jest";
import asyncFn from "@async-fn/jest";
import type { RequestHelmReleases } from "../../common/k8s-api/endpoints/helm-releases.api/request-releases.injectable";
import requestHelmReleasesInjectable from "../../common/k8s-api/endpoints/helm-releases.api/request-releases.injectable";
import namespaceStoreInjectable from "../../renderer/components/+namespaces/store.injectable";
import type { NamespaceStore } from "../../renderer/components/+namespaces/store";
import type { RequestHelmReleaseConfiguration } from "../../common/k8s-api/endpoints/helm-releases.api/request-configuration.injectable";
import requestHelmReleaseConfigurationInjectable from "../../common/k8s-api/endpoints/helm-releases.api/request-configuration.injectable";
import type { RequestHelmReleaseUpdate } from "../../common/k8s-api/endpoints/helm-releases.api/request-update.injectable";
@ -77,16 +75,12 @@ describe("showing details for helm release", () => {
windowDi.override(requestHelmChartVersionsInjectable, () => requestHelmChartVersionsMock);
windowDi.override(requestHelmChartReadmeInjectable, () => requestHelmChartReadmeMock);
windowDi.override(requestHelmChartValuesInjectable, () => requestHelmChartValuesMock);
windowDi.override(
namespaceStoreInjectable,
() =>
({
contextNamespaces: ["some-namespace", "some-other-namespace"],
items: [],
selectNamespaces: () => {},
} as unknown as NamespaceStore),
);
});
builder.namespaces.add("some-namespace");
builder.namespaces.select("some-namespace");
builder.namespaces.add("some-namespace");
builder.namespaces.select("some-other-namespace");
});
describe("given application is started", () => {

View File

@ -66,6 +66,7 @@ import closeAllWindowsInjectable from "../../../main/start-main-application/lens
import type { LensWindow } from "../../../main/start-main-application/lens-window/application-window/create-lens-window.injectable";
import type { FakeExtensionOptions } from "./get-extension-fake";
import { getExtensionFakeForMain, getExtensionFakeForRenderer } from "./get-extension-fake";
import namespaceApiInjectable from "../../../common/k8s-api/endpoints/namespace.api.injectable";
type Callback = (di: DiContainer) => void | Promise<void>;
@ -247,8 +248,8 @@ export const getApplicationBuilder = () => {
let applicationHasStarted = false;
const namespaces = observable.array<string>();
const selectedNamespaces = observable.array<string>();
const namespaces = observable.set<string>();
const selectedNamespaces = observable.set<string>();
const builder: ApplicationBuilder = {
mainDi,
@ -311,8 +312,8 @@ export const getApplicationBuilder = () => {
},
},
namespaces: {
add: action((namespace) => namespaces.push(namespace)),
select: action((namespace) => selectedNamespaces.push(namespace)),
add: action((namespace) => namespaces.add(namespace)),
select: action((namespace) => selectedNamespaces.add(namespace)),
},
applicationMenu: {
click: (path: string) => {
@ -476,22 +477,26 @@ export const getApplicationBuilder = () => {
computed(() => catalogEntityFromCluster(clusterStub)),
);
windowDi.override(hostedClusterIdInjectable, () => "irrelevant-hosted-cluster-id");
// TODO: Figure out a way to remove this stub.
const namespaceStoreStub = {
isLoaded: true,
contextNamespaces: selectedNamespaces,
allowedNamespaces: namespaces,
contextItems: [],
api: {
kind: "Namespace",
get contextNamespaces() {
return Array.from(selectedNamespaces);
},
items: [],
get allowedNamespaces() {
return Array.from(namespaces);
},
contextItems: [],
api: windowDi.inject(namespaceApiInjectable),
items: observable.array(),
selectNamespaces: () => {},
getByPath: () => undefined,
pickOnlySelected: () => [],
isSelectedAll: () => false,
getTotalCount: () => 0,
} as unknown as NamespaceStore;
} as Partial<NamespaceStore> as NamespaceStore;
const clusterFrameContextFake = new ClusterFrameContext(
clusterStub,
@ -503,7 +508,6 @@ export const getApplicationBuilder = () => {
windowDi.override(namespaceStoreInjectable, () => namespaceStoreStub);
windowDi.override(hostedClusterInjectable, () => clusterStub);
windowDi.override(hostedClusterIdInjectable, () => "irrelevant-hosted-cluster-id");
windowDi.override(clusterFrameContextInjectable, () => clusterFrameContextFake);
// Todo: get rid of global state.