@eclipse-che/che-e2e 7.64.0-dev-db63138 → 7.64.0-dev-f0466d9

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 (62) hide show
  1. package/configs/inversify.types.ts +2 -2
  2. package/configs/mocharc.ts +2 -2
  3. package/constants/TestConstants.ts +2 -2
  4. package/constants/TimeoutConstants.ts +1 -1
  5. package/dist/configs/inversify.types.js.map +1 -1
  6. package/dist/configs/mocharc.js +2 -2
  7. package/dist/configs/mocharc.js.map +1 -1
  8. package/dist/constants/TestConstants.js.map +1 -1
  9. package/dist/constants/TimeoutConstants.js.map +1 -1
  10. package/dist/driver/ChromeDriver.js.map +1 -1
  11. package/dist/pageobjects/dashboard/CreateWorkspace.js +5 -5
  12. package/dist/pageobjects/dashboard/CreateWorkspace.js.map +1 -1
  13. package/dist/pageobjects/dashboard/Dashboard.js.map +1 -1
  14. package/dist/specs/MochaHooks.js.map +1 -1
  15. package/dist/specs/SmokeTest.spec.js +49 -0
  16. package/dist/specs/SmokeTest.spec.js.map +1 -0
  17. package/dist/specs/miscellaneous/PredefinedNamespace.spec.js +1 -1
  18. package/dist/specs/miscellaneous/PredefinedNamespace.spec.js.map +1 -1
  19. package/dist/tests-library/WorkspaceHandlingTests.js +12 -0
  20. package/dist/tests-library/WorkspaceHandlingTests.js.map +1 -1
  21. package/dist/utils/CheReporter.js +5 -2
  22. package/dist/utils/CheReporter.js.map +1 -1
  23. package/dist/utils/DriverHelper.js.map +1 -1
  24. package/dist/utils/Logger.js.map +1 -1
  25. package/dist/utils/ScreenCatcher.js.map +1 -1
  26. package/dist/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.js.map +1 -1
  27. package/dist/utils/vsc/GitUtil.js +1 -6
  28. package/dist/utils/vsc/GitUtil.js.map +1 -1
  29. package/dist/utils/workspace/ApiUrlResolver.js.map +1 -1
  30. package/dist/utils/workspace/TestWorkspaceUtil.js +1 -1
  31. package/dist/utils/workspace/TestWorkspaceUtil.js.map +1 -1
  32. package/driver/ChromeDriver.ts +2 -2
  33. package/package.json +1 -1
  34. package/pageobjects/dashboard/CreateWorkspace.ts +6 -6
  35. package/pageobjects/dashboard/Dashboard.ts +15 -19
  36. package/pageobjects/dashboard/Workspaces.ts +20 -20
  37. package/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts +16 -16
  38. package/pageobjects/git-providers/OauthPage.ts +12 -12
  39. package/pageobjects/ide/CheCodeLocatorLoader.ts +1 -1
  40. package/pageobjects/login/OcpUserLoginPage.ts +1 -1
  41. package/pageobjects/login/RedHatLoginPage.ts +6 -6
  42. package/pageobjects/login/RegularUserOcpCheLoginPage.ts +1 -1
  43. package/pageobjects/openshift/CheLoginPage.ts +3 -3
  44. package/pageobjects/openshift/OcpLoginPage.ts +8 -8
  45. package/specs/MochaHooks.ts +7 -7
  46. package/specs/SmokeTest.spec.ts +50 -0
  47. package/specs/devfiles/Quarkus.spec.ts +6 -6
  48. package/specs/factory/Factory.spec.ts +17 -17
  49. package/specs/factory/NoSetupRepoFactory.spec.ts +21 -21
  50. package/specs/factory/RefusedOAuthFactory.spec.ts +21 -21
  51. package/specs/miscellaneous/PredefinedNamespace.spec.ts +5 -5
  52. package/tests-library/WorkspaceHandlingTests.ts +13 -0
  53. package/tslint.json +4 -4
  54. package/utils/BrowserTabsUtil.ts +7 -7
  55. package/utils/CheReporter.ts +12 -8
  56. package/utils/DriverHelper.ts +31 -31
  57. package/utils/Logger.ts +8 -8
  58. package/utils/ScreenCatcher.ts +8 -7
  59. package/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.ts +2 -1
  60. package/utils/vsc/GitUtil.ts +1 -4
  61. package/utils/workspace/ApiUrlResolver.ts +3 -2
  62. package/utils/workspace/TestWorkspaceUtil.ts +22 -22
@@ -49,7 +49,7 @@ const webCheCodeLocators: Locators = new CheCodeLocatorLoader().webCheCodeLocato
49
49
  const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
50
50
  const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
51
51
 
52
- suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository and deny the access`, async function () {
52
+ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository and deny the access`, async function (): Promise<void> {
53
53
  const oauthPage: OauthPage = new OauthPage(driverHelper);
54
54
 
55
55
  let projectSection: ViewSection;
@@ -71,12 +71,12 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
71
71
 
72
72
  loginTests.loginIntoChe();
73
73
 
74
- test(`Navigate to the ${isPrivateRepo} repository factory URL`, async function () {
74
+ test(`Navigate to the ${isPrivateRepo} repository factory URL`, async function (): Promise<void> {
75
75
  await browserTabsUtil.navigateTo(TestConstants.TS_SELENIUM_FACTORY_URL());
76
76
  });
77
77
 
78
78
  if (TestConstants.TS_SELENIUM_GIT_PROVIDER_OAUTH) {
79
- test(`Authorize with a ${TestConstants.TS_SELENIUM_FACTORY_GIT_PROVIDER} OAuth and deny access`, async function () {
79
+ test(`Authorize with a ${TestConstants.TS_SELENIUM_FACTORY_GIT_PROVIDER} OAuth and deny access`, async function (): Promise<void> {
80
80
  await oauthPage.login();
81
81
  await oauthPage.waitOauthPage();
82
82
  await oauthPage.denyAccess();
@@ -85,24 +85,24 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
85
85
 
86
86
  workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
87
87
 
88
- test('The workspace starts with access deny flag in the url', async function () {
88
+ test('The workspace starts with access deny flag in the url', async function (): Promise<void> {
89
89
  expect(await driverHelper.getDriver().getCurrentUrl()).contains('&error_code=access_denied');
90
90
  });
91
91
 
92
- test('Registering the running workspace', async function () {
92
+ test('Registering the running workspace', async function (): Promise<void> {
93
93
  registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName());
94
94
  });
95
95
 
96
- test('Wait the workspace readiness', async function () {
96
+ test('Wait the workspace readiness', async function (): Promise<void> {
97
97
  await projectAndFileTests.waitWorkspaceReadinessForCheCodeEditor();
98
98
  });
99
99
 
100
- test('Check if a project folder has been created', async function () {
100
+ test('Check if a project folder has been created', async function (): Promise<void> {
101
101
  Logger.debug(`new SideBarView().getContent().getSection: get ${testRepoProjectName}`);
102
102
  projectSection = await new SideBarView().getContent().getSection(testRepoProjectName as unknown as string);
103
103
  });
104
104
 
105
- test('Accept the project as a trusted one', async function () {
105
+ test('Accept the project as a trusted one', async function (): Promise<void> {
106
106
  // click somewhere to trigger "Welcome Content" dialog
107
107
  try {
108
108
  await driverHelper.waitAndClick(webCheCodeLocators.Workbench.notificationItem);
@@ -126,27 +126,27 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
126
126
  });
127
127
 
128
128
  if (TestConstants.TS_SELENIUM_IS_PRIVATE_FACTORY_GIT_REPO) {
129
- test('Check that project can not be cloned', async function () {
129
+ test('Check that project can not be cloned', async function (): Promise<void> {
130
130
  await driverHelper.waitVisibility(webCheCodeLocators.Dialog.message);
131
131
  const workspaceDoesNotExistDialog: ModalDialog = new ModalDialog();
132
132
  const message: string = await workspaceDoesNotExistDialog.getMessage();
133
133
  expect(message).contains('space does not exist');
134
134
  });
135
135
 
136
- test('Check that project files were not imported', async function () {
136
+ test('Check that project files were not imported', async function (): Promise<void> {
137
137
  const isFileImported: ViewItem | undefined = await projectSection.findItem(label);
138
138
  expect(isFileImported).eqls(undefined);
139
139
  });
140
140
 
141
141
  } else {
142
- test('Check if the project files were imported', async function () {
142
+ test('Check if the project files were imported', async function (): Promise<void> {
143
143
  Logger.debug(`projectSection.findItem: find ${label}`);
144
144
  const isFileImported: ViewItem | undefined = await projectSection.findItem(label);
145
145
  // projectSection.findItem(label) can return undefined but test will goes on
146
146
  expect(isFileImported).not.eqls(undefined);
147
147
  });
148
148
 
149
- test('Make changes to the file', async function () {
149
+ test('Make changes to the file', async function (): Promise<void> {
150
150
  Logger.debug(`projectSection.openItem: "${fileToChange}"`);
151
151
  await projectSection.openItem(fileToChange);
152
152
  const editor: TextEditor = await new EditorView().openEditor(fileToChange) as TextEditor;
@@ -157,7 +157,7 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
157
157
  await editor.typeTextAt(1, 1, changesToCommit);
158
158
  });
159
159
 
160
- test('Open a source control manager', async function () {
160
+ test('Open a source control manager', async function (): Promise<void> {
161
161
  const viewSourceControl: string = `Source Control`;
162
162
  const sourceControl: ViewControl = await new ActivityBar().getViewControl(viewSourceControl) as ViewControl;
163
163
  Logger.debug(`sourceControl.openView: "${viewSourceControl}"`);
@@ -168,7 +168,7 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
168
168
  Logger.debug(`scmView.getProviders: "${scmProvider}, ${scmProvider}"`);
169
169
  });
170
170
 
171
- test('Check if the changes is displayed in the source control manager', async function () {
171
+ test('Check if the changes is displayed in the source control manager', async function (): Promise<void> {
172
172
  await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
173
173
  await driverHelper.wait(timeToRefresh);
174
174
  Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
@@ -180,7 +180,7 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
180
180
  expect(changes).eql(1);
181
181
  });
182
182
 
183
- test('Stage the changes', async function () {
183
+ test('Stage the changes', async function (): Promise<void> {
184
184
  await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
185
185
  Logger.debug(`scmProvider.openMoreActions`);
186
186
  scmContextMenu = await scmProvider.openMoreActions();
@@ -189,7 +189,7 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
189
189
  await scmContextMenu.select('Changes', 'Stage All Changes');
190
190
  });
191
191
 
192
- test('Commit the changes', async function () {
192
+ test('Commit the changes', async function (): Promise<void> {
193
193
  await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(commitChangesButtonLabel));
194
194
  Logger.debug(`scmProvider.commitChanges: commit name "Commit ${changesToCommit}"`);
195
195
  await scmProvider.commitChanges('Commit ' + changesToCommit);
@@ -204,7 +204,7 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
204
204
  expect(changes).eql(0);
205
205
  });
206
206
 
207
- test('Push the changes', async function () {
207
+ test('Push the changes', async function (): Promise<void> {
208
208
  await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(`Push 1 commits to origin/${TestConstants.TS_SELENIUM_FACTORY_GIT_REPO_BRANCH}`));
209
209
  await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
210
210
  Logger.debug(`scmProvider.openMoreActions`);
@@ -214,7 +214,7 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
214
214
  await scmContextMenu.select(pushItemLabel);
215
215
  });
216
216
 
217
- test('Insert git credentials which were asked after push', async function () {
217
+ test('Insert git credentials which were asked after push', async function (): Promise<void> {
218
218
  await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
219
219
 
220
220
  try {
@@ -232,7 +232,7 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
232
232
  await driverHelper.wait(timeToRefresh);
233
233
  });
234
234
 
235
- test('Check if the changes were pushed', async function () {
235
+ test('Check if the changes were pushed', async function (): Promise<void> {
236
236
  try {
237
237
  Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
238
238
  await scmProvider.takeAction(refreshButtonLabel);
@@ -246,13 +246,13 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
246
246
  });
247
247
  }
248
248
 
249
- test(`Stop and remove the workspace`, async function () {
249
+ test(`Stop and remove the workspace`, async function (): Promise<void> {
250
250
  await workspaceHandlingTests.stopAndRemoveWorkspace(WorkspaceHandlingTests.getWorkspaceName());
251
251
  });
252
252
 
253
253
  loginTests.logoutFromChe();
254
254
 
255
- suiteTeardown('Close the browser', async function () {
255
+ suiteTeardown('Close the browser', async function (): Promise<void> {
256
256
  if (!TestConstants.TS_DEBUG_MODE) {
257
257
  await driverHelper.getDriver().close();
258
258
  }
@@ -1,10 +1,10 @@
1
1
  import { e2eContainer } from '../../configs/inversify.config';
2
2
  import { assert } from 'chai';
3
- import { registerRunningWorkspace } from '../MochaHooks';
4
3
  import { CLASSES } from '../../configs/inversify.types';
5
4
  import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTests';
6
5
  import { Logger } from '../../utils/Logger';
7
6
  import { LoginTests } from '../../tests-library/LoginTests';
7
+ import { registerRunningWorkspace } from '../MochaHooks';
8
8
 
9
9
  const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
10
10
  const util: any = require('node:util');
@@ -19,7 +19,7 @@ async function runShellScript(shellCommandToExecution: string): Promise<string>
19
19
  return stdout;
20
20
  }
21
21
 
22
- suite(`Create predefined workspace and check it `, async function () {
22
+ suite(`Create predefined workspace and check it `, async function (): Promise<void> {
23
23
  let workspaceName: string = '';
24
24
 
25
25
  const setEditRightsForUser: string = `oc adm policy add-role-to-user edit user -n ${predefinedNamespaceName}`;
@@ -37,7 +37,7 @@ suite(`Create predefined workspace and check it `, async function () {
37
37
  ' che.eclipse.org/username: user\n' +
38
38
  'EOF';
39
39
  // create a predefined namespace for user using shell script and login into user dashboard
40
- suiteSetup(async function () {
40
+ suiteSetup(async function (): Promise<void> {
41
41
  Logger.info('Test prerequisites:');
42
42
  Logger.info(' (1) there is OCP user with username and user password that have been set in the TS_SELENIUM_USERNAME and TS_SELENIUM_PASSWORD variables');
43
43
  Logger.info(' (2) \'oc\' client installed and logged into test OCP cluster with admin rights.');
@@ -46,7 +46,7 @@ suite(`Create predefined workspace and check it `, async function () {
46
46
  await runShellScript(setEditRightsForUser);
47
47
  });
48
48
 
49
- suiteTeardown(async () => {
49
+ suiteTeardown(async (): Promise<void> => {
50
50
  const workspaceName: string = WorkspaceHandlingTests.getWorkspaceName();
51
51
  try {
52
52
  await runShellScript(deletePredefinedNamespace);
@@ -61,7 +61,7 @@ suite(`Create predefined workspace and check it `, async function () {
61
61
  workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
62
62
 
63
63
  // verify that just created workspace with unique name is present in the predefined namespace
64
- test('Validate the created workspace is present in predefined namespace', async function () {
64
+ test('Validate the created workspace is present in predefined namespace', async function (): Promise<void> {
65
65
  workspaceName = WorkspaceHandlingTests.getWorkspaceName();
66
66
  registerRunningWorkspace(workspaceName);
67
67
  const ocDevWorkspaceOutput: string = await runShellScript(getDevWorkspaceFromPredefinedNameSpace);
@@ -62,6 +62,19 @@ export class WorkspaceHandlingTests {
62
62
  });
63
63
  }
64
64
 
65
+ public createAndOpenWorkspaceFromGitRepository(factoryUrl: string): void {
66
+ test(`Create and open new workspace from factory:${factoryUrl}`, async () => {
67
+ await this.dashboard.waitPage();
68
+ Logger.debug(`Fetching user kubernetes namespace, storing auth token by getting workspaces API URL.`);
69
+ await this.apiUrlResolver.getWorkspacesApiUrl();
70
+ await this.dashboard.clickCreateWorkspaceButton();
71
+ await this.createWorkspace.waitPage();
72
+ WorkspaceHandlingTests.parentGUID = await this.browserTabsUtil.getCurrentWindowHandle();
73
+ await this.createWorkspace.importFromGitUsingUI(factoryUrl);
74
+ await this.browserTabsUtil.waitAndSwitchToAnotherWindow(WorkspaceHandlingTests.parentGUID, TimeoutConstants.TS_IDE_LOAD_TIMEOUT);
75
+ });
76
+ }
77
+
65
78
  public openExistingWorkspace(workspaceName: string): void {
66
79
  test('Open and start existing workspace', async () => {
67
80
  await this.dashboard.waitPage();
package/tslint.json CHANGED
@@ -95,11 +95,11 @@
95
95
  ],
96
96
  "typedef": [
97
97
  true,
98
- // "call-signature",
99
- // "member-variable-declaration",
98
+ "call-signature",
99
+ "member-variable-declaration",
100
100
  "parameter",
101
- "property-declaration"
102
- // "variable-declaration"
101
+ "property-declaration",
102
+ "variable-declaration"
103
103
  ],
104
104
  "typedef-whitespace": [
105
105
  true,
@@ -18,7 +18,7 @@ import { TimeoutConstants } from '../constants/TimeoutConstants';
18
18
  export class BrowserTabsUtil {
19
19
  constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { }
20
20
 
21
- async switchToWindow(windowHandle: string) {
21
+ async switchToWindow(windowHandle: string): Promise<void> {
22
22
  Logger.debug('BrowserTabsUtil.switchToWindow');
23
23
  await this.driverHelper.getDriver().switchTo().window(windowHandle);
24
24
  }
@@ -35,20 +35,20 @@ export class BrowserTabsUtil {
35
35
  return await this.driverHelper.getDriver().getWindowHandle();
36
36
  }
37
37
 
38
- async navigateTo(url: string) {
38
+ async navigateTo(url: string): Promise<void> {
39
39
  Logger.debug(`BrowserTabsUtil.navigateTo ${url}`);
40
40
 
41
41
  await this.driverHelper.getDriver().navigate().to(url);
42
42
  }
43
43
 
44
- async navigateAndWaitToUrl(url: string, timeout: number = TimeoutConstants.TS_SELENIUM_WAIT_FOR_URL) {
44
+ async navigateAndWaitToUrl(url: string, timeout: number = TimeoutConstants.TS_SELENIUM_WAIT_FOR_URL): Promise<void> {
45
45
  Logger.trace(`BrowserTabsUtil.navigateAndWaitToUrl ${url}`);
46
46
 
47
47
  await this.navigateTo(url);
48
48
  await this.waitURL(url, timeout);
49
49
  }
50
50
 
51
- async waitAndSwitchToAnotherWindow(currentWindowHandle: string, timeout: number) {
51
+ async waitAndSwitchToAnotherWindow(currentWindowHandle: string, timeout: number): Promise<void> {
52
52
  Logger.debug('BrowserTabsUtil.waitAndSwitchToAnotherWindow');
53
53
 
54
54
  await this.driverHelper.waitUntilTrue(async () => {
@@ -66,7 +66,7 @@ export class BrowserTabsUtil {
66
66
  }
67
67
  }
68
68
 
69
- async refreshPage() {
69
+ async refreshPage(): Promise<void> {
70
70
  Logger.debug('BrowserTabsUtil.refreshPage');
71
71
 
72
72
  await (await this.driverHelper.getDriver()).navigate().refresh();
@@ -76,7 +76,7 @@ export class BrowserTabsUtil {
76
76
  return await this.driverHelper.getDriver().getCurrentUrl();
77
77
  }
78
78
 
79
- async waitURL(expectedUrl: string, timeout: number) {
79
+ async waitURL(expectedUrl: string, timeout: number): Promise<void> {
80
80
  Logger.trace(`BrowserTabsUtil.waitURL ${expectedUrl}`);
81
81
 
82
82
  await this.driverHelper.getDriver().wait(async () => {
@@ -89,7 +89,7 @@ export class BrowserTabsUtil {
89
89
  }, timeout);
90
90
  }
91
91
 
92
- public async maximize() {
92
+ public async maximize(): Promise<void> {
93
93
  Logger.trace(`BrowserTabsUtil.maximize`);
94
94
 
95
95
  await this.driverHelper.getDriver().manage().window().maximize();
@@ -20,6 +20,7 @@ import { TimeoutConstants } from '../constants/TimeoutConstants';
20
20
  import { Logger } from './Logger';
21
21
  import { Sanitizer } from './Sanitizer';
22
22
  import { e2eContainer } from '../configs/inversify.config';
23
+ import { WriteStream } from 'fs';
23
24
 
24
25
  const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
25
26
  const screenCatcher: ScreenCatcher = e2eContainer.get(CLASSES.ScreenCatcher);
@@ -35,7 +36,7 @@ class CheReporter extends mocha.reporters.Spec {
35
36
  constructor(runner: mocha.Runner, options: mocha.MochaOptions) {
36
37
  super(runner, options);
37
38
 
38
- runner.on('start', async (test: mocha.Test) => {
39
+ runner.on('start', async () => {
39
40
  let launchInformation: string =
40
41
  `################## Launch Information ##################
41
42
 
@@ -56,6 +57,9 @@ class CheReporter extends mocha.reporters.Spec {
56
57
  DELETE_WORKSPACE_ON_FAILED_TEST: ${TestConstants.DELETE_WORKSPACE_ON_FAILED_TEST}
57
58
  TS_SELENIUM_LOG_LEVEL: ${TestConstants.TS_SELENIUM_LOG_LEVEL}
58
59
  TS_SELENIUM_LAUNCH_FULLSCREEN: ${TestConstants.TS_SELENIUM_LAUNCH_FULLSCREEN}
60
+
61
+ ${process.env.MOCHA_DIRECTORY ? 'MOCHA_DIRECTORY: ' + process.env.MOCHA_DIRECTORY : 'MOCHA_DRIRECTORY is not set'}
62
+ ${process.env.USERSTORY ? 'USERSTORY: ' + process.env.USERSTORY : 'USERSTORY is not set'}
59
63
  `;
60
64
 
61
65
  if (TestConstants.TS_SELENIUM_PRINT_TIMEOUT_VARIABLES) {
@@ -73,7 +77,7 @@ class CheReporter extends mocha.reporters.Spec {
73
77
  rm.sync(TestConstants.TS_SELENIUM_REPORT_FOLDER);
74
78
  });
75
79
 
76
- runner.on('test', async function (test: mocha.Test) {
80
+ runner.on('test', async function (test: mocha.Test): Promise<void> {
77
81
  if (!TestConstants.TS_SELENIUM_EXECUTION_SCREENCAST) {
78
82
  return;
79
83
  }
@@ -94,7 +98,7 @@ class CheReporter extends mocha.reporters.Spec {
94
98
  if (TestConstants.TS_LOAD_TESTS) {
95
99
  const loadTestReportFolder: string = TestConstants.TS_SELENIUM_LOAD_TEST_REPORT_FOLDER;
96
100
  const loadTestFilePath: string = loadTestReportFolder + '/load-test-results.txt';
97
- const report = test.title + ': ' + test.duration + '\r';
101
+ const report: string = test.title + ': ' + test.duration + '\r';
98
102
  if (!fs.existsSync(loadTestReportFolder)) {
99
103
  fs.mkdirSync(loadTestReportFolder);
100
104
  }
@@ -103,7 +107,7 @@ class CheReporter extends mocha.reporters.Spec {
103
107
  });
104
108
 
105
109
 
106
- runner.on('end', async function (test: mocha.Test) {
110
+ runner.on('end', async function (): Promise<void> {
107
111
  // ensure that fired events done
108
112
  await driverHelper.wait(5000);
109
113
 
@@ -116,7 +120,7 @@ class CheReporter extends mocha.reporters.Spec {
116
120
  }
117
121
  });
118
122
 
119
- runner.on('fail', async function (test: mocha.Test) {
123
+ runner.on('fail', async function (test: mocha.Test): Promise<void> {
120
124
  Logger.error(`CheReporter runner.on.fail: ${test.fullTitle()} failed after ${test.duration}ms`);
121
125
  // raise flag for keeping the screencast
122
126
  deleteScreencast = false;
@@ -150,13 +154,13 @@ class CheReporter extends mocha.reporters.Spec {
150
154
 
151
155
  // take screenshot and write to file
152
156
  const screenshot: string = await driverHelper.getDriver().takeScreenshot();
153
- const screenshotStream = fs.createWriteStream(screenshotFileName);
157
+ const screenshotStream: WriteStream = fs.createWriteStream(screenshotFileName);
154
158
  screenshotStream.write(Buffer.from(screenshot, 'base64'));
155
159
  screenshotStream.end();
156
160
 
157
161
  // take pagesource and write to file
158
162
  const pageSource: string = await driverHelper.getDriver().getPageSource();
159
- const pageSourceStream = fs.createWriteStream(pageSourceFileName);
163
+ const pageSourceStream: WriteStream = fs.createWriteStream(pageSourceFileName);
160
164
  pageSourceStream.write(Buffer.from(pageSource));
161
165
  pageSourceStream.end();
162
166
 
@@ -168,7 +172,7 @@ class CheReporter extends mocha.reporters.Spec {
168
172
  browserLogs += `\"${log.level}\" \"${log.type}\" \"${log.message}\"\n`;
169
173
  });
170
174
 
171
- const browserLogsStream = fs.createWriteStream(browserLogsFileName);
175
+ const browserLogsStream: WriteStream = fs.createWriteStream(browserLogsFileName);
172
176
  browserLogsStream.write(Buffer.from(browserLogs));
173
177
  browserLogsStream.end();
174
178
 
@@ -42,7 +42,7 @@ export class DriverHelper {
42
42
  }
43
43
  }
44
44
 
45
- public async wait(milliseconds: number) {
45
+ public async wait(milliseconds: number): Promise<void> {
46
46
  Logger.trace(`DriverHelper.wait (${milliseconds} milliseconds)`);
47
47
 
48
48
  await this.driver.sleep(milliseconds);
@@ -54,7 +54,7 @@ export class DriverHelper {
54
54
 
55
55
  Logger.trace(`DriverHelper.waitVisibilityBoolean ${locator}`);
56
56
 
57
- for (let i = 0; i < attempts; i++) {
57
+ for (let i: number = 0; i < attempts; i++) {
58
58
  const isVisible: boolean = await this.isVisible(locator);
59
59
 
60
60
  if (isVisible) {
@@ -73,7 +73,7 @@ export class DriverHelper {
73
73
 
74
74
  Logger.trace(`DriverHelper.waitDisappearanceBoolean ${locator}`);
75
75
 
76
- for (let i = 0; i < attempts; i++) {
76
+ for (let i: number = 0; i < attempts; i++) {
77
77
  const isVisible: boolean = await this.isVisible(locator);
78
78
 
79
79
  if (!isVisible) {
@@ -92,7 +92,7 @@ export class DriverHelper {
92
92
 
93
93
  Logger.trace(`DriverHelper.waitVisibility ${elementLocator}`);
94
94
 
95
- for (let i = 0; i < attempts; i++) {
95
+ for (let i: number = 0; i < attempts; i++) {
96
96
  let element: WebElement;
97
97
  try {
98
98
  element = await this.driver.wait(until.elementLocated(elementLocator), polling);
@@ -119,7 +119,7 @@ export class DriverHelper {
119
119
  }
120
120
 
121
121
  try {
122
- const visibleWebElement = await this.driver.wait(until.elementIsVisible(element), polling);
122
+ const visibleWebElement: WebElement = await this.driver.wait(until.elementIsVisible(element), polling);
123
123
  Logger.trace('DriverHelper.waitVisibility - Element is located and is visible.');
124
124
  return visibleWebElement;
125
125
  } catch (err) {
@@ -150,7 +150,7 @@ export class DriverHelper {
150
150
 
151
151
  Logger.trace(`DriverHelper.waitPresence ${elementLocator}`);
152
152
 
153
- for (let i = 0; i < attempts; i++) {
153
+ for (let i: number = 0; i < attempts; i++) {
154
154
  try {
155
155
  return await this.driver.wait(until.elementLocated(elementLocator), polling);
156
156
  } catch (err) {
@@ -178,7 +178,7 @@ export class DriverHelper {
178
178
 
179
179
  Logger.trace(`DriverHelper.waitAllPresence ${elementLocator}`);
180
180
 
181
- for (let i = 0; i < attempts; i++) {
181
+ for (let i: number = 0; i < attempts; i++) {
182
182
  try {
183
183
  return await this.driver.wait(until.elementsLocated(elementLocator), polling);
184
184
  } catch (err) {
@@ -200,7 +200,7 @@ export class DriverHelper {
200
200
  throw new error.TimeoutError(`Exceeded maximum presence checkings attempts, problems with 'StaleElementReferenceError' of '${elementLocator}' element`);
201
201
  }
202
202
 
203
- public async waitAllVisibility(locators: Array<By>, timeout: number) {
203
+ public async waitAllVisibility(locators: Array<By>, timeout: number): Promise<void> {
204
204
  Logger.trace(`DriverHelper.waitAllVisibility ${locators}`);
205
205
 
206
206
  for (const elementLocator of locators) {
@@ -210,18 +210,18 @@ export class DriverHelper {
210
210
 
211
211
  public async waitDisappearance(elementLocator: By,
212
212
  attempts: number = TestConstants.TS_SELENIUM_DEFAULT_ATTEMPTS,
213
- polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING) {
213
+ polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING): Promise<void> {
214
214
 
215
215
  Logger.trace(`DriverHelper.waitDisappearance ${elementLocator}`);
216
216
 
217
- const isDisappeared = await this.waitDisappearanceBoolean(elementLocator, attempts, polling);
217
+ const isDisappeared: boolean = await this.waitDisappearanceBoolean(elementLocator, attempts, polling);
218
218
 
219
219
  if (!isDisappeared) {
220
220
  throw new error.TimeoutError(`Waiting attempts exceeded, element '${elementLocator}' is still visible`);
221
221
  }
222
222
  }
223
223
 
224
- public async waitDisappearanceWithTimeout(elementLocator: By, timeout: number) {
224
+ public async waitDisappearanceWithTimeout(elementLocator: By, timeout: number): Promise<void> {
225
225
  Logger.trace(`DriverHelper.waitDisappearanceWithTimeout ${elementLocator}`);
226
226
 
227
227
  await this.getDriver().wait(async () => {
@@ -235,7 +235,7 @@ export class DriverHelper {
235
235
 
236
236
  public async waitAllDisappearance(locators: Array<By>,
237
237
  attemptsPerLocator: number = TestConstants.TS_SELENIUM_DEFAULT_ATTEMPTS,
238
- pollingPerLocator: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING) {
238
+ pollingPerLocator: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING): Promise<void> {
239
239
 
240
240
  Logger.trace(`DriverHelper.waitAllDisappearance ${locators}`);
241
241
 
@@ -244,13 +244,13 @@ export class DriverHelper {
244
244
  }
245
245
  }
246
246
 
247
- public async waitAndClick(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
247
+ public async waitAndClick(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
248
248
  const polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING;
249
249
  const attempts: number = Math.ceil(timeout / polling);
250
250
 
251
251
  Logger.trace(`DriverHelper.waitAndClick ${elementLocator}`);
252
252
 
253
- for (let i = 0; i < attempts; i++) {
253
+ for (let i: number = 0; i < attempts; i++) {
254
254
  let element: WebElement;
255
255
  try {
256
256
  element = await this.waitVisibility(elementLocator, polling);
@@ -294,7 +294,7 @@ export class DriverHelper {
294
294
 
295
295
  Logger.trace(`DriverHelper.waitAndGetElementAttribute ${elementLocator} attribute: '${attribute}'`);
296
296
 
297
- for (let i = 0; i < attempts; i++) {
297
+ for (let i: number = 0; i < attempts; i++) {
298
298
  let element: WebElement;
299
299
  try {
300
300
  element = await this.waitVisibility(elementLocator, polling);
@@ -336,7 +336,7 @@ export class DriverHelper {
336
336
 
337
337
  Logger.trace(`DriverHelper.waitAndGetCssValue ${elementLocator} cssAttribute: ${cssAttribute}`);
338
338
 
339
- for (let i = 0; i < attempts; i++) {
339
+ for (let i: number = 0; i < attempts; i++) {
340
340
  let element: WebElement;
341
341
  try {
342
342
  element = await this.waitVisibility(elementLocator, polling);
@@ -374,7 +374,7 @@ export class DriverHelper {
374
374
  public async waitAttributeValue(elementLocator: By,
375
375
  attribute: string,
376
376
  expectedValue: string,
377
- timeout: number) {
377
+ timeout: number): Promise<void> {
378
378
 
379
379
  Logger.trace(`DriverHelper.waitAttributeValue ${elementLocator}`);
380
380
 
@@ -387,7 +387,7 @@ export class DriverHelper {
387
387
  `The '${attribute}' attribute value doesn't match with expected value '${expectedValue}'`);
388
388
  }
389
389
 
390
- public async type(elementLocator: By, text: string, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
390
+ public async type(elementLocator: By, text: string, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
391
391
  const polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING;
392
392
  const attempts: number = Math.ceil(timeout / polling);
393
393
 
@@ -397,7 +397,7 @@ export class DriverHelper {
397
397
  Logger.trace(`DriverHelper.type ${elementLocator} text: ${text}`);
398
398
  }
399
399
 
400
- for (let i = 0; i < attempts; i++) {
400
+ for (let i: number = 0; i < attempts; i++) {
401
401
  let element: WebElement;
402
402
  try {
403
403
  element = await this.waitVisibility(elementLocator, polling);
@@ -433,13 +433,13 @@ export class DriverHelper {
433
433
  throw new error.TimeoutError(`Exceeded maximum typing attempts, to the '${elementLocator}' element`);
434
434
  }
435
435
 
436
- public async typeToInvisible(elementLocator: By, text: string, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
436
+ public async typeToInvisible(elementLocator: By, text: string, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
437
437
  const polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING;
438
438
  const attempts: number = Math.ceil(timeout / polling);
439
439
 
440
440
  Logger.trace(`DriverHelper.typeToInvisible ${elementLocator} text: ${text}`);
441
441
 
442
- for (let i = 0; i < attempts; i++) {
442
+ for (let i: number = 0; i < attempts; i++) {
443
443
  let element: WebElement;
444
444
  try {
445
445
  element = await this.waitPresence(elementLocator, polling);
@@ -475,13 +475,13 @@ export class DriverHelper {
475
475
  throw new error.TimeoutError(`Exceeded maximum typing attempts, to the '${elementLocator}' element`);
476
476
  }
477
477
 
478
- public async clear(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
478
+ public async clear(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
479
479
  const polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING;
480
480
  const attempts: number = Math.ceil(timeout / polling);
481
481
 
482
482
  Logger.trace(`DriverHelper.clear ${elementLocator}`);
483
483
 
484
- for (let i = 0; i < attempts; i++) {
484
+ for (let i: number = 0; i < attempts; i++) {
485
485
  let element: WebElement;
486
486
  try {
487
487
  element = await this.waitVisibility(elementLocator, polling);
@@ -517,13 +517,13 @@ export class DriverHelper {
517
517
  throw new error.TimeoutError(`Exceeded maximum clearing attempts, to the '${elementLocator}' element`);
518
518
  }
519
519
 
520
- public async clearInvisible(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
520
+ public async clearInvisible(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
521
521
  const polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING;
522
522
  const attempts: number = Math.ceil(timeout / polling);
523
523
 
524
524
  Logger.trace(`DriverHelper.clearInvisible ${elementLocator}`);
525
525
 
526
- for (let i = 0; i < attempts; i++) {
526
+ for (let i: number = 0; i < attempts; i++) {
527
527
  let element: WebElement;
528
528
  try {
529
529
  element = await this.waitPresence(elementLocator, polling);
@@ -559,7 +559,7 @@ export class DriverHelper {
559
559
  throw new error.TimeoutError(`Exceeded maximum clearing attempts, to the '${elementLocator}' element`);
560
560
  }
561
561
 
562
- public async enterValue(elementLocator: By, text: string, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
562
+ public async enterValue(elementLocator: By, text: string, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
563
563
  if (elementLocator.toString().toLocaleLowerCase().includes('password')) {
564
564
  Logger.trace(`DriverHelper.enterValue ${elementLocator} text: ***`);
565
565
  } else {
@@ -573,7 +573,7 @@ export class DriverHelper {
573
573
  await this.waitAttributeValue(elementLocator, 'value', text, timeout);
574
574
  }
575
575
 
576
- public async waitAndSwitchToFrame(iframeLocator: By, timeout: number) {
576
+ public async waitAndSwitchToFrame(iframeLocator: By, timeout: number): Promise<void> {
577
577
  Logger.trace(`DriverHelper.waitAndSwitchToFrame ${iframeLocator}`);
578
578
 
579
579
  await this.driver.wait(until.ableToSwitchToFrame(iframeLocator), timeout);
@@ -585,7 +585,7 @@ export class DriverHelper {
585
585
 
586
586
  Logger.trace(`DriverHelper.waitAndGetText ${elementLocator}`);
587
587
 
588
- for (let i = 0; i < attempts; i++) {
588
+ for (let i: number = 0; i < attempts; i++) {
589
589
  let element: WebElement;
590
590
  try {
591
591
  element = await this.waitVisibility(elementLocator, polling);
@@ -626,19 +626,19 @@ export class DriverHelper {
626
626
  return await this.waitAndGetElementAttribute(elementLocator, 'value', timeout);
627
627
  }
628
628
 
629
- public async waitUntilTrue(callback: any, timeout: number) {
629
+ public async waitUntilTrue(callback: any, timeout: number): Promise<void> {
630
630
  Logger.trace('DriverHelper.waitUntilTrue');
631
631
 
632
632
  await this.driver.wait(callback, timeout);
633
633
  }
634
634
 
635
- public async scrollTo(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM) {
635
+ public async scrollTo(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
636
636
  const polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING;
637
637
  const attempts: number = Math.ceil(timeout / polling);
638
638
 
639
639
  Logger.trace(`DriverHelper.scrollTo ${elementLocator}`);
640
640
 
641
- for (let i = 0; i < attempts; i++) {
641
+ for (let i: number = 0; i < attempts; i++) {
642
642
  let element: WebElement;
643
643
  try {
644
644
  element = await this.waitPresence(elementLocator, polling);