@eclipse-che/che-e2e 7.43.0 → 7.44.1-dev-bc873f3

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.
Files changed (85) hide show
  1. package/README.md +16 -1
  2. package/dist/driver/CheReporter.js +4 -4
  3. package/dist/driver/CheReporter.js.map +1 -1
  4. package/dist/index.js +1 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/pageobjects/dashboard/Dashboard.js +4 -0
  7. package/dist/pageobjects/dashboard/Dashboard.js.map +1 -1
  8. package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js +1 -1
  9. package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js.map +1 -1
  10. package/dist/pageobjects/ide/Ide.js +31 -7
  11. package/dist/pageobjects/ide/Ide.js.map +1 -1
  12. package/dist/pageobjects/ide/PreviewWidget.js +6 -2
  13. package/dist/pageobjects/ide/PreviewWidget.js.map +1 -1
  14. package/dist/pageobjects/ide/ProjectTree.js +12 -11
  15. package/dist/pageobjects/ide/ProjectTree.js.map +1 -1
  16. package/dist/tests/devfiles/DotNetCore.spec.js +1 -1
  17. package/dist/tests/devfiles/DotNetCore.spec.js.map +1 -1
  18. package/dist/tests/devfiles/Go.spec.js +15 -15
  19. package/dist/tests/devfiles/Go.spec.js.map +1 -1
  20. package/dist/tests/e2e/OpenshiftConnector.spec.js +2 -2
  21. package/dist/tests/e2e/factories/DirectUrlFactoryWithKeepDirectoryTest.spec.js +10 -9
  22. package/dist/tests/e2e/factories/DirectUrlFactoryWithKeepDirectoryTest.spec.js.map +1 -1
  23. package/dist/tests/e2e/factories/DirectUrlFactoryWithRootFolderTest.spec.js +10 -9
  24. package/dist/tests/e2e/factories/DirectUrlFactoryWithRootFolderTest.spec.js.map +1 -1
  25. package/dist/tests/e2e/factories/DirectUrlFactoryWithSpecificBranchTest.spec.js +15 -14
  26. package/dist/tests/e2e/factories/DirectUrlFactoryWithSpecificBranchTest.spec.js.map +1 -1
  27. package/dist/tests/e2e_happy_path/DevWorkspaceHappyPath.spec.js +17 -16
  28. package/dist/tests/e2e_happy_path/DevWorkspaceHappyPath.spec.js.map +1 -1
  29. package/dist/tests/plugins/GitHubPullRequestPlugin.spec.js +3 -2
  30. package/dist/tests/plugins/GitHubPullRequestPlugin.spec.js.map +1 -1
  31. package/dist/tests/plugins/JavaPlugin.spec.js +27 -23
  32. package/dist/tests/plugins/JavaPlugin.spec.js.map +1 -1
  33. package/dist/tests/plugins/PythonPlugin.spec.js +10 -14
  34. package/dist/tests/plugins/PythonPlugin.spec.js.map +1 -1
  35. package/dist/tests/plugins/TypescriptPlugin.spec.js +14 -22
  36. package/dist/tests/plugins/TypescriptPlugin.spec.js.map +1 -1
  37. package/dist/tests/plugins/VscodeYamlPlugin.spec.js +11 -20
  38. package/dist/tests/plugins/VscodeYamlPlugin.spec.js.map +1 -1
  39. package/dist/testsLibrary/CodeExecutionTests.js +1 -2
  40. package/dist/testsLibrary/CodeExecutionTests.js.map +1 -1
  41. package/dist/testsLibrary/LanguageServerTests.js +5 -12
  42. package/dist/testsLibrary/LanguageServerTests.js.map +1 -1
  43. package/dist/testsLibrary/ProjectAndFileTests.js +0 -5
  44. package/dist/testsLibrary/ProjectAndFileTests.js.map +1 -1
  45. package/dist/testsLibrary/WorkspaceHandlingTests.js +11 -7
  46. package/dist/testsLibrary/WorkspaceHandlingTests.js.map +1 -1
  47. package/dist/utils/PreferencesHandler.js +3 -0
  48. package/dist/utils/PreferencesHandler.js.map +1 -1
  49. package/dist/utils/requestHandlers/headers/CheMultiuserAuthorizationHeaderHandler.js +3 -15
  50. package/dist/utils/requestHandlers/headers/CheMultiuserAuthorizationHeaderHandler.js.map +1 -1
  51. package/dist/utils/requestHandlers/tokens/CheMultiuserTokenHandler.js +3 -3
  52. package/dist/utils/requestHandlers/tokens/CheMultiuserTokenHandler.js.map +1 -1
  53. package/driver/CheReporter.ts +4 -4
  54. package/index.ts +1 -1
  55. package/mocha-all-factories.json +2 -1
  56. package/package.json +3 -3
  57. package/pageobjects/dashboard/Dashboard.ts +6 -1
  58. package/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts +1 -1
  59. package/pageobjects/ide/Ide.ts +30 -7
  60. package/pageobjects/ide/PreviewWidget.ts +6 -2
  61. package/pageobjects/ide/ProjectTree.ts +9 -11
  62. package/tests/devfiles/DotNetCore.spec.ts +1 -1
  63. package/tests/devfiles/Go.spec.ts +15 -17
  64. package/tests/e2e/OpenshiftConnector.spec.ts +2 -2
  65. package/tests/e2e/factories/DirectUrlFactoryWithKeepDirectoryTest.spec.ts +15 -13
  66. package/tests/e2e/factories/DirectUrlFactoryWithRootFolderTest.spec.ts +15 -14
  67. package/tests/e2e/factories/DirectUrlFactoryWithSpecificBranchTest.spec.ts +19 -20
  68. package/tests/e2e_happy_path/DevWorkspaceHappyPath.spec.ts +123 -124
  69. package/tests/plugins/GitHubPullRequestPlugin.spec.ts +3 -2
  70. package/tests/plugins/JavaPlugin.spec.ts +20 -26
  71. package/tests/plugins/PythonPlugin.spec.ts +13 -17
  72. package/tests/plugins/TypescriptPlugin.spec.ts +18 -27
  73. package/tests/plugins/VscodeYamlPlugin.spec.ts +14 -24
  74. package/testsLibrary/CodeExecutionTests.ts +1 -2
  75. package/testsLibrary/LanguageServerTests.ts +4 -9
  76. package/testsLibrary/ProjectAndFileTests.ts +3 -6
  77. package/testsLibrary/WorkspaceHandlingTests.ts +8 -4
  78. package/tsconfig.json +1 -0
  79. package/tslint.json +119 -115
  80. package/utils/PreferencesHandler.ts +3 -0
  81. package/utils/requestHandlers/headers/CheMultiuserAuthorizationHeaderHandler.ts +3 -9
  82. package/utils/requestHandlers/tokens/CheMultiuserTokenHandler.ts +20 -18
  83. package/dist/utils/KeycloackUrlHandler.js +0 -30
  84. package/dist/utils/KeycloackUrlHandler.js.map +0 -1
  85. package/utils/KeycloackUrlHandler.ts +0 -32
@@ -11,34 +11,32 @@
11
11
  import { Key } from 'selenium-webdriver';
12
12
  import { e2eContainer } from '../../inversify.config';
13
13
  import { CLASSES } from '../../inversify.types';
14
- import { Ide } from '../../pageobjects/ide/Ide';
15
14
  import { ProjectTree } from '../../pageobjects/ide/ProjectTree';
16
15
  import { Editor } from '../../pageobjects/ide/Editor';
17
- import { PreferencesHandler } from '../../utils/PreferencesHandler';
18
16
  import { TestConstants } from '../../TestConstants';
19
- import { TimeoutConstants } from '../../TimeoutConstants';
20
- import { WorkspaceNameHandler } from '../../utils/WorkspaceNameHandler';
21
17
  import { Logger } from '../../utils/Logger';
22
18
  import { WorkspaceHandlingTests } from '../../testsLibrary/WorkspaceHandlingTests';
23
19
  import CheReporter from '../../driver/CheReporter';
24
20
  import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
21
+ import { PreferencesHandler } from '../../utils/PreferencesHandler';
22
+ import { ProjectAndFileTests } from '../../testsLibrary/ProjectAndFileTests';
25
23
 
26
- const ide: Ide = e2eContainer.get(CLASSES.Ide);
24
+ const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
27
25
  const projectTree: ProjectTree = e2eContainer.get(CLASSES.ProjectTree);
28
26
  const editor: Editor = e2eContainer.get(CLASSES.Editor);
29
27
  const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
30
- const preferencesHandler: PreferencesHandler = e2eContainer.get(CLASSES.PreferencesHandler);
31
28
  const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
32
- const workspaceNameHandler: WorkspaceNameHandler = e2eContainer.get(CLASSES.WorkspaceNameHandler);
29
+ const preferencesHandler: PreferencesHandler = e2eContainer.get(CLASSES.PreferencesHandler);
33
30
 
34
- const devfileUrl: string = 'https://raw.githubusercontent.com/eclipse/che/main/tests/e2e/files/devfiles/plugins/VscodeYamlPlugin.yaml';
31
+ const devfileUrl: string = 'https://github.com/che-samples/web-nodejs-sample/tree/yaml-plugin';
35
32
  const factoryUrl: string = `${TestConstants.TS_SELENIUM_BASE_URL}/f?url=${devfileUrl}`;
36
- const projectName: string = 'nodejs-web-app';
33
+ const projectName: string = 'web-nodejs-sample';
34
+ const subRootFolder: string = 'app';
37
35
  const pathToFile: string = `${projectName}`;
38
36
  const yamlFileName: string = 'routes.yaml';
39
37
  const yamlSchema = { 'yaml-schema.json': '*.yaml' };
40
38
 
41
- let workspaceName: string = '';
39
+ let workspaceName: string = 'yaml-plugin';
42
40
 
43
41
  suite('The "VscodeYamlPlugin" userstory', async () => {
44
42
  suite('Create workspace', async () => {
@@ -46,20 +44,12 @@ suite('The "VscodeYamlPlugin" userstory', async () => {
46
44
  await browserTabsUtil.navigateTo(factoryUrl);
47
45
  });
48
46
 
47
+ projectAndFileTests.waitWorkspaceReadiness(projectName, subRootFolder);
48
+
49
49
  test('Wait until created workspace is started', async () => {
50
- await ide.waitAndSwitchToIdeFrame();
51
- workspaceName = await workspaceNameHandler.getNameFromUrl();
52
50
  CheReporter.registerRunningWorkspace(workspaceName);
53
51
 
54
- await ide.waitIde(TimeoutConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT);
55
- await ide.waitNotificationAndClickOnButton('Do you trust the authors of', 'Yes, I trust', 60_000);
56
- });
57
- });
58
-
59
- suite('Check workspace readiness to work', async () => {
60
- test('Wait until project is imported', async () => {
61
- await projectTree.openProjectTreeContainer();
62
- await projectTree.waitProjectImported(projectName, 'app');
52
+ await preferencesHandler.setPreferenceUsingUI('application.confirmExit', 'never');
63
53
  });
64
54
  });
65
55
 
@@ -76,13 +66,13 @@ suite('The "VscodeYamlPlugin" userstory', async () => {
76
66
  test('Check error appearance', async () => {
77
67
  await projectTree.expandPathAndOpenFile(pathToFile, yamlFileName);
78
68
 
79
- await editor.type(yamlFileName, Key.SPACE, 19);
80
- await editor.waitErrorInLine(19, yamlFileName);
69
+ await editor.type(yamlFileName, Key.SPACE, 20);
70
+ await editor.waitErrorInLine(20, yamlFileName);
81
71
  });
82
72
 
83
73
  test('Check error disappearance', async () => {
84
74
  await editor.performKeyCombination(yamlFileName, Key.BACK_SPACE);
85
- await editor.waitErrorInLineDisappearance(19, yamlFileName);
75
+ await editor.waitErrorInLineDisappearance(20, yamlFileName);
86
76
  });
87
77
 
88
78
  test('To unformat the "yaml" file', async () => {
@@ -140,8 +140,7 @@ export class CodeExecutionTests {
140
140
  // https://issues.redhat.com/browse/CRW-2175
141
141
  if (err instanceof error.TimeoutError) {
142
142
  Logger.warn(`CodeExecutionTests.verifyRunningApplication application not located, probably blocked by preloader or content not available. Retrying.`);
143
- await this.driverHelper.getDriver().switchTo().defaultContent();
144
- await this.ide.waitAndSwitchToIdeFrame();
143
+ await this.ide.waitIde();
145
144
  await this.previewWidget.refreshPage();
146
145
  await this.previewWidget.waitContentAvailable(locator, applicationCheckTimeout, polling);
147
146
  }
@@ -19,7 +19,6 @@ import { DebugView } from '../pageobjects/ide/DebugView';
19
19
  import { Key, error } from 'selenium-webdriver';
20
20
  import { Logger } from '../utils/Logger';
21
21
  import { BrowserTabsUtil } from '../utils/BrowserTabsUtil';
22
- import { DriverHelper } from '../utils/DriverHelper';
23
22
 
24
23
  @injectable()
25
24
  export class LanguageServerTests {
@@ -29,8 +28,7 @@ export class LanguageServerTests {
29
28
  @inject(CLASSES.Ide) private readonly ide: Ide,
30
29
  @inject(CLASSES.TopMenu) private readonly topMenu: TopMenu,
31
30
  @inject(CLASSES.DebugView) private readonly debugView: DebugView,
32
- @inject(CLASSES.BrowserTabsUtil) private readonly browserTabsUtil: BrowserTabsUtil,
33
- @inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { }
31
+ @inject(CLASSES.BrowserTabsUtil) private readonly browserTabsUtil: BrowserTabsUtil) { }
34
32
 
35
33
  public errorHighlighting(openedTab: string, textToWrite: string, line: number) {
36
34
  test('Error highlighting', async () => {
@@ -68,6 +66,7 @@ export class LanguageServerTests {
68
66
  await this.editor.pressControlSpaceCombination(openedTab);
69
67
  await this.editor.waitSuggestionContainer();
70
68
  await this.editor.waitSuggestionWithScrolling(openedTab, expectedText);
69
+ await this.editor.waitTabWithSavedStatus(openedTab);
71
70
  });
72
71
  }
73
72
 
@@ -163,9 +162,7 @@ export class LanguageServerTests {
163
162
  } catch (err) {
164
163
  // debug config is probably missing, refresh IDE and try again https://github.com/eclipse/che/issues/19887
165
164
  await this.browserTabsUtil.refreshPage();
166
- await this.driverHelper.wait(TimeoutConstants.TS_IDE_LOAD_TIMEOUT);
167
- await this.ide.waitAndSwitchToIdeFrame();
168
- await this.driverHelper.wait(TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM);
165
+ await this.ide.waitIde();
169
166
  await this.debugView.clickOnRunDebugButton();
170
167
  }
171
168
  });
@@ -186,9 +183,7 @@ export class LanguageServerTests {
186
183
  } catch (err) {
187
184
  // debug config is probably missing, refresh IDE and try again https://github.com/eclipse/che/issues/19887
188
185
  await this.browserTabsUtil.refreshPage();
189
- await this.driverHelper.wait(TimeoutConstants.TS_IDE_LOAD_TIMEOUT);
190
- await this.ide.waitAndSwitchToIdeFrame();
191
- await this.driverHelper.wait(TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM);
186
+ await this.ide.waitIde();
192
187
  await this.debugView.clickOnDebugConfigurationDropDown();
193
188
  await this.debugView.clickOnDebugConfigurationItem(configurationName);
194
189
  await this.debugView.clickOnRunDebugButton();
@@ -31,26 +31,23 @@ export class ProjectAndFileTests {
31
31
 
32
32
  public waitWorkspaceReadiness(sampleName : string, folder: string, checkNotification: boolean = true, restartWorkspaceDialogIsExpected: boolean = false) {
33
33
  test('Wait for workspace readiness', async () => {
34
- await this.ide.waitAndSwitchToIdeFrame();
35
34
  await this.ide.waitIde(TimeoutConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT);
36
- if (checkNotification) {
37
- await this.ide.waitNotificationAndClickOnButton('Do you trust the authors of', 'Yes, I trust', 60_000);
38
- }
35
+
39
36
  if (restartWorkspaceDialogIsExpected) {
40
37
  await this.ide.clickOnCancelDialogButton();
41
-
42
38
  }
39
+
43
40
  await this.projectTree.openProjectTreeContainer();
44
41
  if (!await this.openEditors.isExpansionToggleCollapsed()) {
45
42
  await this.openEditors.waitAndClickExpansionToggle();
46
43
  }
44
+
47
45
  await this.projectTree.waitProjectImported(sampleName, folder);
48
46
  });
49
47
  }
50
48
 
51
49
  public waitWorkspaceReadinessNoSubfolder(sampleName : string, checkNotification: boolean = true) {
52
50
  test('Wait for workspace readiness', async () => {
53
- await this.ide.waitAndSwitchToIdeFrame();
54
51
  await this.ide.waitIde(TimeoutConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT);
55
52
  if (checkNotification) {
56
53
  await this.ide.waitNotificationAndClickOnButton('Do you trust the authors of', 'Yes, I trust', 60_000);
@@ -14,7 +14,8 @@ import { CLASSES } from '../inversify.types';
14
14
  import { Dashboard } from '../pageobjects/dashboard/Dashboard';
15
15
  import { CreateWorkspace } from '../pageobjects/dashboard/CreateWorkspace';
16
16
  import { Workspaces } from '../pageobjects/dashboard/Workspaces';
17
- import { WorkspaceNameHandler } from '../utils/WorkspaceNameHandler';
17
+ import { BrowserTabsUtil } from '../utils/BrowserTabsUtil';
18
+ import { Logger } from '..';
18
19
 
19
20
  @injectable()
20
21
  export class WorkspaceHandlingTests {
@@ -29,16 +30,19 @@ export class WorkspaceHandlingTests {
29
30
  @inject(CLASSES.Dashboard) private readonly dashboard: Dashboard,
30
31
  @inject(CLASSES.CreateWorkspace) private readonly createWorkspace: CreateWorkspace,
31
32
  @inject(CLASSES.Workspaces) private readonly workspaces: Workspaces,
32
- @inject(CLASSES.WorkspaceNameHandler) private readonly workspaceNameHandler: WorkspaceNameHandler) {}
33
+ @inject(CLASSES.BrowserTabsUtil) private readonly browserTabsUtil: BrowserTabsUtil) {}
33
34
 
34
35
  public createAndOpenWorkspace(stack: string) {
35
36
  test(`Open 'New Workspace' page`, async () => {
36
37
  await this.dashboard.waitPage();
37
38
  await this.dashboard.clickCreateWorkspaceButton();
38
39
  await this.createWorkspace.waitPage();
40
+ const parentGUID = await this.browserTabsUtil.getCurrentWindowHandle();
39
41
  await this.createWorkspace.clickOnSample(stack);
40
- await this.dashboard.waitWorkspaceStartingPage();
41
- WorkspaceHandlingTests.workspaceName = await this.workspaceNameHandler.getNameFromUrl();
42
+ await this.browserTabsUtil.switchToWindow(parentGUID);
43
+ WorkspaceHandlingTests.workspaceName = await this.dashboard.getRecentWorkspaceName(10000);
44
+ Logger.debug(`Workspace Name is: ${WorkspaceHandlingTests.workspaceName}`);
45
+ await this.browserTabsUtil.waitAndSwitchToAnotherWindow(parentGUID, 10000);
42
46
  });
43
47
  }
44
48
 
package/tsconfig.json CHANGED
@@ -11,6 +11,7 @@
11
11
  "types": ["reflect-metadata", "@types/mocha", "@types/node"],
12
12
  "experimentalDecorators": true,
13
13
  "emitDecoratorMetadata": true,
14
+ "noImplicitReturns": false,
14
15
  "sourceMap": true
15
16
  }
16
17
  }
package/tslint.json CHANGED
@@ -1,123 +1,127 @@
1
1
  {
2
- "rules": {
3
- "ban": [
4
- true,
5
- [
6
- "_",
7
- "extend"
8
- ],
9
- [
10
- "_",
11
- "isNull"
12
- ],
13
- [
14
- "_",
15
- "isDefined"
16
- ]
2
+ "rules": {
3
+ "ban": [
4
+ true,
5
+ [
6
+ "_",
7
+ "extend"
17
8
  ],
18
- "class-name": true,
19
- "comment-format": [
20
- true,
21
- "check-space",
22
- "check-lowercase"
9
+ [
10
+ "_",
11
+ "isNull"
23
12
  ],
24
- "curly": true,
25
- "eofline": true,
26
- "forin": true,
27
- "indent": [
28
- true,
29
- 2
30
- ],
31
- "interface-name": true,
32
- "jsdoc-format": true,
33
- "label-position": true,
34
- "label-undefined": true,
35
- "max-line-length": [
36
- false,
37
- 140
38
- ],
39
- "member-ordering": [
40
- true,
41
- "public-before-private",
42
- "static-before-instance",
43
- "variables-before-functions"
44
- ],
45
- "no-arg": true,
46
- "no-bitwise": true,
47
- "no-console": [
48
- true,
49
- "debug",
50
- "info",
51
- "time",
52
- "timeEnd",
53
- "trace"
54
- ],
55
- "no-construct": true,
56
- "no-constructor-vars": true,
57
- "no-debugger": true,
58
- "no-duplicate-key": true,
59
- "no-duplicate-variable": true,
60
- "no-empty": true,
61
- "no-eval": true,
62
- "no-string-literal": true,
63
- "no-switch-case-fall-through": true,
64
- "no-trailing-comma": true,
65
- "no-trailing-whitespace": true,
66
- "no-unused-expression": true,
67
- "no-unused-variable": true,
68
- "no-unreachable": true,
69
- "no-use-before-declare": true,
70
- "no-var-requires": false,
71
- "one-line": [
72
- true,
73
- "check-open-brace",
74
- "check-catch",
75
- "check-else",
76
- "check-whitespace"
77
- ],
78
- "quotemark": [
79
- true,
80
- "single"
81
- ],
82
- "radix": true,
83
- "semicolon": true,
84
- "triple-equals": [
85
- true,
86
- "allow-null-check"
87
- ],
88
- "typedef": [
89
- true,
13
+ [
14
+ "_",
15
+ "isDefined"
16
+ ]
17
+ ],
18
+ "class-name": true,
19
+ "comment-format": [
20
+ true,
21
+ "check-space",
22
+ "check-lowercase"
23
+ ],
24
+ "curly": true,
25
+ "eofline": true,
26
+ "forin": true,
27
+ "indent": [
28
+ true,
29
+ 2
30
+ ],
31
+ "interface-name": true,
32
+ "jsdoc-format": true,
33
+ "label-position": true,
34
+ "max-line-length": [
35
+ false,
36
+ 140
37
+ ],
38
+ "member-ordering": [
39
+ true,
40
+ "public-before-private",
41
+ "static-before-instance",
42
+ "variables-before-functions"
43
+ ],
44
+ "no-arg": true,
45
+ "no-bitwise": true,
46
+ "no-console": [
47
+ true,
48
+ "debug",
49
+ "info",
50
+ "time",
51
+ "timeEnd",
52
+ "trace"
53
+ ],
54
+ "no-construct": true,
55
+ "no-parameter-properties": false,
56
+ "no-debugger": true,
57
+ "no-duplicate-variable": true,
58
+ "no-empty": true,
59
+ "no-eval": true,
60
+ "no-string-literal": true,
61
+ "no-switch-case-fall-through": true,
62
+ "trailing-comma": [true, {
63
+ "singleline": "never",
64
+ "multiline": {
65
+ "objects": "ignore",
66
+ "arrays": "always",
67
+ "functions": "never",
68
+ "typeLiterals": "ignore"
69
+ }
70
+ }],
71
+ "no-trailing-whitespace": true,
72
+ "no-unused-expression": true,
73
+ "no-unused-variable": true,
74
+ "no-use-before-declare": true,
75
+ "no-var-requires": false,
76
+ "one-line": [
77
+ true,
78
+ "check-open-brace",
79
+ "check-catch",
80
+ "check-else",
81
+ "check-whitespace"
82
+ ],
83
+ "quotemark": [
84
+ true,
85
+ "single"
86
+ ],
87
+ "radix": true,
88
+ "semicolon": true,
89
+ "triple-equals": [
90
+ true,
91
+ "allow-null-check"
92
+ ],
93
+ "typedef": [
94
+ true,
95
+ "callSignature",
96
+ "indexSignature",
97
+ "parameter",
98
+ "propertySignature",
99
+ "variableDeclarator"
100
+ ],
101
+ "typedef-whitespace": [
102
+ true,
103
+ [
90
104
  "callSignature",
91
- "indexSignature",
92
- "parameter",
93
- "propertySignature",
94
- "variableDeclarator"
105
+ "noSpace"
95
106
  ],
96
- "typedef-whitespace": [
97
- true,
98
- [
99
- "callSignature",
100
- "noSpace"
101
- ],
102
- [
103
- "catchClause",
104
- "noSpace"
105
- ],
106
- [
107
- "indexSignature",
108
- "space"
109
- ]
107
+ [
108
+ "catchClause",
109
+ "noSpace"
110
110
  ],
111
- "use-strict": false,
112
- "variable-name": false,
113
- "whitespace": [
114
- true,
115
- "check-branch",
116
- "check-decl",
117
- "check-operator",
118
- "check-separator",
119
- "check-type"
111
+ [
112
+ "indexSignature",
113
+ "space"
120
114
  ]
121
- }
115
+ ],
116
+ "use-strict": false,
117
+ "variable-name": false,
118
+ "whitespace": [
119
+ true,
120
+ "check-branch",
121
+ "check-decl",
122
+ "check-operator",
123
+ "check-separator",
124
+ "check-type"
125
+ ]
122
126
  }
123
-
127
+ }
@@ -47,6 +47,9 @@ export class PreferencesHandler {
47
47
  await this.quickOpenContainer.typeAndSelectSuggestion('Preferences:', 'Preferences: Open Preferences (JSON)');
48
48
 
49
49
  let editorText: string = await this.editor.getEditorVisibleText(tabTitle);
50
+ if (!editorText) {
51
+ editorText = '{}';
52
+ }
50
53
  let preferences = JSON.parse(editorText);
51
54
  preferences[property] = value;
52
55
 
@@ -8,20 +8,14 @@
8
8
  * SPDX-License-Identifier: EPL-2.0
9
9
  **********************************************************************/
10
10
  import { AxiosRequestConfig } from 'axios';
11
-
12
- import { TYPES } from '../../../inversify.types';
13
11
  import { IAuthorizationHeaderHandler } from './IAuthorizationHeaderHandler';
14
- import { injectable, inject } from 'inversify';
15
- import { ITokenHandler } from '../tokens/ITokenHandler';
12
+ import { injectable } from 'inversify';
16
13
 
17
14
  @injectable()
18
15
  export class CheMultiuserAuthorizationHeaderHandler implements IAuthorizationHeaderHandler {
19
16
 
20
- constructor(@inject(TYPES.ITokenHandler) private readonly tokenHandler: ITokenHandler) {
21
- }
22
-
23
17
  async get(): Promise<AxiosRequestConfig> {
24
- const token = await this.tokenHandler.get();
25
- return { headers: { 'Authorization': `Bearer ${token}` } };
18
+ // to-do : Fetch the cookies from user api and pass it here
19
+ return { headers: { 'cookie': `` } };
26
20
  }
27
21
  }
@@ -12,28 +12,30 @@ import querystring from 'querystring';
12
12
  import { injectable } from 'inversify';
13
13
  import { TestConstants } from '../../../TestConstants';
14
14
  import { ITokenHandler } from './ITokenHandler';
15
- import { KeycloackUrlHandler } from '../../KeycloackUrlHandler';
15
+
16
16
 
17
17
  @injectable()
18
18
  export class CheMultiuserTokenHandler implements ITokenHandler {
19
- async get(): Promise<string> {
20
- const keycloakUrl = KeycloackUrlHandler.getTokenEndpointUrl();
21
-
22
- const params = {
23
- client_id: 'che-public',
24
- username: TestConstants.TS_SELENIUM_USERNAME,
25
- password: TestConstants.TS_SELENIUM_PASSWORD,
26
- grant_type: 'password'
27
- };
19
+ async get(): Promise<string> {
20
+ // to-do: Login to the che-dashboard and fetch the authorization related info
21
+ const keycloakUrl = '';
28
22
 
29
- try {
30
- const responseToObtainBearerToken = await axios.post(keycloakUrl, querystring.stringify(params));
31
- return responseToObtainBearerToken.data.access_token;
32
- } catch (err) {
33
- console.log(`Can not get bearer token. URL used: ${keycloakUrl}`);
34
- throw err;
35
- }
23
+ const params = {
24
+ client_id: 'che-public',
25
+ username: TestConstants.TS_SELENIUM_USERNAME,
26
+ password: TestConstants.TS_SELENIUM_PASSWORD,
27
+ grant_type: 'password',
28
+ };
36
29
 
30
+ try {
31
+ const responseToObtainBearerToken = await axios.post(
32
+ keycloakUrl,
33
+ querystring.stringify(params)
34
+ );
35
+ return responseToObtainBearerToken.data.access_token;
36
+ } catch (err) {
37
+ console.log(`Can not get bearer token. URL used: ${keycloakUrl}`);
38
+ throw err;
37
39
  }
38
-
40
+ }
39
41
  }
@@ -1,30 +0,0 @@
1
- "use strict";
2
- /*********************************************************************
3
- * Copyright (c) 2019 Red Hat, Inc.
4
- *
5
- * This program and the accompanying materials are made
6
- * available under the terms of the Eclipse Public License 2.0
7
- * which is available at https://www.eclipse.org/legal/epl-2.0/
8
- *
9
- * SPDX-License-Identifier: EPL-2.0
10
- **********************************************************************/
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.KeycloackUrlHandler = void 0;
13
- const TestConstants_1 = require("../TestConstants");
14
- class KeycloackUrlHandler {
15
- static getBaseKeycloakUrl() {
16
- let baseKeycloakUrl = TestConstants_1.TestConstants.TS_SELENIUM_BASE_URL;
17
- if (!TestConstants_1.TestConstants.TS_SELENIUM_SINGLE_HOST) {
18
- baseKeycloakUrl = baseKeycloakUrl.replace('che', 'keycloak');
19
- }
20
- return baseKeycloakUrl;
21
- }
22
- static getTokenEndpointUrl() {
23
- return `${this.getBaseKeycloakUrl()}/auth/realms/che/protocol/openid-connect/token`;
24
- }
25
- static getIdentityCallbackUrl() {
26
- return `${this.getBaseKeycloakUrl()}/auth/realms/che/broker/github/endpoint`;
27
- }
28
- }
29
- exports.KeycloackUrlHandler = KeycloackUrlHandler;
30
- //# sourceMappingURL=KeycloackUrlHandler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"KeycloackUrlHandler.js","sourceRoot":"","sources":["../../utils/KeycloackUrlHandler.ts"],"names":[],"mappings":";AAAA;;;;;;;;wEAQwE;;;AAExE,oDAAiD;AAEjD,MAAa,mBAAmB;IACrB,MAAM,CAAC,kBAAkB;QAC5B,IAAI,eAAe,GAAW,6BAAa,CAAC,oBAAoB,CAAC;QAEjE,IAAI,CAAC,6BAAa,CAAC,uBAAuB,EAAE;YACxC,eAAe,GAAG,eAAe,CAAC,OAAO,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;SAChE;QAED,OAAO,eAAe,CAAC;IAC3B,CAAC;IAEM,MAAM,CAAC,mBAAmB;QAC7B,OAAO,GAAG,IAAI,CAAC,kBAAkB,EAAE,gDAAgD,CAAC;IACxF,CAAC;IAEM,MAAM,CAAC,sBAAsB;QAChC,OAAO,GAAG,IAAI,CAAC,kBAAkB,EAAE,yCAAyC,CAAC;IACjF,CAAC;CAEJ;AAnBD,kDAmBC"}
@@ -1,32 +0,0 @@
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 { TestConstants } from '../TestConstants';
12
-
13
- export class KeycloackUrlHandler {
14
- public static getBaseKeycloakUrl(): string {
15
- let baseKeycloakUrl: string = TestConstants.TS_SELENIUM_BASE_URL;
16
-
17
- if (!TestConstants.TS_SELENIUM_SINGLE_HOST) {
18
- baseKeycloakUrl = baseKeycloakUrl.replace('che', 'keycloak');
19
- }
20
-
21
- return baseKeycloakUrl;
22
- }
23
-
24
- public static getTokenEndpointUrl(): string {
25
- return `${this.getBaseKeycloakUrl()}/auth/realms/che/protocol/openid-connect/token`;
26
- }
27
-
28
- public static getIdentityCallbackUrl(): string {
29
- return `${this.getBaseKeycloakUrl()}/auth/realms/che/broker/github/endpoint`;
30
- }
31
-
32
- }