@eclipse-che/che-e2e 7.50.0-dev-25a3c8c → 7.50.0
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.
- package/dist/driver/CheReporter.js +3 -2
- package/dist/driver/CheReporter.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/inversify.config.js +1 -1
- package/dist/inversify.config.js.map +1 -1
- package/dist/inversify.types.js +2 -3
- package/dist/inversify.types.js.map +1 -1
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js +2 -4
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js.map +1 -1
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetailsPlugins.js +2 -4
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetailsPlugins.js.map +1 -1
- package/dist/pageobjects/ide/ProjectTree.js +12 -6
- package/dist/pageobjects/ide/ProjectTree.js.map +1 -1
- package/dist/tests/devfiles/CSlashCPlusPlus.spec.js +3 -4
- package/dist/tests/devfiles/CSlashCPlusPlus.spec.js.map +1 -1
- package/dist/tests/devfiles/DevfileSmoke.spec.js +4 -5
- package/dist/tests/devfiles/DevfileSmoke.spec.js.map +1 -1
- package/dist/tests/devfiles/DotNetCore.spec.js +3 -4
- package/dist/tests/devfiles/DotNetCore.spec.js.map +1 -1
- package/dist/tests/devfiles/Go.spec.js +3 -4
- package/dist/tests/devfiles/Go.spec.js.map +1 -1
- package/dist/tests/devfiles/JavaMaven.spec.js +3 -4
- package/dist/tests/devfiles/JavaMaven.spec.js.map +1 -1
- package/dist/tests/devfiles/JavaSpringBoot.spec.js +3 -4
- package/dist/tests/devfiles/JavaSpringBoot.spec.js.map +1 -1
- package/dist/tests/devfiles/JavaVertx.spec.js +3 -4
- package/dist/tests/devfiles/JavaVertx.spec.js.map +1 -1
- package/dist/tests/devfiles/NodeJS.spec.js +3 -4
- package/dist/tests/devfiles/NodeJS.spec.js.map +1 -1
- package/dist/tests/devfiles/PHPSimple.spec.js +3 -4
- package/dist/tests/devfiles/PHPSimple.spec.js.map +1 -1
- package/dist/tests/devfiles/Python.spec.js +3 -4
- package/dist/tests/devfiles/Python.spec.js.map +1 -1
- package/dist/tests/devfiles/PythonDjango.spec.js +3 -4
- package/dist/tests/devfiles/PythonDjango.spec.js.map +1 -1
- package/dist/tests/devfiles/Quarkus.spec.js +3 -4
- package/dist/tests/devfiles/Quarkus.spec.js.map +1 -1
- package/dist/tests/devfiles/Scala.spec.js +3 -4
- package/dist/tests/devfiles/Scala.spec.js.map +1 -1
- package/dist/tests/e2e/FactoryUrl.spec.js +5 -10
- package/dist/tests/e2e/FactoryUrl.spec.js.map +1 -1
- package/dist/tests/e2e/GitPublishBranch.spec.js +3 -1
- package/dist/tests/e2e/GitPublishBranch.spec.js.map +1 -1
- package/dist/tests/e2e/GitSelfSignCert.spec.js +8 -1
- package/dist/tests/e2e/GitSelfSignCert.spec.js.map +1 -1
- package/dist/tests/e2e/GitSsh.spec.js +5 -2
- package/dist/tests/e2e/GitSsh.spec.js.map +1 -1
- package/dist/tests/e2e/OpenshiftConnector.spec.js +3 -1
- package/dist/tests/e2e/OpenshiftConnector.spec.js.map +1 -1
- package/dist/tests/e2e/factories/DirectUrlFactoryWithKeepDirectoryTest.spec.js +3 -7
- package/dist/tests/e2e/factories/DirectUrlFactoryWithKeepDirectoryTest.spec.js.map +1 -1
- package/dist/tests/e2e/factories/DirectUrlFactoryWithRootFolderTest.spec.js +3 -7
- package/dist/tests/e2e/factories/DirectUrlFactoryWithRootFolderTest.spec.js.map +1 -1
- package/dist/tests/e2e/factories/DirectUrlFactoryWithSpecificBranchTest.spec.js +3 -7
- package/dist/tests/e2e/factories/DirectUrlFactoryWithSpecificBranchTest.spec.js.map +1 -1
- package/dist/tests/e2e_happy_path/DevWorkspaceHappyPath.spec.js +2 -0
- package/dist/tests/e2e_happy_path/DevWorkspaceHappyPath.spec.js.map +1 -1
- package/dist/tests/e2e_happy_path/HappyPath.spec.js +13 -8
- package/dist/tests/e2e_happy_path/HappyPath.spec.js.map +1 -1
- package/dist/tests/intelij/IntelijOpenWorkspace.spec.js +2 -6
- package/dist/tests/intelij/IntelijOpenWorkspace.spec.js.map +1 -1
- package/dist/tests/load_test/LoadTest.spec.js +3 -6
- package/dist/tests/load_test/LoadTest.spec.js.map +1 -1
- package/dist/tests/login/LinkCheAndOcpUsers.spec.js +2 -2
- package/dist/tests/login/LinkCheAndOcpUsers.spec.js.map +1 -1
- package/dist/tests/plugins/GitHubPullRequestPlugin.spec.js +4 -9
- package/dist/tests/plugins/GitHubPullRequestPlugin.spec.js.map +1 -1
- package/dist/tests/plugins/InstallPluginUsingUI.spec.js +4 -10
- package/dist/tests/plugins/InstallPluginUsingUI.spec.js.map +1 -1
- package/dist/tests/plugins/JavaPlugin.spec.js +4 -8
- package/dist/tests/plugins/JavaPlugin.spec.js.map +1 -1
- package/dist/tests/plugins/PhpPlugin.spec.js +12 -10
- package/dist/tests/plugins/PhpPlugin.spec.js.map +1 -1
- package/dist/tests/plugins/PythonPlugin.spec.js +4 -8
- package/dist/tests/plugins/PythonPlugin.spec.js.map +1 -1
- package/dist/tests/plugins/TypescriptPlugin.spec.js +4 -8
- package/dist/tests/plugins/TypescriptPlugin.spec.js.map +1 -1
- package/dist/tests/plugins/VscodeKubernetesPlugin.spec.js +3 -10
- package/dist/tests/plugins/VscodeKubernetesPlugin.spec.js.map +1 -1
- package/dist/tests/plugins/VscodeShellcheckPlugin.spec.js +3 -10
- package/dist/tests/plugins/VscodeShellcheckPlugin.spec.js.map +1 -1
- package/dist/tests/plugins/VscodeValePlugin.spec.js +3 -10
- package/dist/tests/plugins/VscodeValePlugin.spec.js.map +1 -1
- package/dist/tests/plugins/VscodeXmlPlugin.spec.js +15 -1
- package/dist/tests/plugins/VscodeXmlPlugin.spec.js.map +1 -1
- package/dist/tests/plugins/VscodeYamlPlugin.spec.js +4 -8
- package/dist/tests/plugins/VscodeYamlPlugin.spec.js.map +1 -1
- package/dist/testsLibrary/CodeExecutionTests.js +14 -2
- package/dist/testsLibrary/CodeExecutionTests.js.map +1 -1
- package/dist/testsLibrary/WorkspaceHandlingTests.js +75 -10
- package/dist/testsLibrary/WorkspaceHandlingTests.js.map +1 -1
- package/dist/utils/requestHandlers/CheApiRequestHandler.js.map +1 -1
- package/dist/utils/requestHandlers/headers/CheMultiuserAuthorizationHeaderHandler.js +17 -2
- package/dist/utils/requestHandlers/headers/CheMultiuserAuthorizationHeaderHandler.js.map +1 -1
- package/dist/utils/workspace/ApiUrlResolver.js +41 -9
- package/dist/utils/workspace/ApiUrlResolver.js.map +1 -1
- package/dist/utils/workspace/{IApiUrlResolver.js → ITestWorkspaceUtil.js} +1 -1
- package/dist/utils/workspace/ITestWorkspaceUtil.js.map +1 -0
- package/dist/utils/workspace/TestWorkspaceUtil.js +29 -31
- package/dist/utils/workspace/TestWorkspaceUtil.js.map +1 -1
- package/dist/utils/workspace/WorkspaceStatus.js.map +1 -1
- package/driver/CheReporter.ts +4 -4
- package/index.ts +1 -1
- package/inversify.config.ts +4 -3
- package/inversify.types.ts +2 -3
- package/package.json +1 -1
- package/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts +3 -3
- package/pageobjects/dashboard/workspace-details/WorkspaceDetailsPlugins.ts +4 -4
- package/pageobjects/ide/ProjectTree.ts +13 -8
- package/tests/devfiles/CSlashCPlusPlus.spec.ts +3 -6
- package/tests/devfiles/DevfileSmoke.spec.ts +4 -7
- package/tests/devfiles/DotNetCore.spec.ts +3 -6
- package/tests/devfiles/Go.spec.ts +3 -4
- package/tests/devfiles/JavaMaven.spec.ts +3 -6
- package/tests/devfiles/JavaSpringBoot.spec.ts +3 -6
- package/tests/devfiles/JavaVertx.spec.ts +3 -6
- package/tests/devfiles/NodeJS.spec.ts +3 -6
- package/tests/devfiles/PHPSimple.spec.ts +3 -6
- package/tests/devfiles/Python.spec.ts +3 -6
- package/tests/devfiles/PythonDjango.spec.ts +3 -6
- package/tests/devfiles/Quarkus.spec.ts +3 -6
- package/tests/devfiles/Scala.spec.ts +3 -7
- package/tests/e2e/FactoryUrl.spec.ts +7 -11
- package/tests/e2e/GitPublishBranch.spec.ts +5 -3
- package/tests/e2e/GitSelfSignCert.spec.ts +68 -65
- package/tests/e2e/GitSsh.spec.ts +6 -3
- package/tests/e2e/OpenshiftConnector.spec.ts +4 -2
- package/tests/e2e/factories/DirectUrlFactoryWithKeepDirectoryTest.spec.ts +2 -5
- package/tests/e2e/factories/DirectUrlFactoryWithRootFolderTest.spec.ts +2 -5
- package/tests/e2e/factories/DirectUrlFactoryWithSpecificBranchTest.spec.ts +2 -5
- package/tests/e2e_happy_path/DevWorkspaceHappyPath.spec.ts +2 -0
- package/tests/e2e_happy_path/HappyPath.spec.ts +13 -8
- package/tests/intelij/IntelijOpenWorkspace.spec.ts +2 -4
- package/tests/load_test/LoadTest.spec.ts +4 -4
- package/tests/login/LinkCheAndOcpUsers.spec.ts +4 -3
- package/tests/plugins/GitHubPullRequestPlugin.spec.ts +4 -7
- package/tests/plugins/InstallPluginUsingUI.spec.ts +4 -9
- package/tests/plugins/JavaPlugin.spec.ts +4 -6
- package/tests/plugins/PhpPlugin.spec.ts +3 -9
- package/tests/plugins/PythonPlugin.spec.ts +4 -6
- package/tests/plugins/TypescriptPlugin.spec.ts +4 -6
- package/tests/plugins/VscodeKubernetesPlugin.spec.ts +3 -9
- package/tests/plugins/VscodeShellcheckPlugin.spec.ts +3 -9
- package/tests/plugins/VscodeValePlugin.spec.ts +3 -9
- package/tests/plugins/VscodeXmlPlugin.spec.ts +17 -1
- package/tests/plugins/VscodeYamlPlugin.spec.ts +4 -7
- package/testsLibrary/CodeExecutionTests.ts +9 -1
- package/testsLibrary/WorkspaceHandlingTests.ts +72 -9
- package/utils/requestHandlers/CheApiRequestHandler.ts +1 -1
- package/utils/requestHandlers/headers/CheMultiuserAuthorizationHeaderHandler.ts +17 -2
- package/utils/workspace/ApiUrlResolver.ts +34 -11
- package/utils/workspace/ITestWorkspaceUtil.ts +98 -0
- package/utils/workspace/TestWorkspaceUtil.ts +34 -34
- package/utils/workspace/WorkspaceStatus.ts +1 -1
- package/dist/utils/workspace/IApiUrlResolver.js.map +0 -1
- package/utils/workspace/IApiUrlResolver.ts +0 -15
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
import { Key } from 'selenium-webdriver';
|
|
12
12
|
import { e2eContainer } from '../../inversify.config';
|
|
13
|
+
import { Ide } from '../../pageobjects/ide/Ide';
|
|
13
14
|
import { CLASSES } from '../../inversify.types';
|
|
14
15
|
import { ProjectTree } from '../../pageobjects/ide/ProjectTree';
|
|
15
16
|
import { Editor } from '../../pageobjects/ide/Editor';
|
|
@@ -20,10 +21,12 @@ import CheReporter from '../../driver/CheReporter';
|
|
|
20
21
|
import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
|
|
21
22
|
import { PreferencesHandler } from '../../utils/PreferencesHandler';
|
|
22
23
|
import { ProjectAndFileTests } from '../../testsLibrary/ProjectAndFileTests';
|
|
24
|
+
import { TimeoutConstants } from '../../TimeoutConstants';
|
|
23
25
|
|
|
24
26
|
const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
|
|
25
27
|
const projectTree: ProjectTree = e2eContainer.get(CLASSES.ProjectTree);
|
|
26
28
|
const editor: Editor = e2eContainer.get(CLASSES.Editor);
|
|
29
|
+
const ide: Ide = e2eContainer.get(CLASSES.Ide);
|
|
27
30
|
const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
|
|
28
31
|
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
|
|
29
32
|
const preferencesHandler: PreferencesHandler = e2eContainer.get(CLASSES.PreferencesHandler);
|
|
@@ -45,10 +48,23 @@ suite('The "VscodeXmlPlugin" userstory', async () => {
|
|
|
45
48
|
projectAndFileTests.waitWorkspaceReadiness(projectName, subRootFolder);
|
|
46
49
|
|
|
47
50
|
test('Wait until created workspace is started', async () => {
|
|
51
|
+
WorkspaceHandlingTests.setWorkspaceName(workspaceName);
|
|
48
52
|
CheReporter.registerRunningWorkspace(workspaceName);
|
|
49
53
|
|
|
50
54
|
await preferencesHandler.setPreferenceUsingUI('application.confirmExit', 'never');
|
|
51
55
|
});
|
|
56
|
+
|
|
57
|
+
test('Wait until created workspace is started', async () => {
|
|
58
|
+
await ide.waitIde(TimeoutConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT);
|
|
59
|
+
await ide.waitNotificationAndClickOnButton('Do you trust the authors of', 'Yes, I trust', 60_000);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
suite('Check workspace readiness to work', async () => {
|
|
64
|
+
test('Wait until project is imported', async () => {
|
|
65
|
+
await projectTree.openProjectTreeContainer();
|
|
66
|
+
await projectTree.waitProjectImported(projectName, 'app');
|
|
67
|
+
});
|
|
52
68
|
});
|
|
53
69
|
|
|
54
70
|
suite('Check the "vscode-xml" plugin', async () => {
|
|
@@ -101,7 +117,7 @@ suite('The "VscodeXmlPlugin" userstory', async () => {
|
|
|
101
117
|
suite('Delete workspace', async () => {
|
|
102
118
|
test('Stop and remove workspace', async () => {
|
|
103
119
|
if (TestConstants.TS_DELETE_PLUGINS_TEST_WORKSPACE === 'true') {
|
|
104
|
-
await workspaceHandlingTests.stopAndRemoveWorkspace(
|
|
120
|
+
await workspaceHandlingTests.stopAndRemoveWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
105
121
|
return;
|
|
106
122
|
}
|
|
107
123
|
|
|
@@ -16,7 +16,6 @@ import { Editor } from '../../pageobjects/ide/Editor';
|
|
|
16
16
|
import { TestConstants } from '../../TestConstants';
|
|
17
17
|
import { Logger } from '../../utils/Logger';
|
|
18
18
|
import { WorkspaceHandlingTests } from '../../testsLibrary/WorkspaceHandlingTests';
|
|
19
|
-
import CheReporter from '../../driver/CheReporter';
|
|
20
19
|
import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
|
|
21
20
|
import { PreferencesHandler } from '../../utils/PreferencesHandler';
|
|
22
21
|
import { ProjectAndFileTests } from '../../testsLibrary/ProjectAndFileTests';
|
|
@@ -36,19 +35,17 @@ const pathToFile: string = `${projectName}`;
|
|
|
36
35
|
const yamlFileName: string = 'routes.yaml';
|
|
37
36
|
const yamlSchema = { 'yaml-schema.json': '*.yaml' };
|
|
38
37
|
|
|
39
|
-
let workspaceName: string = 'yaml-plugin';
|
|
40
|
-
|
|
41
38
|
suite('The "VscodeYamlPlugin" userstory', async () => {
|
|
42
39
|
suite('Create workspace', async () => {
|
|
43
40
|
test('Create workspace using factory', async () => {
|
|
44
41
|
await browserTabsUtil.navigateTo(factoryUrl);
|
|
45
42
|
});
|
|
46
43
|
|
|
47
|
-
|
|
44
|
+
workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
|
|
48
45
|
|
|
49
|
-
|
|
50
|
-
CheReporter.registerRunningWorkspace(workspaceName);
|
|
46
|
+
projectAndFileTests.waitWorkspaceReadiness(projectName, subRootFolder);
|
|
51
47
|
|
|
48
|
+
test('Set confirmExit preference to never', async () => {
|
|
52
49
|
await preferencesHandler.setPreferenceUsingUI('application.confirmExit', 'never');
|
|
53
50
|
});
|
|
54
51
|
});
|
|
@@ -97,7 +94,7 @@ suite('The "VscodeYamlPlugin" userstory', async () => {
|
|
|
97
94
|
suite('Delete workspace', async () => {
|
|
98
95
|
test('Stop and remove workspace', async () => {
|
|
99
96
|
if (TestConstants.TS_DELETE_PLUGINS_TEST_WORKSPACE === 'true') {
|
|
100
|
-
await workspaceHandlingTests.stopAndRemoveWorkspace(
|
|
97
|
+
await workspaceHandlingTests.stopAndRemoveWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
101
98
|
return;
|
|
102
99
|
}
|
|
103
100
|
|
|
@@ -20,6 +20,8 @@ import { DialogWindow } from '../pageobjects/ide/DialogWindow';
|
|
|
20
20
|
import { DriverHelper } from '../utils/DriverHelper';
|
|
21
21
|
import { Logger } from '../utils/Logger';
|
|
22
22
|
import { QuickOpenContainer } from '../pageobjects/ide/QuickOpenContainer';
|
|
23
|
+
import { WorkspaceHandlingTests } from './WorkspaceHandlingTests';
|
|
24
|
+
import { BrowserTabsUtil } from '../utils/BrowserTabsUtil';
|
|
23
25
|
|
|
24
26
|
@injectable()
|
|
25
27
|
export class CodeExecutionTests {
|
|
@@ -32,7 +34,9 @@ export class CodeExecutionTests {
|
|
|
32
34
|
@inject(CLASSES.Ide) private readonly ide: Ide,
|
|
33
35
|
@inject(CLASSES.DialogWindow) private readonly dialogWindow: DialogWindow,
|
|
34
36
|
@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper,
|
|
35
|
-
@inject(CLASSES.QuickOpenContainer) private readonly quickOpenContainer: QuickOpenContainer
|
|
37
|
+
@inject(CLASSES.QuickOpenContainer) private readonly quickOpenContainer: QuickOpenContainer,
|
|
38
|
+
@inject(CLASSES.BrowserTabsUtil) private readonly browserTabsUtil: BrowserTabsUtil,
|
|
39
|
+
@inject(CLASSES.WorkspaceHandlingTests) private readonly workspaceHandlingTests: WorkspaceHandlingTests) {}
|
|
36
40
|
|
|
37
41
|
public runTask(taskName: string, timeout: number) {
|
|
38
42
|
test(`Run command '${taskName}'`, async () => {
|
|
@@ -62,6 +66,7 @@ export class CodeExecutionTests {
|
|
|
62
66
|
public runTaskWithDialogShellAndOpenLink(taskName: string, expectedDialogText: string, timeout: number) {
|
|
63
67
|
test(`Run command '${taskName}' expecting dialog shell`, async () => {
|
|
64
68
|
await this.runTaskUsingQuickOpenContainer(taskName);
|
|
69
|
+
this.workspaceHandlingTests.setWindowHandle(await this.browserTabsUtil.getCurrentWindowHandle());
|
|
65
70
|
await this.dialogWindow.waitDialogAndOpenLink(expectedDialogText, timeout);
|
|
66
71
|
});
|
|
67
72
|
}
|
|
@@ -103,6 +108,7 @@ export class CodeExecutionTests {
|
|
|
103
108
|
test(`Run command '${taskName}' expecting notification`, async () => {
|
|
104
109
|
await this.runTaskUsingQuickOpenContainer(taskName);
|
|
105
110
|
await this.ide.waitNotification(notificationText, timeout);
|
|
111
|
+
this.workspaceHandlingTests.setWindowHandle(await this.browserTabsUtil.getCurrentWindowHandle());
|
|
106
112
|
await this.ide.clickOnNotificationButton(notificationText, buttonText);
|
|
107
113
|
await this.driverHelper.wait(5_000);
|
|
108
114
|
CodeExecutionTests.lastApplicationUrl = await this.driverHelper.getDriver().getCurrentUrl();
|
|
@@ -116,6 +122,7 @@ export class CodeExecutionTests {
|
|
|
116
122
|
test(`Run command '${taskName}' expecting notification`, async () => {
|
|
117
123
|
await this.runTaskUsingQuickOpenContainer(taskName);
|
|
118
124
|
await this.ide.waitNotification(notificationText, timeout);
|
|
125
|
+
this.workspaceHandlingTests.setWindowHandle(await this.browserTabsUtil.getCurrentWindowHandle());
|
|
119
126
|
await this.ide.clickOnNotificationButton(notificationText, 'Open In Preview');
|
|
120
127
|
await this.driverHelper.wait(5_000);
|
|
121
128
|
CodeExecutionTests.lastApplicationUrl = await this.driverHelper.getDriver().getCurrentUrl();
|
|
@@ -126,6 +133,7 @@ export class CodeExecutionTests {
|
|
|
126
133
|
test(`Run command '${taskName}' expecting notification with unexposed port`, async () => {
|
|
127
134
|
await this.runTaskUsingQuickOpenContainer(taskName);
|
|
128
135
|
await this.ide.waitNotificationAndConfirm(notificationText, timeout);
|
|
136
|
+
this.workspaceHandlingTests.setWindowHandle(await this.browserTabsUtil.getCurrentWindowHandle());
|
|
129
137
|
await this.ide.waitNotificationAndOpenLink(portOpenText, timeout);
|
|
130
138
|
await this.driverHelper.wait(5_000);
|
|
131
139
|
CodeExecutionTests.lastApplicationUrl = await this.driverHelper.getDriver().getCurrentUrl();
|
|
@@ -15,46 +15,109 @@ import { Dashboard } from '../pageobjects/dashboard/Dashboard';
|
|
|
15
15
|
import { CreateWorkspace } from '../pageobjects/dashboard/CreateWorkspace';
|
|
16
16
|
import { Workspaces } from '../pageobjects/dashboard/Workspaces';
|
|
17
17
|
import { BrowserTabsUtil } from '../utils/BrowserTabsUtil';
|
|
18
|
-
import { Logger } from '
|
|
18
|
+
import { Logger } from '../utils/Logger';
|
|
19
|
+
import { ApiUrlResolver } from '../utils/workspace/ApiUrlResolver';
|
|
20
|
+
import { TimeoutConstants } from '../TimeoutConstants';
|
|
21
|
+
import { DriverHelper } from '../utils/DriverHelper';
|
|
22
|
+
import { Ide } from '../pageobjects/ide/Ide';
|
|
23
|
+
import { By, error } from 'selenium-webdriver';
|
|
19
24
|
|
|
20
25
|
@injectable()
|
|
21
26
|
export class WorkspaceHandlingTests {
|
|
22
27
|
|
|
28
|
+
private static START_WORKSPACE_PAGE_NAME_LOCATOR: By = By.xpath(`//div[@class="ui-container"]/div[@class="pf-c-page"]//div[@class="pf-c-content"]/h1`);
|
|
23
29
|
private static workspaceName: string = 'undefined';
|
|
30
|
+
private static parentGUID: string;
|
|
24
31
|
|
|
25
32
|
public static getWorkspaceName(): string {
|
|
26
33
|
return WorkspaceHandlingTests.workspaceName;
|
|
27
34
|
}
|
|
28
35
|
|
|
36
|
+
public static setWorkspaceName(workspaceName: string) {
|
|
37
|
+
WorkspaceHandlingTests.workspaceName = workspaceName;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public setWindowHandle(guid: string) {
|
|
41
|
+
WorkspaceHandlingTests.parentGUID = guid;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public getWindowHandle(): string {
|
|
45
|
+
return WorkspaceHandlingTests.parentGUID;
|
|
46
|
+
}
|
|
47
|
+
|
|
29
48
|
constructor(
|
|
30
49
|
@inject(CLASSES.Dashboard) private readonly dashboard: Dashboard,
|
|
31
50
|
@inject(CLASSES.CreateWorkspace) private readonly createWorkspace: CreateWorkspace,
|
|
32
51
|
@inject(CLASSES.Workspaces) private readonly workspaces: Workspaces,
|
|
33
|
-
@inject(CLASSES.BrowserTabsUtil) private readonly browserTabsUtil: BrowserTabsUtil
|
|
52
|
+
@inject(CLASSES.BrowserTabsUtil) private readonly browserTabsUtil: BrowserTabsUtil,
|
|
53
|
+
@inject(CLASSES.ApiUrlResolver) private readonly apiUrlResolver: ApiUrlResolver,
|
|
54
|
+
@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper,
|
|
55
|
+
@inject(CLASSES.Ide) private readonly ide: Ide) {}
|
|
34
56
|
|
|
35
57
|
public createAndOpenWorkspace(stack: string) {
|
|
36
|
-
test(`
|
|
58
|
+
test(`Create and open new workspace, stack:${stack}`, async () => {
|
|
37
59
|
await this.dashboard.waitPage();
|
|
60
|
+
Logger.debug(`Fetching user kubernetes namespace, storing auth token by getting workspaces API URL.`);
|
|
61
|
+
await this.apiUrlResolver.getWorkspacesApiUrl();
|
|
38
62
|
await this.dashboard.clickCreateWorkspaceButton();
|
|
39
63
|
await this.createWorkspace.waitPage();
|
|
40
|
-
|
|
64
|
+
WorkspaceHandlingTests.parentGUID = await this.browserTabsUtil.getCurrentWindowHandle();
|
|
41
65
|
await this.createWorkspace.clickOnSample(stack);
|
|
42
|
-
await this.browserTabsUtil.
|
|
43
|
-
WorkspaceHandlingTests.workspaceName = await this.dashboard.getRecentWorkspaceName(10000);
|
|
44
|
-
Logger.debug(`Workspace Name is: ${WorkspaceHandlingTests.workspaceName}`);
|
|
45
|
-
await this.browserTabsUtil.waitAndSwitchToAnotherWindow(parentGUID, 10000);
|
|
66
|
+
await this.browserTabsUtil.waitAndSwitchToAnotherWindow(WorkspaceHandlingTests.parentGUID, TimeoutConstants.TS_IDE_LOAD_TIMEOUT);
|
|
46
67
|
});
|
|
47
68
|
}
|
|
48
69
|
|
|
49
70
|
public openExistingWorkspace(workspaceName: string) {
|
|
50
|
-
test('
|
|
71
|
+
test('Open and start existing workspace', async () => {
|
|
51
72
|
await this.dashboard.waitPage();
|
|
73
|
+
Logger.debug(`Fetching user kubernetes namespace, storing auth token by getting workspaces API URL.`);
|
|
74
|
+
await this.apiUrlResolver.getWorkspacesApiUrl();
|
|
52
75
|
await this.dashboard.clickWorkspacesButton();
|
|
53
76
|
await this.workspaces.waitPage();
|
|
54
77
|
await this.workspaces.clickOpenButton(workspaceName);
|
|
55
78
|
});
|
|
56
79
|
}
|
|
57
80
|
|
|
81
|
+
public obtainWorkspaceNameFromStartingPage() {
|
|
82
|
+
test('Obtain workspace name from workspace loader page', async() => {
|
|
83
|
+
try {
|
|
84
|
+
await this.driverHelper.waitVisibility(WorkspaceHandlingTests.START_WORKSPACE_PAGE_NAME_LOCATOR, TimeoutConstants.TS_WAIT_LOADER_PRESENCE_TIMEOUT);
|
|
85
|
+
// it takes a while to update the element with the workspace name
|
|
86
|
+
await this.driverHelper.wait(TimeoutConstants.TS_IDE_LOAD_TIMEOUT);
|
|
87
|
+
let startingWorkspaceLineContent = await this.driverHelper.getDriver().findElement(WorkspaceHandlingTests.START_WORKSPACE_PAGE_NAME_LOCATOR).getAttribute('innerHTML');
|
|
88
|
+
// cutting away leading text
|
|
89
|
+
WorkspaceHandlingTests.workspaceName = startingWorkspaceLineContent.substring('Starting workspace '.length).trim();
|
|
90
|
+
Logger.info(`Obtained workspace name from workspace loader page: ${WorkspaceHandlingTests.workspaceName}`);
|
|
91
|
+
} catch (err) {
|
|
92
|
+
Logger.error(`Failed to obtain workspace name from workspace loader page: ${err}`);
|
|
93
|
+
throw err;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
public switchBackToFirstOpenIdeTabFromLeftToRight() {
|
|
99
|
+
test('WorkspaceHandlingTests.switchBackToIdeTab', async () => {
|
|
100
|
+
let tabs = await this.driverHelper.getDriver().getAllWindowHandles();
|
|
101
|
+
Logger.trace(`WorkspaceHandlingTests.switchBackToIdeTab Found ${tabs.length} window handles, iterating...`);
|
|
102
|
+
for (let i = 0; i < tabs.length; i++) {
|
|
103
|
+
await this.browserTabsUtil.switchToWindow(tabs[i]);
|
|
104
|
+
try {
|
|
105
|
+
await this.ide.waitIde(TimeoutConstants.TS_IDE_LOAD_TIMEOUT);
|
|
106
|
+
Logger.debug(`WorkspaceHandlingTests.switchBackToIdeTab located and switched to IDE tab`);
|
|
107
|
+
return;
|
|
108
|
+
} catch (err) {
|
|
109
|
+
if (err instanceof error.TimeoutError) {
|
|
110
|
+
Logger.warn(`WorkspaceHandlingTests.switchBackToIdeTab Locator timed out, trying with another window handle.`);
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
Logger.error(`WorkspaceHandlingTests.switchBackToIdeTab Received unexpected exception while trying to locate IDE tab:${err}`);
|
|
114
|
+
throw err;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
Logger.error(`WorkspaceHandlingTests.switchBackToIdeTab Failed to locate IDE tab, out of window handles.`);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
58
121
|
public async stopWorkspace(workspaceName: string) {
|
|
59
122
|
await this.dashboard.openDashboard();
|
|
60
123
|
await this.dashboard.stopWorkspaceByUI(workspaceName);
|
|
@@ -100,7 +100,7 @@ export class CheApiRequestHandler {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
async patch(relativeUrl: string, patchParams: object): Promise<AxiosResponse> {
|
|
103
|
-
|
|
103
|
+
return await axios.patch(this.assembleUrl(relativeUrl), patchParams, await this.headerHandler.get());
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
private assembleUrl(relativeUrl: string): string {
|
|
@@ -12,13 +12,28 @@ import { IAuthorizationHeaderHandler } from './IAuthorizationHeaderHandler';
|
|
|
12
12
|
import { inject, injectable } from 'inversify';
|
|
13
13
|
import { DriverHelper } from '../../DriverHelper';
|
|
14
14
|
import { CLASSES } from '../../../inversify.types';
|
|
15
|
+
import { Logger } from '../../Logger';
|
|
15
16
|
|
|
16
17
|
@injectable()
|
|
17
18
|
export class CheMultiuserAuthorizationHeaderHandler implements IAuthorizationHeaderHandler {
|
|
19
|
+
private authorizationToken: string = '';
|
|
20
|
+
|
|
18
21
|
constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { }
|
|
19
22
|
|
|
20
23
|
async get(): Promise<AxiosRequestConfig> {
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
try {
|
|
25
|
+
let token = await this.driverHelper.getDriver().manage().getCookie('_oauth_proxy');
|
|
26
|
+
if (this.authorizationToken !== token.value) {
|
|
27
|
+
this.authorizationToken = token.value;
|
|
28
|
+
}
|
|
29
|
+
} catch (err) {
|
|
30
|
+
if (this.authorizationToken.length > 0) {
|
|
31
|
+
Logger.warn(`Could not obtain _oauth_proxy cookie from chromedriver, browser session may have been killed. Using stored value.`);
|
|
32
|
+
} else {
|
|
33
|
+
throw new Error(`Could not obtain _oauth_proxy cookie from chromedriver, browser session may have been killed. No stored token present!`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return { headers: { 'cookie': `_oauth_proxy=${this.authorizationToken}` } };
|
|
23
38
|
}
|
|
24
39
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { IApiUrlResolver } from './IApiUrlResolver';
|
|
2
|
-
|
|
3
1
|
/*********************************************************************
|
|
4
2
|
* Copyright (c) 2019 Red Hat, Inc.
|
|
5
3
|
*
|
|
@@ -9,19 +7,44 @@ import { IApiUrlResolver } from './IApiUrlResolver';
|
|
|
9
7
|
*
|
|
10
8
|
* SPDX-License-Identifier: EPL-2.0
|
|
11
9
|
**********************************************************************/
|
|
12
|
-
import { injectable } from 'inversify';
|
|
13
|
-
|
|
10
|
+
import { inject, injectable } from 'inversify';
|
|
11
|
+
import { CLASSES } from '../../inversify.types';
|
|
12
|
+
import { Logger } from '../Logger';
|
|
13
|
+
import { CheApiRequestHandler } from '../requestHandlers/CheApiRequestHandler';
|
|
14
14
|
|
|
15
15
|
@injectable()
|
|
16
|
-
export class ApiUrlResolver
|
|
17
|
-
private
|
|
16
|
+
export class ApiUrlResolver {
|
|
17
|
+
private static readonly DASHBOARD_API_URL: string = 'dashboard/api/namespace';
|
|
18
|
+
private static readonly KUBERNETES_API_URL: string = 'api/kubernetes/namespace';
|
|
19
|
+
|
|
20
|
+
private userNamespace: string = '';
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
constructor(@inject(CLASSES.CheApiRequestHandler) private readonly processRequestHandler: CheApiRequestHandler) {}
|
|
23
|
+
|
|
24
|
+
public async getWorkspaceApiUrl(workspaceName: string): Promise<string> {
|
|
25
|
+
return `${await this.getWorkspacesApiUrl()}/${workspaceName}`;
|
|
21
26
|
}
|
|
22
27
|
|
|
23
|
-
public getWorkspacesApiUrl(
|
|
24
|
-
|
|
28
|
+
public async getWorkspacesApiUrl(): Promise<string> {
|
|
29
|
+
const namespace = await this.obtainUserNamespace();
|
|
30
|
+
return `${ApiUrlResolver.DASHBOARD_API_URL}/${namespace}/devworkspaces`;
|
|
25
31
|
}
|
|
26
|
-
}
|
|
27
32
|
|
|
33
|
+
public getKubernetesApiUrl(): string {
|
|
34
|
+
return ApiUrlResolver.KUBERNETES_API_URL;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
private async obtainUserNamespace() : Promise<string> {
|
|
38
|
+
Logger.debug(`ApiUrlResolver.obtainUserNamespace ${this.userNamespace}`);
|
|
39
|
+
if (this.userNamespace.length === 0) {
|
|
40
|
+
Logger.trace(`ApiUrlResolver.obtainUserNamespace USER_NAMESPACE.length = 0, calling kubernetes API`);
|
|
41
|
+
const kubernetesResponse = await this.processRequestHandler.get(ApiUrlResolver.KUBERNETES_API_URL);
|
|
42
|
+
if (kubernetesResponse.status !== 200) {
|
|
43
|
+
throw new Error(`Cannot get user namespace from kubernetes API. Code: ${kubernetesResponse.status} Data: ${kubernetesResponse.data}`);
|
|
44
|
+
}
|
|
45
|
+
this.userNamespace = kubernetesResponse.data[0].name;
|
|
46
|
+
Logger.debug(`ApiUrlResolver.obtainUserNamespace kubeapi success: ${this.userNamespace}`);
|
|
47
|
+
}
|
|
48
|
+
return this.userNamespace;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/*********************************************************************
|
|
2
|
+
* Copyright (c) 2019 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
|
+
|
|
11
|
+
import { WorkspaceStatus } from './WorkspaceStatus';
|
|
12
|
+
import { che } from '@eclipse-che/api';
|
|
13
|
+
|
|
14
|
+
export interface ITestWorkspaceUtil {
|
|
15
|
+
waitWorkspaceStatus(namespace: string, workspaceName: string, expectedWorkspaceStatus: WorkspaceStatus) : void;
|
|
16
|
+
|
|
17
|
+
stopWorkspaceByName(workspaceName: string) : void;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Delete a worksapce without stopping phase (similar with force deleting)
|
|
21
|
+
*/
|
|
22
|
+
deleteWorkspaceByName(workspaceName: string) : void;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Stop workspace before deleting with checking stopping phase
|
|
26
|
+
*/
|
|
27
|
+
stopAndDeleteWorkspaceByName(workspaceName: string) : void;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Stop all run workspaces in the namespace
|
|
31
|
+
*/
|
|
32
|
+
stopAllRunningWorkspaces(namespace: string) : void;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Stop all run workspaces, check statused and remove the workspaces
|
|
36
|
+
*/
|
|
37
|
+
stopAndDeleteAllRunningWorkspaces(namespace: string) : void;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Stop all run workspaces without stopping and waiting for of 'Stopped' phase
|
|
41
|
+
* Similar with 'force' deleting
|
|
42
|
+
*/
|
|
43
|
+
deleteAllWorkspaces(namespace: string) : void;
|
|
44
|
+
|
|
45
|
+
/*=====================
|
|
46
|
+
* DEPRECATED METHODS *
|
|
47
|
+
*====================*/
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @deprecated Method deprecated. Works with CHE server only
|
|
51
|
+
*/
|
|
52
|
+
cleanUpAllWorkspaces() : void;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @deprecated Method deprecated. Works with CHE server only
|
|
56
|
+
*/
|
|
57
|
+
cleanUpRunningWorkspace(workspaceName: string) : void;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @deprecated Method deprecated. Works with CHE server only
|
|
61
|
+
*/
|
|
62
|
+
waitPluginAdding(namespace: string, workspaceName: string, pluginId: string) : void;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @deprecated Method deprecated. Works with CHE server only
|
|
66
|
+
*/
|
|
67
|
+
removeWorkspaceById(id: string) : void;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @deprecated Method deprecated. Works with CHE server only
|
|
71
|
+
*/
|
|
72
|
+
stopWorkspaceById(id: string) : void;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @deprecated Method deprecated. Works with CHE server only
|
|
76
|
+
*/
|
|
77
|
+
getIdOfRunningWorkspace(workspaceName: string): Promise<string>;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @deprecated Method deprecated. Works with CHE server only
|
|
81
|
+
*/
|
|
82
|
+
getIdOfRunningWorkspaces(): Promise<Array<string>>;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @deprecated Method deprecated. Works with CHE server only
|
|
86
|
+
*/
|
|
87
|
+
createWsFromDevFile(customTemplate: che.workspace.devfile.Devfile): void;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @deprecated Method deprecated. Works with CHE server only
|
|
91
|
+
*/
|
|
92
|
+
getBaseDevfile(): Promise<che.workspace.devfile.Devfile>;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @deprecated Method deprecated. Works with CHE server only
|
|
96
|
+
*/
|
|
97
|
+
startWorkspace(workspaceId: string): void;
|
|
98
|
+
}
|