@eclipse-che/che-e2e 7.75.0-dev-d3da844 → 7.75.0-next-74f1046

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,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /** *******************************************************************
4
+ * copyright (c) 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 monaco_page_objects_1 = require("monaco-page-objects");
14
+ const inversify_types_1 = require("../../configs/inversify.types");
15
+ const BASE_TEST_CONSTANTS_1 = require("../../constants/BASE_TEST_CONSTANTS");
16
+ const chai_1 = require("chai");
17
+ const API_TEST_CONSTANTS_1 = require("../../constants/API_TEST_CONSTANTS");
18
+ const WorkspaceHandlingTests_1 = require("../../tests-library/WorkspaceHandlingTests");
19
+ const MochaHooks_1 = require("../MochaHooks");
20
+ const projectAndFileTests = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.ProjectAndFileTests);
21
+ const loginTests = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.LoginTests);
22
+ const browserTabsUtil = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.BrowserTabsUtil);
23
+ const dashboard = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.Dashboard);
24
+ const shellExecutor = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.ShellExecutor);
25
+ const workspaceHandlingTests = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.WorkspaceHandlingTests);
26
+ function executeArbitraryShellScript(command) {
27
+ const output = shellExecutor.executeCommand(command);
28
+ if (output.stderr.length > 0) {
29
+ chai_1.assert.fail(output.stderr);
30
+ }
31
+ return output.stdout;
32
+ }
33
+ suite('Workspace using a parent test suite', function () {
34
+ loginTests.loginIntoChe();
35
+ let podName = '';
36
+ test('Create a workspace using a parent', async function () {
37
+ const factoryUrl = `${BASE_TEST_CONSTANTS_1.BASE_TEST_CONSTANTS.TS_SELENIUM_BASE_URL}/dashboard/#https://github.com/testsfactory/parentDevfile`;
38
+ await dashboard.waitPage();
39
+ await browserTabsUtil.navigateTo(factoryUrl);
40
+ await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
41
+ (0, MochaHooks_1.registerRunningWorkspace)(WorkspaceHandlingTests_1.WorkspaceHandlingTests.getWorkspaceName());
42
+ await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
43
+ // sometimes the trust dialog does not appear at first time, for avoiding this problem we send click event for activating
44
+ await new monaco_page_objects_1.Workbench().click();
45
+ await projectAndFileTests.performTrustAuthorDialog();
46
+ });
47
+ test('Check cloning of the test project', async function () {
48
+ const expectedProjectItems = ['.devfile.yaml', 'parent.yaml', 'README.md'];
49
+ const visibleContent = await new monaco_page_objects_1.SideBarView().getContent().getSection('parentdevfile');
50
+ for (const expectedProjectItem of expectedProjectItems) {
51
+ const visibleItem = await visibleContent.findItem(expectedProjectItem);
52
+ (0, chai_1.expect)(visibleItem).not.equal(undefined);
53
+ }
54
+ });
55
+ test('Check devfile VS Code tasks ', async function () {
56
+ const input = await new monaco_page_objects_1.Workbench().openCommandPrompt();
57
+ await input.setText('>Tasks: Run Task');
58
+ const runTaskItem = await input.findQuickPick('Tasks: Run Task');
59
+ await (runTaskItem === null || runTaskItem === void 0 ? void 0 : runTaskItem.click());
60
+ const devFileTask = await input.findQuickPick('devfile');
61
+ await (devFileTask === null || devFileTask === void 0 ? void 0 : devFileTask.click());
62
+ const firstExpectedQuickPick = await input.findQuickPick('1. This command from the devfile');
63
+ const secondExpectedQuickPick = await input.findQuickPick('2. This command from the parent');
64
+ (0, chai_1.expect)(firstExpectedQuickPick).not.eqls(undefined);
65
+ (0, chai_1.expect)(secondExpectedQuickPick).not.eqls(undefined);
66
+ });
67
+ test('Check expected containers in the parent POD', function () {
68
+ const getPodNameCommand = `${API_TEST_CONSTANTS_1.API_TEST_CONSTANTS.TS_API_TEST_KUBERNETES_COMMAND_LINE_TOOL} get pods --selector=controller.devfile.io/devworkspace_name=sample-using-parent --output jsonpath=\'{.items[0].metadata.name}\'`;
69
+ podName = executeArbitraryShellScript(getPodNameCommand);
70
+ const containerNames = executeArbitraryShellScript(`${API_TEST_CONSTANTS_1.API_TEST_CONSTANTS.TS_API_TEST_KUBERNETES_COMMAND_LINE_TOOL} get pod ${podName} --output jsonpath=\'{.spec.containers[*].name}\'`);
71
+ (0, chai_1.expect)(containerNames).contain('tools');
72
+ (0, chai_1.expect)(containerNames).contains('che-gateway');
73
+ const initContainerName = executeArbitraryShellScript(`${API_TEST_CONSTANTS_1.API_TEST_CONSTANTS.TS_API_TEST_KUBERNETES_COMMAND_LINE_TOOL} get pod ${podName} --output jsonpath=\'{.spec.initContainers[].name}\'`);
74
+ (0, chai_1.expect)(initContainerName).contain('che-code-injector');
75
+ });
76
+ test('Check expected environment variables', function () {
77
+ const envList = executeArbitraryShellScript(`${API_TEST_CONSTANTS_1.API_TEST_CONSTANTS.TS_API_TEST_KUBERNETES_COMMAND_LINE_TOOL} exec -i ${podName} -c tools -- sh -c env`);
78
+ (0, chai_1.expect)(envList).contain('DEVFILE_ENV_VAR=true');
79
+ (0, chai_1.expect)(envList).contain('PARENT_ENV_VAR=true');
80
+ });
81
+ });
82
+ //# sourceMappingURL=WorkpaseUsingParent.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkpaseUsingParent.spec.js","sourceRoot":"","sources":["../../../specs/miscellaneous/WorkpaseUsingParent.spec.ts"],"names":[],"mappings":";;AAAA;;;;;;;;wEAQwE;AACxE,qEAA8D;AAE9D,6DAA2H;AAC3H,mEAAwD;AAKxD,6EAA0E;AAC1E,+BAAsC;AACtC,2EAAwE;AAExE,uFAAoF;AACpF,8CAAyD;AACz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inversify.types");
30
30
  const Logger_1 = require("../utils/Logger");
31
31
  const TIMEOUT_CONSTANTS_1 = require("../constants/TIMEOUT_CONSTANTS");
32
+ const monaco_page_objects_1 = require("monaco-page-objects");
33
+ const CheCodeLocatorLoader_1 = require("../pageobjects/ide/CheCodeLocatorLoader");
34
+ const webCheCodeLocators = new CheCodeLocatorLoader_1.CheCodeLocatorLoader().webCheCodeLocators;
32
35
  let ProjectAndFileTests = class ProjectAndFileTests {
33
36
  constructor(driverHelper) {
34
37
  this.driverHelper = driverHelper;
@@ -48,6 +51,18 @@ let ProjectAndFileTests = class ProjectAndFileTests {
48
51
  throw err;
49
52
  }
50
53
  }
54
+ async performTrustAuthorDialog() {
55
+ try {
56
+ const buttonYesITrustTheAuthors = 'Yes, I trust the authors';
57
+ await this.driverHelper.waitVisibility(webCheCodeLocators.WelcomeContent.button, TIMEOUT_CONSTANTS_1.TIMEOUT_CONSTANTS.TS_DIALOG_WINDOW_DEFAULT_TIMEOUT);
58
+ const trustedProjectDialog = new monaco_page_objects_1.ModalDialog();
59
+ Logger_1.Logger.debug(`trustedProjectDialog.pushButton: "${buttonYesITrustTheAuthors}"`);
60
+ await trustedProjectDialog.pushButton(buttonYesITrustTheAuthors);
61
+ }
62
+ catch (e) {
63
+ Logger_1.Logger.debug(`Welcome modal dialog was not shown: ${e}`);
64
+ }
65
+ }
51
66
  };
52
67
  ProjectAndFileTests = __decorate([
53
68
  (0, inversify_1.injectable)(),
@@ -1 +1 @@
1
- {"version":3,"file":"ProjectAndFileTests.js","sourceRoot":"","sources":["../../tests-library/ProjectAndFileTests.ts"],"names":[],"mappings":";AAAA;;;;;;;;wEAQwE;;;;;;;;;;;;;;;AAExE,4BAA0B;AAC1B,yCAA+C;AAC/C,2DAA+C;AAC/C,wDAAqD;AACrD,gEAAqD;AACrD,4CAAyC;AACzC,sEAAmE;AAG5D,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAC/B,YAEkB,YAA0B;QAA1B,iBAAY,GAAZ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,2BAAY;GAHhC,mBAAmB,CAmC/B;AAnCY,kDAAmB"}
package/package.json CHANGED
@@ -1,62 +1,61 @@
1
1
  {
2
- "name": "@eclipse-che/che-e2e",
3
- "version": "7.75.0-dev-d3da844",
4
- "description": "",
5
- "main": "dist/index.js",
6
- "scripts": {
7
- "lint": "eslint --fix .",
8
- "prettier": "prettier --config .prettierrc.json . --write",
9
- "tsc": "rm -rf ./dist && ./configs/sh-scripts/generateIndex.sh && tsc -p .",
10
- "test": "./configs/sh-scripts/initDefaultValues.sh npm run lint && npm run tsc && export USERSTORY=$USERSTORY && mocha --config dist/configs/mocharc.js",
11
- "driver-less-test": "export TS_USE_WEB_DRIVER_FOR_TEST=false && npm run test",
12
- "cleanup-docker": "if [ $(docker ps -a | grep -c selenium-e2e) -gt 0 ]; then docker rm -f $(docker ps --filter \"name=selenium-e2e\" -aq); fi;",
13
- "test-docker": "npm run cleanup-docker && docker run -it --shm-size=2g -p 5920:5920 --name selenium-e2e -e TS_SELENIUM_BASE_URL=$TS_SELENIUM_BASE_URL eclipse/che-e2e:nightly",
14
- "test-docker-mount-e2e": "npm run cleanup-docker && docker run -it --shm-size=2g -p 5920:5920 --name selenium-e2e -e TS_SELENIUM_BASE_URL=$TS_SELENIUM_BASE_URL -v $(pwd):/tmp/e2e:Z eclipse/che-e2e:nightly",
15
- "test-all-devfiles": " ./configs/sh-scripts/initDefaultValues.sh && ./configs/sh-scripts/initDevfileTests.sh",
16
- "devfile-acceptance-test-suite": "./configs/sh-scripts/initDefaultValues.sh npm run lint && npm run tsc && export TS_USE_WEB_DRIVER_FOR_TEST=false && mocha 'dist/specs/api/*.js' --config dist/configs/mocharc.js --delay --grep 'Devfile acceptance test suite'"
17
- },
18
- "author": "Ihor Okhrimenko (iokhrime@redhat.com)",
19
- "license": "ISC",
20
- "devDependencies": {
21
- "@eclipse-che/che-devworkspace-generator": "next",
22
- "@types/chai": "^4.3.4",
23
- "@types/clone-deep": "^4.0.1",
24
- "@types/mocha": "5.2.6",
25
- "@types/node": "11.13.4",
26
- "@types/rimraf": "2.0.2",
27
- "@types/selenium-webdriver": "4.1.3",
28
- "@types/shelljs": "^0.8.11",
29
- "@typescript-eslint/eslint-plugin": "^6.4.1",
30
- "@typescript-eslint/eslint-plugin-tslint": "^6.1.0",
31
- "@typescript-eslint/parser": "^6.1.0",
32
- "axios": "^0.25.0",
33
- "chai": "^4.3.4",
34
- "chromedriver": "^114.0.2",
35
- "clone-deep": "^4.0.1",
36
- "eslint": "^8.45.0",
37
- "eslint-config-prettier": "^8.10.0",
38
- "eslint-plugin-header": "^3.1.1",
39
- "eslint-plugin-jsdoc": "^46.5.0",
40
- "eslint-plugin-prettier": "^5.0.0",
41
- "husky": "^8.0.3",
42
- "mocha": "^9.1.3",
43
- "monaco-page-objects": "3.1.0",
44
- "prettier": "^3.0.2",
45
- "rimraf": "2.6.2",
46
- "selenium-webdriver": "4.4.0",
47
- "shelljs": "^0.8.5",
48
- "ts-node": "^10.9.1",
49
- "typescript": "4.9.4",
50
- "vscode-extension-tester-locators": "3.1.0",
51
- "yaml": "^2.2.2"
52
- },
53
- "dependencies": {
54
- "@eclipse-che/api": "latest",
55
- "inversify": "6.0.1",
56
- "reflect-metadata": "0.1.13",
57
- "@eclipse-che/che-devworkspace-generator": "7.75.0-SNAPSHOT"
58
- },
59
- "resolutions": {
60
- "minimist": "^1.2.5"
61
- }
2
+ "name": "@eclipse-che/che-e2e",
3
+ "version": "7.75.0-next-74f1046",
4
+ "description": "",
5
+ "main": "dist/index.js",
6
+ "scripts": {
7
+ "lint": "eslint --fix .",
8
+ "prettier": "prettier --config .prettierrc.json . --write",
9
+ "tsc": "rm -rf ./dist && ./configs/sh-scripts/generateIndex.sh && tsc -p .",
10
+ "test": "./configs/sh-scripts/initDefaultValues.sh npm run lint && npm run tsc && export USERSTORY=$USERSTORY && mocha --config dist/configs/mocharc.js",
11
+ "driver-less-test": "export TS_USE_WEB_DRIVER_FOR_TEST=false && npm run test",
12
+ "cleanup-docker": "if [ $(docker ps -a | grep -c selenium-e2e) -gt 0 ]; then docker rm -f $(docker ps --filter \"name=selenium-e2e\" -aq); fi;",
13
+ "test-docker": "npm run cleanup-docker && docker run -it --shm-size=2g -p 5920:5920 --name selenium-e2e -e TS_SELENIUM_BASE_URL=$TS_SELENIUM_BASE_URL eclipse/che-e2e:nightly",
14
+ "test-docker-mount-e2e": "npm run cleanup-docker && docker run -it --shm-size=2g -p 5920:5920 --name selenium-e2e -e TS_SELENIUM_BASE_URL=$TS_SELENIUM_BASE_URL -v $(pwd):/tmp/e2e:Z eclipse/che-e2e:nightly",
15
+ "test-all-devfiles": " ./configs/sh-scripts/initDefaultValues.sh && ./configs/sh-scripts/initDevfileTests.sh",
16
+ "devfile-acceptance-test-suite": "./configs/sh-scripts/initDefaultValues.sh npm run lint && npm run tsc && export TS_USE_WEB_DRIVER_FOR_TEST=false && mocha 'dist/specs/api/*.js' --config dist/configs/mocharc.js --delay --grep 'Devfile acceptance test suite'"
17
+ },
18
+ "author": "Ihor Okhrimenko (iokhrime@redhat.com)",
19
+ "license": "ISC",
20
+ "devDependencies": {
21
+ "@eclipse-che/che-devworkspace-generator": "next",
22
+ "@types/chai": "^4.3.4",
23
+ "@types/clone-deep": "^4.0.1",
24
+ "@types/mocha": "5.2.6",
25
+ "@types/node": "11.13.4",
26
+ "@types/rimraf": "2.0.2",
27
+ "@types/selenium-webdriver": "4.1.3",
28
+ "@types/shelljs": "^0.8.11",
29
+ "@typescript-eslint/eslint-plugin": "^6.4.1",
30
+ "@typescript-eslint/eslint-plugin-tslint": "^6.1.0",
31
+ "@typescript-eslint/parser": "^6.1.0",
32
+ "axios": "^0.25.0",
33
+ "chai": "^4.3.4",
34
+ "chromedriver": "^114.0.2",
35
+ "clone-deep": "^4.0.1",
36
+ "eslint": "^8.45.0",
37
+ "eslint-config-prettier": "^8.10.0",
38
+ "eslint-plugin-header": "^3.1.1",
39
+ "eslint-plugin-jsdoc": "^46.5.0",
40
+ "eslint-plugin-prettier": "^5.0.0",
41
+ "husky": "^8.0.3",
42
+ "mocha": "^9.1.3",
43
+ "monaco-page-objects": "3.9.1",
44
+ "prettier": "^3.0.2",
45
+ "rimraf": "2.6.2",
46
+ "selenium-webdriver": "4.6.1",
47
+ "shelljs": "^0.8.5",
48
+ "ts-node": "^10.9.1",
49
+ "typescript": "4.9.4",
50
+ "vscode-extension-tester-locators": "3.7.1",
51
+ "yaml": "^2.2.2"
52
+ },
53
+ "dependencies": {
54
+ "@eclipse-che/api": "latest",
55
+ "inversify": "6.0.1",
56
+ "reflect-metadata": "0.1.13"
57
+ },
58
+ "resolutions": {
59
+ "minimist": "^1.2.5"
60
+ }
62
61
  }
@@ -51,7 +51,7 @@ suite(`"Start workspace with existed workspace name" test`, function (): void {
51
51
  existedWorkspaceName = WorkspaceHandlingTests.getWorkspaceName();
52
52
  await workspaceHandlingTests.stopWorkspace(existedWorkspaceName);
53
53
  await browserTabsUtil.closeAllTabsExceptCurrent();
54
- });
54
+ });
55
55
 
56
56
  test(`Create new workspace from the same ${stackName} stack`, async function (): Promise<void> {
57
57
  existedWorkspaceName = WorkspaceHandlingTests.getWorkspaceName();
@@ -0,0 +1,99 @@
1
+ /** *******************************************************************
2
+ * copyright (c) 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 { ShellExecutor } from '../../utils/ShellExecutor';
12
+ import { InputBox, QuickOpenBox, QuickPickItem, SideBarView, ViewItem, ViewSection, Workbench } from 'monaco-page-objects';
13
+ import { CLASSES } from '../../configs/inversify.types';
14
+ import { ProjectAndFileTests } from '../../tests-library/ProjectAndFileTests';
15
+ import { LoginTests } from '../../tests-library/LoginTests';
16
+ import { Dashboard } from '../../pageobjects/dashboard/Dashboard';
17
+ import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
18
+ import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
19
+ import { assert, expect } from 'chai';
20
+ import { API_TEST_CONSTANTS } from '../../constants/API_TEST_CONSTANTS';
21
+ import { ShellString } from 'shelljs';
22
+ import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTests';
23
+ import { registerRunningWorkspace } from '../MochaHooks';
24
+ const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
25
+ const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
26
+ const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
27
+ const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard);
28
+ const shellExecutor: ShellExecutor = e2eContainer.get(CLASSES.ShellExecutor);
29
+ const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
30
+ function executeArbitraryShellScript(command: string): string {
31
+ const output: ShellString = shellExecutor.executeCommand(command);
32
+ if (output.stderr.length > 0) {
33
+ assert.fail(output.stderr);
34
+ }
35
+ return output.stdout;
36
+ }
37
+ suite('Workspace using a parent test suite', function (): void {
38
+ loginTests.loginIntoChe();
39
+ let podName: string = '';
40
+
41
+ test('Create a workspace using a parent', async function (): Promise<void> {
42
+ const factoryUrl: string = `${BASE_TEST_CONSTANTS.TS_SELENIUM_BASE_URL}/dashboard/#https://github.com/testsfactory/parentDevfile`;
43
+ await dashboard.waitPage();
44
+ await browserTabsUtil.navigateTo(factoryUrl);
45
+ await workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
46
+ registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName());
47
+ await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
48
+ // sometimes the trust dialog does not appear at first time, for avoiding this problem we send click event for activating
49
+ await new Workbench().click();
50
+ await projectAndFileTests.performTrustAuthorDialog();
51
+ });
52
+
53
+ test('Check cloning of the test project', async function (): Promise<void> {
54
+ const expectedProjectItems: string[] = ['.devfile.yaml', 'parent.yaml', 'README.md'];
55
+ const visibleContent: ViewSection = await new SideBarView().getContent().getSection('parentdevfile');
56
+
57
+ for (const expectedProjectItem of expectedProjectItems) {
58
+ const visibleItem: ViewItem | undefined = await visibleContent.findItem(expectedProjectItem);
59
+ expect(visibleItem).not.equal(undefined);
60
+ }
61
+ });
62
+
63
+ test('Check devfile VS Code tasks ', async function (): Promise<void> {
64
+ const input: QuickOpenBox | InputBox = await new Workbench().openCommandPrompt();
65
+ await input.setText('>Tasks: Run Task');
66
+ const runTaskItem: QuickPickItem | undefined = await input.findQuickPick('Tasks: Run Task');
67
+ await runTaskItem?.click();
68
+ const devFileTask: QuickPickItem | undefined = await input.findQuickPick('devfile');
69
+ await devFileTask?.click();
70
+ const firstExpectedQuickPick: QuickPickItem | undefined = await input.findQuickPick('1. This command from the devfile');
71
+ const secondExpectedQuickPick: QuickPickItem | undefined = await input.findQuickPick('2. This command from the parent');
72
+ expect(firstExpectedQuickPick).not.eqls(undefined);
73
+ expect(secondExpectedQuickPick).not.eqls(undefined);
74
+ });
75
+
76
+ test('Check expected containers in the parent POD', function (): void {
77
+ const getPodNameCommand: string = `${API_TEST_CONSTANTS.TS_API_TEST_KUBERNETES_COMMAND_LINE_TOOL} get pods --selector=controller.devfile.io/devworkspace_name=sample-using-parent --output jsonpath=\'{.items[0].metadata.name}\'`;
78
+
79
+ podName = executeArbitraryShellScript(getPodNameCommand);
80
+ const containerNames: string = executeArbitraryShellScript(
81
+ `${API_TEST_CONSTANTS.TS_API_TEST_KUBERNETES_COMMAND_LINE_TOOL} get pod ${podName} --output jsonpath=\'{.spec.containers[*].name}\'`
82
+ );
83
+ expect(containerNames).contain('tools');
84
+ expect(containerNames).contains('che-gateway');
85
+
86
+ const initContainerName: string = executeArbitraryShellScript(
87
+ `${API_TEST_CONSTANTS.TS_API_TEST_KUBERNETES_COMMAND_LINE_TOOL} get pod ${podName} --output jsonpath=\'{.spec.initContainers[].name}\'`
88
+ );
89
+ expect(initContainerName).contain('che-code-injector');
90
+ });
91
+
92
+ test('Check expected environment variables', function (): void {
93
+ const envList: string = executeArbitraryShellScript(
94
+ `${API_TEST_CONSTANTS.TS_API_TEST_KUBERNETES_COMMAND_LINE_TOOL} exec -i ${podName} -c tools -- sh -c env`
95
+ );
96
+ expect(envList).contain('DEVFILE_ENV_VAR=true');
97
+ expect(envList).contain('PARENT_ENV_VAR=true');
98
+ });
99
+ });
@@ -15,6 +15,10 @@ import { DriverHelper } from '../utils/DriverHelper';
15
15
  import { CLASSES } from '../configs/inversify.types';
16
16
  import { Logger } from '../utils/Logger';
17
17
  import { TIMEOUT_CONSTANTS } from '../constants/TIMEOUT_CONSTANTS';
18
+ import { Locators, ModalDialog } from 'monaco-page-objects';
19
+ import { CheCodeLocatorLoader } from '../pageobjects/ide/CheCodeLocatorLoader';
20
+
21
+ const webCheCodeLocators: Locators = new CheCodeLocatorLoader().webCheCodeLocators;
18
22
 
19
23
  @injectable()
20
24
  export class ProjectAndFileTests {
@@ -37,4 +41,19 @@ export class ProjectAndFileTests {
37
41
  throw err;
38
42
  }
39
43
  }
44
+
45
+ async performTrustAuthorDialog(): Promise<void> {
46
+ try {
47
+ const buttonYesITrustTheAuthors: string = 'Yes, I trust the authors';
48
+ await this.driverHelper.waitVisibility(
49
+ webCheCodeLocators.WelcomeContent.button,
50
+ TIMEOUT_CONSTANTS.TS_DIALOG_WINDOW_DEFAULT_TIMEOUT
51
+ );
52
+ const trustedProjectDialog: ModalDialog = new ModalDialog();
53
+ Logger.debug(`trustedProjectDialog.pushButton: "${buttonYesITrustTheAuthors}"`);
54
+ await trustedProjectDialog.pushButton(buttonYesITrustTheAuthors);
55
+ } catch (e) {
56
+ Logger.debug(`Welcome modal dialog was not shown: ${e}`);
57
+ }
58
+ }
40
59
  }