@eclipse-che/che-e2e 7.76.0-next-0811b7e → 7.76.0-next-d5f1527

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /** *******************************************************************
4
+ * copyright (c) 2020-2023 Red Hat, Inc.
5
+ *
6
+ * This program and the accompanying materials are made
7
+ * available under the terms of the Eclipse Public License 2.0
8
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
9
+ *
10
+ * SPDX-License-Identifier: EPL-2.0
11
+ **********************************************************************/
12
+ const inversify_config_1 = require("../../configs/inversify.config");
13
+ const inversify_types_1 = require("../../configs/inversify.types");
14
+ const WorkspaceHandlingTests_1 = require("../../tests-library/WorkspaceHandlingTests");
15
+ const MochaHooks_1 = require("../MochaHooks");
16
+ const TIMEOUT_CONSTANTS_1 = require("../../constants/TIMEOUT_CONSTANTS");
17
+ const monaco_page_objects_1 = require("monaco-page-objects");
18
+ const chai_1 = require("chai");
19
+ suite('"Check workspace idle timeout" test', function () {
20
+ const workspaceHandlingTests = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.WorkspaceHandlingTests);
21
+ const projectAndFileTests = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.ProjectAndFileTests);
22
+ const loginTests = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.LoginTests);
23
+ const dashboard = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.Dashboard);
24
+ const workspaces = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.Workspaces);
25
+ const driverHelper = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.DriverHelper);
26
+ const cheCodeLocatorLoader = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.CheCodeLocatorLoader);
27
+ const webCheCodeLocators = cheCodeLocatorLoader.webCheCodeLocators;
28
+ const kubernetesCommandLineToolsExecutor = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.KubernetesCommandLineToolsExecutor);
29
+ const shellExecutor = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.ShellExecutor);
30
+ const stackName = 'Empty Workspace';
31
+ const cheClusterName = 'devspaces';
32
+ let stopWorkspaceTimeout = 0;
33
+ suiteSetup(function () {
34
+ kubernetesCommandLineToolsExecutor.loginToOcp('admin');
35
+ shellExecutor.executeCommand('oc project openshift-devspaces');
36
+ // get current value of spec.devEnvironments.secondsOfInactivityBeforeIdling
37
+ stopWorkspaceTimeout = Number(shellExecutor.executeCommand(`oc get checluster/${cheClusterName} -o "jsonpath={.spec.devEnvironments.secondsOfInactivityBeforeIdling}"`));
38
+ // set spec.devEnvironments.secondsOfInactivityBeforeIdling to 60
39
+ shellExecutor.executeCommand(`oc patch checluster ${cheClusterName} --type=merge -p '{"spec":{"devEnvironments":{"secondsOfInactivityBeforeIdling": 60}}}'`);
40
+ });
41
+ suiteTeardown(function () {
42
+ // restore spec.devEnvironments.secondsOfInactivityBeforeIdling to original value
43
+ shellExecutor.executeCommand(`oc patch checluster ${cheClusterName} --type=merge -p '{"spec":{"devEnvironments":{"secondsOfInactivityBeforeIdling": ${stopWorkspaceTimeout}}}}'`);
44
+ });
45
+ loginTests.loginIntoChe();
46
+ test(`Create and open new workspace, stack:${stackName}`, async function () {
47
+ await workspaceHandlingTests.createAndOpenWorkspace(stackName);
48
+ await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
49
+ });
50
+ test('Wait workspace readiness', async function () {
51
+ (0, MochaHooks_1.registerRunningWorkspace)(WorkspaceHandlingTests_1.WorkspaceHandlingTests.getWorkspaceName());
52
+ await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
53
+ await projectAndFileTests.performTrustAuthorDialog();
54
+ });
55
+ test('Wait idle timeout dialog and click on "Return to Dashboard" button', async function () {
56
+ await driverHelper.waitVisibility(webCheCodeLocators.Dialog.details, TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_SELENIUM_START_WORKSPACE_TIMEOUT);
57
+ const dialog = new monaco_page_objects_1.ModalDialog();
58
+ (0, chai_1.expect)(await dialog.getDetails()).includes('Your workspace has stopped due to inactivity.');
59
+ await dialog.pushButton('Return to dashboard');
60
+ });
61
+ test('Check that the workskpace has Stopped state', async function () {
62
+ await dashboard.waitPage();
63
+ await workspaces.waitWorkspaceWithStoppedStatus(WorkspaceHandlingTests_1.WorkspaceHandlingTests.getWorkspaceName());
64
+ });
65
+ test('Delete the workspace', async function () {
66
+ await dashboard.deleteStoppedWorkspaceByUI(WorkspaceHandlingTests_1.WorkspaceHandlingTests.getWorkspaceName());
67
+ });
68
+ loginTests.logoutFromChe();
69
+ });
70
+ //# sourceMappingURL=WorkspaceIdleTimeout.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkspaceIdleTimeout.spec.js","sourceRoot":"","sources":["../../../specs/miscellaneous/WorkspaceIdleTimeout.spec.ts"],"names":[],"mappings":";;AAAA;;;;;;;;wEAQwE;AACxE,qEAA8D;AAC9D,mEAAwD;AACxD,uFAAoF;AAGpF,8CAAyD;AAGzD,yEAAsE;AAGtE,6DAA4D;AAC5D,+BAA8B;AAI9B,KAAK,CAAC,qCAAqC,EAAE;IAC5C,MAAM,sBAAsB,GAA2B,+BAAY,CAAC,GAAG,CAAC,yBAAO,CAAC,sBAAsB,CAAC,CAAC;IACxG,MAAM,mBAAmB,GAAwB,+BAAY,CAAC,GAAG,CAAC,yBAAO,CAAC,mBAAmB,CAAC,CAAC;IAC/F,MAAM,UAAU,GAAe,+BAAY,CAAC,GAAG,CAAC,yBAAO,CAAC,UAAU,CAAC,CAAC;IACpE,MAAM,SAAS,GAAc,+BAAY,CAAC,GAAG,CAAC,yBAAO,CAAC,SAAS,CAAC,CAAC;IACjE,MAAM,UAAU,GAAe,+BAAY,CAAC,GAAG,CAAC,yBAAO,CAAC,UAAU,CAAC,CAAC;IACpE,MAAM,YAAY,GAAiB,+BAAY,CAAC,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C,+CAAsB,CAAC,gBAAgB,EAAE,CAAC,CAAC;QACpE,MAAM,mBAAmB,CAAC,sCAAsC,EAAE,CAAC;QACnE,MAAM,mBAAmB,CAAC,wBAAwB,EAAE,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,oEAAoE,EAAE,KAAK;QAC/E,MAAM,YAAY,CAAC,cAAc,CAAC,kBAAkB,CAAC,MAAM,CAAC,OAAO,EAAE,qCAAiB,CAAC,mCAAmC,CAAC,CAAC;QAC5H,MAAM,MAAM,GAAgB,IAAI,iCAAW,EAAE,CAAC;QAC9C,IAAA,aAAM,EAAC,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,+CAA+C,CAAC,CAAC;QAC5F,MAAM,MAAM,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,6CAA6C,EAAE,KAAK;QACxD,MAAM,SAAS,CAAC,QAAQ,EAAE,CAAC;QAC3B,MAAM,UAAU,CAAC,8BAA8B,CAAC,+CAAsB,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC5F,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,sBAAsB,EAAE,KAAK;QACjC,MAAM,SAAS,CAAC,0BAA0B,CAAC,+CAAsB,CAAC,gBAAgB,EAAE,CAAC,CAAC;IACvF,CAAC,CAAC,CAAC;IAEH,UAAU,CAAC,aAAa,EAAE,CAAC;AAC5B,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eclipse-che/che-e2e",
3
- "version": "7.76.0-next-0811b7e",
3
+ "version": "7.76.0-next-d5f1527",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -0,0 +1,98 @@
1
+ /** *******************************************************************
2
+ * copyright (c) 2020-2023 Red Hat, Inc.
3
+ *
4
+ * This program and the accompanying materials are made
5
+ * available under the terms of the Eclipse Public License 2.0
6
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
7
+ *
8
+ * SPDX-License-Identifier: EPL-2.0
9
+ **********************************************************************/
10
+ import { e2eContainer } from '../../configs/inversify.config';
11
+ import { CLASSES } from '../../configs/inversify.types';
12
+ import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTests';
13
+ import { ProjectAndFileTests } from '../../tests-library/ProjectAndFileTests';
14
+ import { LoginTests } from '../../tests-library/LoginTests';
15
+ import { registerRunningWorkspace } from '../MochaHooks';
16
+ import { Dashboard } from '../../pageobjects/dashboard/Dashboard';
17
+ import { Workspaces } from '../../pageobjects/dashboard/Workspaces';
18
+ import { TIMEOUT_CONSTANTS } from '../../constants/TIMEOUT_CONSTANTS';
19
+ import { DriverHelper } from '../../utils/DriverHelper';
20
+ import { CheCodeLocatorLoader } from '../../pageobjects/ide/CheCodeLocatorLoader';
21
+ import { Locators, ModalDialog } from 'monaco-page-objects';
22
+ import { expect } from 'chai';
23
+ import { KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor';
24
+ import { ShellExecutor } from '../../utils/ShellExecutor';
25
+
26
+ suite('"Check workspace idle timeout" test', function (): void {
27
+ const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
28
+ const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
29
+ const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
30
+ const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard);
31
+ const workspaces: Workspaces = e2eContainer.get(CLASSES.Workspaces);
32
+ const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
33
+ const cheCodeLocatorLoader: CheCodeLocatorLoader = e2eContainer.get(CLASSES.CheCodeLocatorLoader);
34
+ const webCheCodeLocators: Locators = cheCodeLocatorLoader.webCheCodeLocators;
35
+ const kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor = e2eContainer.get(
36
+ CLASSES.KubernetesCommandLineToolsExecutor
37
+ );
38
+ const shellExecutor: ShellExecutor = e2eContainer.get(CLASSES.ShellExecutor);
39
+
40
+ const stackName: string = 'Empty Workspace';
41
+ const cheClusterName: string = 'devspaces';
42
+ let stopWorkspaceTimeout: number = 0;
43
+
44
+ suiteSetup(function (): void {
45
+ kubernetesCommandLineToolsExecutor.loginToOcp('admin');
46
+ shellExecutor.executeCommand('oc project openshift-devspaces');
47
+
48
+ // get current value of spec.devEnvironments.secondsOfInactivityBeforeIdling
49
+ stopWorkspaceTimeout = Number(
50
+ shellExecutor.executeCommand(
51
+ `oc get checluster/${cheClusterName} -o "jsonpath={.spec.devEnvironments.secondsOfInactivityBeforeIdling}"`
52
+ )
53
+ );
54
+
55
+ // set spec.devEnvironments.secondsOfInactivityBeforeIdling to 60
56
+ shellExecutor.executeCommand(
57
+ `oc patch checluster ${cheClusterName} --type=merge -p '{"spec":{"devEnvironments":{"secondsOfInactivityBeforeIdling": 60}}}'`
58
+ );
59
+ });
60
+
61
+ suiteTeardown(function (): void {
62
+ // restore spec.devEnvironments.secondsOfInactivityBeforeIdling to original value
63
+ shellExecutor.executeCommand(
64
+ `oc patch checluster ${cheClusterName} --type=merge -p '{"spec":{"devEnvironments":{"secondsOfInactivityBeforeIdling": ${stopWorkspaceTimeout}}}}'`
65
+ );
66
+ });
67
+
68
+ loginTests.loginIntoChe();
69
+
70
+ test(`Create and open new workspace, stack:${stackName}`, async function (): Promise<void> {
71
+ await workspaceHandlingTests.createAndOpenWorkspace(stackName);
72
+ await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
73
+ });
74
+
75
+ test('Wait workspace readiness', async function (): Promise<void> {
76
+ registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName());
77
+ await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
78
+ await projectAndFileTests.performTrustAuthorDialog();
79
+ });
80
+
81
+ test('Wait idle timeout dialog and click on "Return to Dashboard" button', async function (): Promise<void> {
82
+ await driverHelper.waitVisibility(webCheCodeLocators.Dialog.details, TIMEOUT_CONSTANTS.TS_SELENIUM_START_WORKSPACE_TIMEOUT);
83
+ const dialog: ModalDialog = new ModalDialog();
84
+ expect(await dialog.getDetails()).includes('Your workspace has stopped due to inactivity.');
85
+ await dialog.pushButton('Return to dashboard');
86
+ });
87
+
88
+ test('Check that the workskpace has Stopped state', async function (): Promise<void> {
89
+ await dashboard.waitPage();
90
+ await workspaces.waitWorkspaceWithStoppedStatus(WorkspaceHandlingTests.getWorkspaceName());
91
+ });
92
+
93
+ test('Delete the workspace', async function (): Promise<void> {
94
+ await dashboard.deleteStoppedWorkspaceByUI(WorkspaceHandlingTests.getWorkspaceName());
95
+ });
96
+
97
+ loginTests.logoutFromChe();
98
+ });