@eclipse-che/che-e2e 7.76.0-next-bd36cef → 7.76.0-next-be6d9b8

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 (43) hide show
  1. package/dist/driver/ChromeDriver.js +1 -0
  2. package/dist/driver/ChromeDriver.js.map +1 -1
  3. package/dist/pageobjects/dashboard/Dashboard.js +1 -1
  4. package/dist/pageobjects/dashboard/Dashboard.js.map +1 -1
  5. package/dist/specs/SmokeTest.spec.js +4 -16
  6. package/dist/specs/SmokeTest.spec.js.map +1 -1
  7. package/dist/specs/dashboard-samples/Quarkus.spec.js +7 -6
  8. package/dist/specs/dashboard-samples/Quarkus.spec.js.map +1 -1
  9. package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js +6 -8
  10. package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js.map +1 -1
  11. package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js +3 -4
  12. package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js.map +1 -1
  13. package/dist/specs/factory/Factory.spec.js +8 -8
  14. package/dist/specs/factory/Factory.spec.js.map +1 -1
  15. package/dist/specs/factory/NoSetupRepoFactory.spec.js +6 -7
  16. package/dist/specs/factory/NoSetupRepoFactory.spec.js.map +1 -1
  17. package/dist/specs/factory/RefusedOAuthFactory.spec.js +7 -9
  18. package/dist/specs/factory/RefusedOAuthFactory.spec.js.map +1 -1
  19. package/dist/specs/miscellaneous/CreateWorkspaceWithExistedName.spec.js +6 -7
  20. package/dist/specs/miscellaneous/CreateWorkspaceWithExistedName.spec.js.map +1 -1
  21. package/dist/specs/miscellaneous/KubedockPodmanTest.spec.js +2 -12
  22. package/dist/specs/miscellaneous/KubedockPodmanTest.spec.js.map +1 -1
  23. package/dist/specs/miscellaneous/WorkspaceWithParent.spec.js +10 -9
  24. package/dist/specs/miscellaneous/WorkspaceWithParent.spec.js.map +1 -1
  25. package/dist/tests-library/ProjectAndFileTests.js +44 -1
  26. package/dist/tests-library/ProjectAndFileTests.js.map +1 -1
  27. package/dist/utils/CheReporter.js +11 -0
  28. package/dist/utils/CheReporter.js.map +1 -1
  29. package/driver/ChromeDriver.ts +1 -0
  30. package/package.json +3 -2
  31. package/pageobjects/dashboard/Dashboard.ts +1 -1
  32. package/specs/SmokeTest.spec.ts +8 -9
  33. package/specs/dashboard-samples/Quarkus.spec.ts +13 -7
  34. package/specs/dashboard-samples/RecommendedExtensions.spec.ts +6 -8
  35. package/specs/devconsole-intergration/DevConsoleIntegration.spec.ts +10 -4
  36. package/specs/factory/Factory.spec.ts +9 -11
  37. package/specs/factory/NoSetupRepoFactory.spec.ts +6 -9
  38. package/specs/factory/RefusedOAuthFactory.spec.ts +7 -11
  39. package/specs/miscellaneous/CreateWorkspaceWithExistedName.spec.ts +13 -7
  40. package/specs/miscellaneous/KubedockPodmanTest.spec.ts +3 -3
  41. package/specs/miscellaneous/WorkspaceWithParent.spec.ts +15 -10
  42. package/tests-library/ProjectAndFileTests.ts +58 -2
  43. package/utils/CheReporter.ts +12 -0
@@ -9,7 +9,7 @@
9
9
  **********************************************************************/
10
10
  import { e2eContainer } from '../../configs/inversify.config';
11
11
  import { ShellExecutor } from '../../utils/ShellExecutor';
12
- import { InputBox, QuickOpenBox, QuickPickItem, SideBarView, ViewItem, ViewSection, Workbench } from 'monaco-page-objects';
12
+ import { InputBox, QuickOpenBox, QuickPickItem, ViewItem, ViewSection, Workbench } from 'monaco-page-objects';
13
13
  import { CLASSES } from '../../configs/inversify.types';
14
14
  import { ProjectAndFileTests } from '../../tests-library/ProjectAndFileTests';
15
15
  import { LoginTests } from '../../tests-library/LoginTests';
@@ -32,9 +32,14 @@ suite('Workspace using a parent test suite', function (): void {
32
32
  const kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor = e2eContainer.get(
33
33
  CLASSES.KubernetesCommandLineToolsExecutor
34
34
  );
35
+
35
36
  let podName: string = '';
37
+
38
+ suiteSetup(function (): void {
39
+ kubernetesCommandLineToolsExecutor.loginToOcp();
40
+ });
41
+
36
42
  loginTests.loginIntoChe();
37
- kubernetesCommandLineToolsExecutor.loginToOcp();
38
43
 
39
44
  test('Create a workspace using a parent', async function (): Promise<void> {
40
45
  const factoryUrl: string = `${BASE_TEST_CONSTANTS.TS_SELENIUM_BASE_URL}/dashboard/#https://github.com/testsfactory/parentDevfile`;
@@ -47,12 +52,12 @@ suite('Workspace using a parent test suite', function (): void {
47
52
  });
48
53
 
49
54
  test('Check cloning of the test project', async function (): Promise<void> {
50
- const expectedProjectItems: string[] = ['.devfile.yaml', 'parent.yaml', 'README.md'];
51
- const visibleContent: ViewSection = await new SideBarView().getContent().getSection('parentdevfile');
55
+ const expectedProjectItems: string[] = ['.devfile.yaml', 'parent.yaml', 'README.md', 'parentdevfile'];
56
+ const visibleContent: ViewSection = await projectAndFileTests.getProjectViewSession();
52
57
 
53
58
  for (const expectedProjectItem of expectedProjectItems) {
54
- const visibleItem: ViewItem | undefined = await visibleContent.findItem(expectedProjectItem);
55
- expect(visibleItem).not.equal(undefined);
59
+ const visibleItem: ViewItem | undefined = await projectAndFileTests.getProjectTreeItem(visibleContent, expectedProjectItem);
60
+ expect(visibleItem).not.undefined;
56
61
  }
57
62
  });
58
63
 
@@ -76,20 +81,20 @@ suite('Workspace using a parent test suite', function (): void {
76
81
  const containerNames: string = shellExecutor.executeArbitraryShellScript(
77
82
  `${API_TEST_CONSTANTS.TS_API_TEST_KUBERNETES_COMMAND_LINE_TOOL} get pod ${podName} --output jsonpath=\'{.spec.containers[*].name}\'`
78
83
  );
79
- expect(containerNames).contain('tools');
80
- expect(containerNames).contains('che-gateway');
84
+ expect(containerNames).contains('tools').and.contains('che-gateway');
81
85
 
82
86
  const initContainerName: string = shellExecutor.executeArbitraryShellScript(
83
87
  `${API_TEST_CONSTANTS.TS_API_TEST_KUBERNETES_COMMAND_LINE_TOOL} get pod ${podName} --output jsonpath=\'{.spec.initContainers[].name}\'`
84
88
  );
85
- expect(initContainerName).contain('che-code-injector');
89
+ expect(initContainerName).contains('che-code-injector');
86
90
  });
87
91
 
88
92
  test('Check expected environment variables', function (): void {
89
93
  const envList: string = shellExecutor.executeArbitraryShellScript(
90
94
  `${API_TEST_CONSTANTS.TS_API_TEST_KUBERNETES_COMMAND_LINE_TOOL} exec -i ${podName} -c tools -- sh -c env`
91
95
  );
92
- expect(envList).contain('DEVFILE_ENV_VAR=true').and.contain('PARENT_ENV_VAR=true');
96
+ expect(envList).contains('DEVFILE_ENV_VAR=true').and.contains('PARENT_ENV_VAR=true');
93
97
  });
98
+
94
99
  loginTests.logoutFromChe();
95
100
  });
@@ -15,7 +15,7 @@ import { CLASSES } from '../configs/inversify.types';
15
15
  import { Logger } from '../utils/Logger';
16
16
  import { TIMEOUT_CONSTANTS } from '../constants/TIMEOUT_CONSTANTS';
17
17
  import { CheCodeLocatorLoader } from '../pageobjects/ide/CheCodeLocatorLoader';
18
- import { Workbench } from 'monaco-page-objects';
18
+ import { SideBarView, ViewContent, ViewItem, ViewSection, Workbench } from 'monaco-page-objects';
19
19
 
20
20
  @injectable()
21
21
  export class ProjectAndFileTests {
@@ -45,13 +45,16 @@ export class ProjectAndFileTests {
45
45
  async performTrustAuthorDialog(): Promise<void> {
46
46
  Logger.debug();
47
47
  // sometimes the trust dialog does not appear at first time, for avoiding this problem we send click event for activating
48
- await new Workbench().click();
48
+ const workbench: Workbench = new Workbench();
49
+ await workbench.click();
50
+
49
51
  await this.driverHelper.waitAndClick(
50
52
  this.cheCodeLocatorLoader.webCheCodeLocators.WelcomeContent.button,
51
53
  TIMEOUT_CONSTANTS.TS_DIALOG_WINDOW_DEFAULT_TIMEOUT
52
54
  );
53
55
 
54
56
  try {
57
+ await workbench.click();
55
58
  await this.driverHelper.waitAndClick(
56
59
  this.cheCodeLocatorLoader.webCheCodeLocators.WelcomeContent.button,
57
60
  TIMEOUT_CONSTANTS.TS_DIALOG_WINDOW_DEFAULT_TIMEOUT
@@ -60,4 +63,57 @@ export class ProjectAndFileTests {
60
63
  Logger.info('Second welcome content dialog box was not shown');
61
64
  }
62
65
  }
66
+
67
+ /**
68
+ * find an ViewSection with project tree.
69
+ * @returns Promise resolving to ViewSection object
70
+ */
71
+
72
+ async getProjectViewSession(): Promise<ViewSection> {
73
+ Logger.debug();
74
+
75
+ await this.driverHelper.waitVisibility(
76
+ this.cheCodeLocatorLoader.webCheCodeLocators.DefaultTreeSection.itemRow,
77
+ TIMEOUT_CONSTANTS.TS_EXPAND_PROJECT_TREE_ITEM_TIMEOUT
78
+ );
79
+
80
+ const viewContent: ViewContent = new SideBarView().getContent();
81
+ const [projectSection]: ViewSection[] = await viewContent.getSections();
82
+ return projectSection;
83
+ }
84
+
85
+ /**
86
+ * find an item in this view section by label. Does not perform recursive search through the whole tree.
87
+ * Does however scroll through all the expanded content. Will find items beyond the current scroll range.
88
+ * @param projectSection ViewSection with project tree files.
89
+ * @param label Label of the item to search for.
90
+ * @param itemLevel Shows how deep the algorithm should look into expanded folders to find item,
91
+ * default - 2 means first level is project directory and files inside it is the second level, unlimited 0
92
+ * @returns Promise resolving to ViewItem object is such item exists, undefined otherwise
93
+ */
94
+ async getProjectTreeItem(projectSection: ViewSection, label: string, itemLevel: number = 2): Promise<ViewItem | undefined> {
95
+ Logger.debug(`${label}`);
96
+
97
+ let projectTreeItem: ViewItem | undefined;
98
+ await this.driverHelper.waitVisibility(
99
+ this.cheCodeLocatorLoader.webCheCodeLocators.ScmView.itemLevel(itemLevel),
100
+ TIMEOUT_CONSTANTS.TS_EXPAND_PROJECT_TREE_ITEM_TIMEOUT
101
+ );
102
+
103
+ try {
104
+ projectTreeItem = await projectSection.findItem(label, itemLevel);
105
+ if (!projectTreeItem) {
106
+ try {
107
+ await projectSection.collapse();
108
+ projectTreeItem = await projectSection.findItem(label, itemLevel);
109
+ } catch (e) {
110
+ Logger.warn(JSON.stringify(e));
111
+ }
112
+ }
113
+ } catch (e) {
114
+ Logger.warn(JSON.stringify(e));
115
+ }
116
+
117
+ return projectTreeItem;
118
+ }
63
119
  }
@@ -26,6 +26,8 @@ import { PLUGIN_TEST_CONSTANTS } from '../constants/PLUGIN_TEST_CONSTANTS';
26
26
  import { injectable } from 'inversify';
27
27
  import getDecorators from 'inversify-inject-decorators';
28
28
  import { e2eContainer } from '../configs/inversify.config';
29
+ // @ts-ignore: No module declaration file
30
+ import * as chromeHar from 'chrome-har';
29
31
 
30
32
  const { lazyInject } = getDecorators(e2eContainer);
31
33
 
@@ -135,6 +137,7 @@ class CheReporter extends mocha.reporters.Spec {
135
137
  const screenshotFileName: string = `${testReportDirPath}/screenshot-${testTitle}.png`;
136
138
  const pageSourceFileName: string = `${testReportDirPath}/pagesource-${testTitle}.html`;
137
139
  const browserLogsFileName: string = `${testReportDirPath}/browserlogs-${testTitle}.txt`;
140
+ const harFileName: string = `${testReportDirPath}/har-${testTitle}.har`;
138
141
 
139
142
  // create reporter dir if not exist
140
143
  const reportDirExists: boolean = fs.existsSync(REPORTER_CONSTANTS.TS_SELENIUM_REPORT_FOLDER);
@@ -172,6 +175,15 @@ class CheReporter extends mocha.reporters.Spec {
172
175
  browserLogsStream.write(Buffer.from(browserLogs), (): void => {
173
176
  browserLogsStream.end();
174
177
  });
178
+
179
+ // take networking logs and write to file
180
+ const networkLogsEntries: logging.Entry[] = await this.driverHelper.getDriver().manage().logs().get('performance');
181
+ const events = networkLogsEntries.map((entry) => JSON.parse(entry.message).message);
182
+ const har = chromeHar.harFromMessages(events, { includeTextFromResponseBody: true });
183
+ const networkLogsStream: WriteStream = fs.createWriteStream(harFileName);
184
+ networkLogsStream.write(Buffer.from(JSON.stringify(har)), (): void => {
185
+ networkLogsStream.end();
186
+ });
175
187
  });
176
188
  }
177
189
  }