New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@eclipse-che/che-e2e

Package Overview
Dependencies
Maintainers
5
Versions
378
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eclipse-che/che-e2e - npm Package Compare versions

Comparing version

to
7.41.0-dev-cd64105

mocha-all-devfiles.json

97

dist/tests/e2e_happy_path/DevWorkspaceHappyPath.spec.js
"use strict";
// /*********************************************************************
// * Copyright (c) 2021 Red Hat, Inc.
// *
// * This program and the accompanying materials are made
// * available under the terms of the Eclipse Public License 2.0
// * which is available at https://www.eclipse.org/legal/epl-2.0/
// *
// * SPDX-License-Identifier: EPL-2.0
// **********************************************************************/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {

@@ -34,10 +25,12 @@ if (k2 === undefined) k2 = k;

Object.defineProperty(exports, "__esModule", { value: true });
const inversify_types_1 = require("../../inversify.types");
const inversify_config_1 = require("../../inversify.config");
const inversify_types_1 = require("../../inversify.types");
const CheReporter_1 = __importDefault(require("../../driver/CheReporter"));
const Ide_1 = require("../../pageobjects/ide/Ide");
const selenium_webdriver_1 = require("selenium-webdriver");
const Logger_1 = require("../../utils/Logger");
const TestConstants_1 = require("../../TestConstants");
const TimeoutConstants_1 = require("../../TimeoutConstants");
const selenium_webdriver_1 = require("selenium-webdriver");
const Logger_1 = require("../../utils/Logger");
const fs = __importStar(require("fs"));
const axios_1 = __importDefault(require("axios"));
const CheReporter_1 = __importDefault(require("../../driver/CheReporter"));
const ide = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.Ide);

@@ -58,2 +51,4 @@ const projectTree = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.ProjectTree);

const warningDialog = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.DialogWindow);
const debugView = inversify_config_1.e2eContainer.get(inversify_types_1.CLASSES.DebugView);
const welcomeControllerJavaFileName = 'WelcomeController.java';
const SpringAppLocators = {

@@ -164,2 +159,39 @@ springTitleLocator: selenium_webdriver_1.By.xpath('//div[@class=\'container-fluid\']//h2[text()=\'Welcome\']'),

});
suite('Validation of debug functionality', async () => {
let urlToPetClinicApp = '';
test('Launch debug', async () => {
const taskName = 'run-debug';
await topMenu.runTask(`${taskName}, ${globalTaskScope}`);
await ide.waitNotification('Process 8080-tcp is now listening on port 8080. Open it ?', 180000);
await ide.clickOnNotificationButton('Process 8080-tcp is now listening on port 8080. Open it ?', 'Open In New Tab');
});
test('Check content of the launched application', async () => {
const mainWindowHandle = await browserTabsUtil.getCurrentWindowHandle();
await browserTabsUtil.waitAndSwitchToAnotherWindow(mainWindowHandle, TimeoutConstants_1.TimeoutConstants.TS_EDITOR_TAB_INTERACTION_TIMEOUT);
urlToPetClinicApp = await browserTabsUtil.getCurrentUrl();
await browserTabsUtil.switchToWindow(mainWindowHandle);
});
test('Open debug view', async () => {
await projectTree.expandPathAndOpenFile(pathToJavaFolder + '/system', welcomeControllerJavaFileName);
await editor.selectTab(welcomeControllerJavaFileName);
await topMenu.selectOption('View', 'Debug');
await ide.waitLeftToolbarButton(Ide_1.LeftToolbarButton.Debug);
});
test('Choose debug configuration', async () => {
await debugView.clickOnDebugConfigurationDropDown();
await debugView.clickOnDebugConfigurationItem('Debug (Attach) - Remote (java-spring-petclinic)');
});
test('Run debug', async () => {
await debugView.clickOnRunDebugButton();
await waitDebugToConnect();
});
test('Activate breakpoint', async () => {
await editor.selectTab(welcomeControllerJavaFileName);
await editor.activateBreakpoint(welcomeControllerJavaFileName, 27);
});
test('Check debugger stop at the breakpoint', async () => {
await sendRequestToDebugApp(urlToPetClinicApp);
await waitStoppedBreakpoint(27);
});
});
async function checkJavaPathCompletion() {

@@ -201,4 +233,43 @@ if (await ide.isNotificationPresent('Classpath is incomplete. Only syntax errors will be reported')) {

await driverHelper.waitVisibility(contentLocator);
await driverHelper.getDriver().close();
await browserTabsUtil.switchToWindow(mainWindowHandle);
}
async function waitStoppedBreakpoint(lineNumber) {
try {
await editor.waitStoppedDebugBreakpoint(welcomeControllerJavaFileName, lineNumber);
}
catch (err) {
const mainWindowHandle = await browserTabsUtil.getCurrentWindowHandle();
await browserTabsUtil.waitAndSwitchToAnotherWindow(mainWindowHandle, TimeoutConstants_1.TimeoutConstants.TS_EDITOR_TAB_INTERACTION_TIMEOUT);
await driverHelper.getDriver().navigate().refresh();
await browserTabsUtil.switchToWindow(mainWindowHandle);
await editor.waitStoppedDebugBreakpoint(welcomeControllerJavaFileName, lineNumber);
}
}
// we need to send a request to test app. under debugging because when we try to make it with WebDriver
// the WebDriver will hang. Because the test application does not respond under debugging,
// for avoiding this problem we send http request with axios and set the request timeout. We expect that request will fail with
// timeout error, we check it in the catch block and wait breakpoint activating in the WebDriver after this.
async function sendRequestToDebugApp(urlToApp) {
const httpClient = axios_1.default.create();
httpClient.defaults.timeout = 1000;
try {
await httpClient.get(urlToApp);
}
catch (error) {
if (error.message === 'timeout of 1000ms exceeded') {
console.log('>>>>The debugger is set >>>>>>>>>>>>>>>>>>> ' + error.message);
}
}
}
async function waitDebugToConnect() {
try {
await debugView.waitForDebuggerToConnect();
}
catch (err) {
Logger_1.Logger.debug('Workaround for the https://github.com/eclipse/che/issues/18034 issue.');
await debugView.clickOnThreadsViewTitle();
await debugView.waitForDebuggerToConnect();
}
}
//# sourceMappingURL=DevWorkspaceHappyPath.spec.js.map

36

package.json
{
"name": "@eclipse-che/che-e2e",
"version": "7.41.0-dev-aed762b",
"version": "7.41.0-dev-cd64105",
"description": "",

@@ -10,23 +10,23 @@ "main": "dist/index.js",

"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",
"test": "./generateIndex.sh && npm run lint && npm run tsc && mocha --opts mocha.opts",
"load-test": "./generateIndex.sh && npm run lint && npm run tsc && mocha --opts mocha-load.opts",
"test-happy-path": "./generateIndex.sh && npm run lint && npm run tsc && mocha --opts mocha-happy-path.opts",
"test-devworkspace-happy-path": "./generateIndex.sh && npm run lint && npm run tsc && mocha --opts mocha-devworkspace-happy-path.opts",
"test-wkspc-creation-and-ls": "./generateIndex.sh && npm run lint && npm run tsc && mocha --opts mocha-wkspc-creation-and-ls.opts",
"test-java-vertx": "./generateIndex.sh && npm run lint && npm run tsc && mocha --opts mocha-java-vertx.opts",
"test-git-ssh": "./generateIndex.sh && npm run lint && npm run tsc && mocha --opts mocha-git-ssh.opts",
"test-git-self-sign-cert": "./generateIndex.sh && npm run lint && npm run tsc && mocha --opts mocha-git-self-sign-cert.opts",
"test-git-publish-branch": "./generateIndex.sh && npm run lint && npm run tsc && mocha --opts mocha-git-publish-branch.opts",
"test-openshift-connector": "./generateIndex.sh && npm run lint && npm run tsc && mocha --opts mocha-connector.opts",
"test": "./generateIndex.sh && npm run lint && npm run tsc && mocha --config mocha.json",
"load-test": "./generateIndex.sh && npm run lint && npm run tsc && mocha --config mocha-load.json",
"test-happy-path": "./generateIndex.sh && npm run lint && npm run tsc && mocha --config mocha-happy-path.json",
"test-devworkspace-happy-path": "./generateIndex.sh && npm run lint && npm run tsc && mocha --config mocha-devworkspace-happy-path.json",
"test-wkspc-creation-and-ls": "./generateIndex.sh && npm run lint && npm run tsc && mocha --config mocha-wkspc-creation-and-ls",
"test-java-vertx": "./generateIndex.sh && npm run lint && npm run tsc && mocha --config mocha-java-vertx.json",
"test-git-ssh": "./generateIndex.sh && npm run lint && npm run tsc && mocha --config mocha-git-ssh.json",
"test-git-self-sign-cert": "./generateIndex.sh && npm run lint && npm run tsc && mocha --config mocha-git-self-sign-cert.json",
"test-git-publish-branch": "./generateIndex.sh && npm run lint && npm run tsc && mocha --config mocha-git-publish-branch.json",
"test-openshift-connector": "./generateIndex.sh && npm run lint && npm run tsc && mocha --config mocha-connector.json",
"test-all-devfiles": "./generateIndex.sh && ./initDevfileTests.sh",
"test-factory": "./generateIndex.sh && npm run lint && npm run tsc && mocha --opts mocha-factory.opts",
"test-all-factories": "./generateIndex.sh && npm run lint && npm run tsc && mocha --opts mocha-all-factories.opts",
"test-intelij": "tsc && mocha --opts mocha.intelij.opts",
"test-oauth": "tsc && mocha --opts mocha.ocp.link.opts",
"test-factory": "./generateIndex.sh && npm run lint && npm run tsc && mocha --config mocha-factory.json",
"test-all-factories": "./generateIndex.sh && npm run lint && npm run tsc && mocha --config mocha-all-factories.json",
"test-intelij": "tsc && mocha --config mocha.intelij.json",
"test-oauth": "tsc && mocha --config mocha.ocp.link.json",
"lint": "tslint --fix -p .",
"tsc": "tsc -p .",
"init-mocha-opts": "tsc && mocha --opts mocha-single-devfile.opts --spec dist/tests/login/Login.spec.js",
"init-mocha-opts": "tsc && mocha --config mocha-single-devfile.json --spec dist/tests/login/Login.spec.js",
"test-plugin": "./initPluginTest.sh",
"test-plugin-ci": "export TS_DELETE_PLUGINS_TEST_WORKSPACE=false && npm run init-mocha-opts -- --spec dist/tests/plugins/${USERSTORY}.spec.js",
"test-all-plugins": "tsc && mocha --opts mocha-all-plugins.opts"
"test-all-plugins": "tsc && mocha --config mocha-all-plugins.json"
},

@@ -44,3 +44,3 @@ "author": "Ihor Okhrimenko (iokhrime@redhat.com)",

"chromedriver": "95.0.0",
"mocha": "7.1.1",
"mocha": "^9.1.3",
"rimraf": "2.6.2",

@@ -47,0 +47,0 @@ "selenium-webdriver": "3.6.0",

@@ -15,4 +15,6 @@

- ```export TS_SELENIUM_BASE_URL=<Che7 URL>```
- ```npm install```
- ```npm ci```
Note: If there is any modifications in package.json, manually execute the `npm install` to update the package-lock.json. So that errors can be avoided while executing npm ci
## Default launch

@@ -19,0 +21,0 @@

@@ -10,19 +10,20 @@ // /*********************************************************************

// **********************************************************************/
import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
import { CLASSES } from '../../inversify.types';
import { DebugView } from '../../pageobjects/ide/DebugView';
import { DialogWindow } from '../../pageobjects/ide/DialogWindow';
import { DriverHelper } from '../../utils/DriverHelper';
import { e2eContainer } from '../../inversify.config';
import { CLASSES } from '../../inversify.types';
import CheReporter from '../../driver/CheReporter';
import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
import { TestConstants } from '../../TestConstants';
import { Ide } from '../../pageobjects/ide/Ide';
import { TimeoutConstants } from '../../TimeoutConstants';
import { TopMenu } from '../../pageobjects/ide/TopMenu';
import { ProjectTree } from '../../pageobjects/ide/ProjectTree';
import { Editor } from '../../pageobjects/ide/Editor';
import { Ide, LeftToolbarButton } from '../../pageobjects/ide/Ide';
import { Key, error, By } from 'selenium-webdriver';
import { DriverHelper } from '../../utils/DriverHelper';
import { Logger } from '../../utils/Logger';
import { ProjectTree } from '../../pageobjects/ide/ProjectTree';
import { Terminal } from '../../pageobjects/ide/Terminal';
import { DialogWindow } from '../../pageobjects/ide/DialogWindow';
import { TestConstants } from '../../TestConstants';
import { TimeoutConstants } from '../../TimeoutConstants';
import { TopMenu } from '../../pageobjects/ide/TopMenu';
import * as fs from 'fs';
import axios from 'axios';
import CheReporter from '../../driver/CheReporter';

@@ -44,2 +45,4 @@ const ide: Ide = e2eContainer.get(CLASSES.Ide);

const warningDialog: DialogWindow = e2eContainer.get(CLASSES.DialogWindow);
const debugView: DebugView = e2eContainer.get(CLASSES.DebugView);
const welcomeControllerJavaFileName: string = 'WelcomeController.java';

@@ -166,2 +169,47 @@

suite('Validation of debug functionality', async () => {
let urlToPetClinicApp = '';
test('Launch debug', async () => {
const taskName: string = 'run-debug';
await topMenu.runTask(`${taskName}, ${globalTaskScope}`);
await ide.waitNotification('Process 8080-tcp is now listening on port 8080. Open it ?', 180_000);
await ide.clickOnNotificationButton('Process 8080-tcp is now listening on port 8080. Open it ?', 'Open In New Tab');
});
test('Check content of the launched application', async () => {
const mainWindowHandle: string = await browserTabsUtil.getCurrentWindowHandle();
await browserTabsUtil.waitAndSwitchToAnotherWindow(mainWindowHandle, TimeoutConstants.TS_EDITOR_TAB_INTERACTION_TIMEOUT);
urlToPetClinicApp = await browserTabsUtil.getCurrentUrl();
await browserTabsUtil.switchToWindow(mainWindowHandle);
});
test('Open debug view', async () => {
await projectTree.expandPathAndOpenFile(pathToJavaFolder + '/system', welcomeControllerJavaFileName);
await editor.selectTab(welcomeControllerJavaFileName);
await topMenu.selectOption('View', 'Debug');
await ide.waitLeftToolbarButton(LeftToolbarButton.Debug);
});
test('Choose debug configuration', async () => {
await debugView.clickOnDebugConfigurationDropDown();
await debugView.clickOnDebugConfigurationItem('Debug (Attach) - Remote (java-spring-petclinic)');
});
test('Run debug', async () => {
await debugView.clickOnRunDebugButton();
await waitDebugToConnect();
});
test('Activate breakpoint', async () => {
await editor.selectTab(welcomeControllerJavaFileName);
await editor.activateBreakpoint(welcomeControllerJavaFileName, 27);
});
test('Check debugger stop at the breakpoint', async () => {
await sendRequestToDebugApp(urlToPetClinicApp);
await waitStoppedBreakpoint(27);
});
});
async function checkJavaPathCompletion() {

@@ -206,3 +254,42 @@ if (await ide.isNotificationPresent('Classpath is incomplete. Only syntax errors will be reported')) {

await driverHelper.waitVisibility(contentLocator);
await driverHelper.getDriver().close();
await browserTabsUtil.switchToWindow(mainWindowHandle);
}
async function waitStoppedBreakpoint(lineNumber: number) {
try {
await editor.waitStoppedDebugBreakpoint(welcomeControllerJavaFileName, lineNumber);
} catch (err) {
const mainWindowHandle: string = await browserTabsUtil.getCurrentWindowHandle();
await browserTabsUtil.waitAndSwitchToAnotherWindow(mainWindowHandle, TimeoutConstants.TS_EDITOR_TAB_INTERACTION_TIMEOUT);
await driverHelper.getDriver().navigate().refresh();
await browserTabsUtil.switchToWindow(mainWindowHandle);
await editor.waitStoppedDebugBreakpoint(welcomeControllerJavaFileName, lineNumber);
}
}
// we need to send a request to test app. under debugging because when we try to make it with WebDriver
// the WebDriver will hang. Because the test application does not respond under debugging,
// for avoiding this problem we send http request with axios and set the request timeout. We expect that request will fail with
// timeout error, we check it in the catch block and wait breakpoint activating in the WebDriver after this.
async function sendRequestToDebugApp(urlToApp: string) {
const httpClient = axios.create();
httpClient.defaults.timeout = 1000;
try {
await httpClient.get(urlToApp);
} catch (error) {
if (error.message === 'timeout of 1000ms exceeded') {
console.log('>>>>The debugger is set >>>>>>>>>>>>>>>>>>> ' + error.message);
}
}
}
async function waitDebugToConnect() {
try {
await debugView.waitForDebuggerToConnect();
} catch (err) {
Logger.debug('Workaround for the https://github.com/eclipse/che/issues/18034 issue.');
await debugView.clickOnThreadsViewTitle();
await debugView.waitForDebuggerToConnect();
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet