@eclipse-che/che-e2e 7.67.0 → 7.67.1-dev-e49f025
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/README.md +13 -4
- package/build/dockerfiles/Dockerfile +1 -1
- package/configs/inversify.config.ts +20 -17
- package/configs/inversify.types.ts +3 -3
- package/configs/mocharc.ts +14 -4
- package/configs/sh-scripts/generateIndex.sh +2 -3
- package/constants/APITestConstants.ts +56 -0
- package/constants/BaseTestConstants.ts +65 -0
- package/constants/ChromeDriverConstants.ts +46 -0
- package/constants/FactoryTestConstants.ts +45 -0
- package/constants/MonacoConstants.ts +22 -0
- package/constants/OAuthConstants.ts +56 -0
- package/constants/PluginsTestConstants.ts +15 -0
- package/constants/ReporterConstants.ts +45 -0
- package/constants/TimeoutConstants.ts +28 -146
- package/dist/configs/inversify.config.js +17 -13
- package/dist/configs/inversify.config.js.map +1 -1
- package/dist/configs/inversify.types.js +3 -2
- package/dist/configs/inversify.types.js.map +1 -1
- package/dist/configs/mocharc.js +13 -4
- package/dist/configs/mocharc.js.map +1 -1
- package/dist/constants/APITestConstants.js +54 -0
- package/dist/constants/APITestConstants.js.map +1 -0
- package/dist/constants/BaseTestConstants.js +61 -0
- package/dist/constants/BaseTestConstants.js.map +1 -0
- package/dist/constants/ChromeDriverConstants.js +44 -0
- package/dist/constants/ChromeDriverConstants.js.map +1 -0
- package/dist/constants/FactoryTestConstants.js +44 -0
- package/dist/constants/FactoryTestConstants.js.map +1 -0
- package/dist/constants/MonacoConstants.js +25 -0
- package/dist/constants/MonacoConstants.js.map +1 -0
- package/dist/constants/OAuthConstants.js +52 -0
- package/dist/constants/OAuthConstants.js.map +1 -0
- package/dist/constants/PluginsTestConstants.js +19 -0
- package/dist/constants/PluginsTestConstants.js.map +1 -0
- package/dist/constants/ReporterConstants.js +43 -0
- package/dist/constants/ReporterConstants.js.map +1 -0
- package/dist/constants/TimeoutConstants.js +22 -113
- package/dist/constants/TimeoutConstants.js.map +1 -1
- package/dist/driver/ChromeDriver.js +7 -7
- package/dist/driver/ChromeDriver.js.map +1 -1
- package/dist/index.js +22 -12
- package/dist/index.js.map +1 -1
- package/dist/pageobjects/dashboard/CreateWorkspace.js +2 -2
- package/dist/pageobjects/dashboard/CreateWorkspace.js.map +1 -1
- package/dist/pageobjects/dashboard/Dashboard.js +7 -6
- package/dist/pageobjects/dashboard/Dashboard.js.map +1 -1
- package/dist/pageobjects/dashboard/Workspaces.js +3 -4
- package/dist/pageobjects/dashboard/Workspaces.js.map +1 -1
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js +2 -3
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js.map +1 -1
- package/dist/pageobjects/git-providers/OauthPage.js +12 -19
- package/dist/pageobjects/git-providers/OauthPage.js.map +1 -1
- package/dist/pageobjects/ide/CheCodeLocatorLoader.js +2 -2
- package/dist/pageobjects/ide/CheCodeLocatorLoader.js.map +1 -1
- package/dist/pageobjects/login/interfaces/ICheLoginPage.js.map +1 -0
- package/dist/pageobjects/login/interfaces/IOcpLoginPage.js.map +1 -0
- package/dist/pageobjects/login/kubernetes/DexLoginPage.js +68 -0
- package/dist/pageobjects/login/kubernetes/DexLoginPage.js.map +1 -0
- package/dist/pageobjects/{openshift/CheLoginPage.js → login/kubernetes/KubernetesLoginPage.js} +21 -26
- package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js.map +1 -0
- package/dist/pageobjects/{openshift → login/openshift}/OcpLoginPage.js +7 -7
- package/dist/pageobjects/login/openshift/OcpLoginPage.js.map +1 -0
- package/dist/pageobjects/login/{OcpRedHatLoginPage.js → openshift/OcpRedHatLoginPage.js} +5 -5
- package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js.map +1 -0
- package/dist/pageobjects/login/{OcpUserLoginPage.js → openshift/OcpUserLoginPage.js} +7 -7
- package/dist/pageobjects/login/openshift/OcpUserLoginPage.js.map +1 -0
- package/dist/pageobjects/login/{RedHatLoginPage.js → openshift/RedHatLoginPage.js} +6 -6
- package/dist/pageobjects/login/openshift/RedHatLoginPage.js.map +1 -0
- package/dist/pageobjects/login/{RegularUserOcpCheLoginPage.js → openshift/RegularUserOcpCheLoginPage.js} +8 -8
- package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js.map +1 -0
- package/dist/specs/MochaHooks.js +18 -11
- package/dist/specs/MochaHooks.js.map +1 -1
- package/dist/specs/SmokeTest.spec.js +5 -2
- package/dist/specs/SmokeTest.spec.js.map +1 -1
- package/dist/specs/api/ContainerOverridesAPI.spec.js +5 -4
- package/dist/specs/api/ContainerOverridesAPI.spec.js.map +1 -1
- package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js +93 -0
- package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js.map +1 -0
- package/dist/specs/api/EmptyWorkspaceAPI.spec.js +62 -0
- package/dist/specs/api/EmptyWorkspaceAPI.spec.js.map +1 -0
- package/dist/specs/api/PodOverridesAPI.spec.js +5 -4
- package/dist/specs/api/PodOverridesAPI.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js +7 -2
- package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/RecomendedExtentions.spec.js +7 -6
- package/dist/specs/dashboard-samples/RecomendedExtentions.spec.js.map +1 -1
- package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js +4 -4
- package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js.map +1 -1
- package/dist/specs/factory/Factory.spec.js +20 -18
- package/dist/specs/factory/Factory.spec.js.map +1 -1
- package/dist/specs/factory/NoSetupRepoFactory.spec.js +28 -28
- package/dist/specs/factory/NoSetupRepoFactory.spec.js.map +1 -1
- package/dist/specs/factory/RefusedOAuthFactory.spec.js +28 -26
- package/dist/specs/factory/RefusedOAuthFactory.spec.js.map +1 -1
- package/dist/tests-library/LoginTests.js +4 -4
- package/dist/tests-library/LoginTests.js.map +1 -1
- package/dist/tests-library/ProjectAndFileTests.js.map +1 -1
- package/dist/tests-library/WorkspaceHandlingTests.js +1 -2
- package/dist/tests-library/WorkspaceHandlingTests.js.map +1 -1
- package/dist/utils/BrowserTabsUtil.js +2 -2
- package/dist/utils/BrowserTabsUtil.js.map +1 -1
- package/dist/utils/CheReporter.js +33 -36
- package/dist/utils/CheReporter.js.map +1 -1
- package/dist/utils/DevWorkspaceConfigurationHelper.js +72 -0
- package/dist/utils/DevWorkspaceConfigurationHelper.js.map +1 -0
- package/dist/utils/DevfilesRegistryHelper.js +82 -0
- package/dist/utils/DevfilesRegistryHelper.js.map +1 -0
- package/dist/utils/DriverHelper.js +20 -17
- package/dist/utils/DriverHelper.js.map +1 -1
- package/dist/utils/KubernetesCommandLineToolsExecutor.js +42 -29
- package/dist/utils/KubernetesCommandLineToolsExecutor.js.map +1 -1
- package/dist/utils/Logger.js +11 -11
- package/dist/utils/Logger.js.map +1 -1
- package/dist/utils/ScreenCatcher.js +9 -12
- package/dist/utils/ScreenCatcher.js.map +1 -1
- package/dist/utils/ShellExecutor.js +5 -2
- package/dist/utils/ShellExecutor.js.map +1 -1
- package/dist/utils/{vsc/GitUtil.js → StringUtil.js} +26 -8
- package/dist/utils/StringUtil.js.map +1 -0
- package/dist/utils/request-handlers/CheApiRequestHandler.js +2 -2
- package/dist/utils/request-handlers/CheApiRequestHandler.js.map +1 -1
- package/dist/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.js +4 -2
- package/dist/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.js.map +1 -1
- package/dist/utils/workspace/ApiUrlResolver.js.map +1 -1
- package/dist/utils/workspace/TestWorkspaceUtil.js +9 -7
- package/dist/utils/workspace/TestWorkspaceUtil.js.map +1 -1
- package/driver/ChromeDriver.ts +7 -7
- package/index.ts +22 -12
- package/package.json +4 -2
- package/pageobjects/dashboard/CreateWorkspace.ts +2 -2
- package/pageobjects/dashboard/Dashboard.ts +7 -6
- package/pageobjects/dashboard/Workspaces.ts +3 -4
- package/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts +2 -3
- package/pageobjects/git-providers/OauthPage.ts +8 -16
- package/pageobjects/ide/CheCodeLocatorLoader.ts +2 -2
- package/pageobjects/login/kubernetes/DexLoginPage.ts +58 -0
- package/pageobjects/login/kubernetes/KubernetesLoginPage.ts +33 -0
- package/pageobjects/{openshift → login/openshift}/OcpLoginPage.ts +7 -7
- package/pageobjects/login/{OcpRedHatLoginPage.ts → openshift/OcpRedHatLoginPage.ts} +6 -6
- package/pageobjects/login/{OcpUserLoginPage.ts → openshift/OcpUserLoginPage.ts} +8 -8
- package/pageobjects/login/{RedHatLoginPage.ts → openshift/RedHatLoginPage.ts} +6 -6
- package/pageobjects/login/{RegularUserOcpCheLoginPage.ts → openshift/RegularUserOcpCheLoginPage.ts} +9 -9
- package/specs/MochaHooks.ts +18 -12
- package/specs/SmokeTest.spec.ts +5 -2
- package/specs/api/ContainerOverridesAPI.spec.ts +5 -4
- package/specs/api/DevfileAcceptanceTestAPI.spec.ts +106 -0
- package/specs/api/EmptyWorkspaceAPI.spec.ts +74 -0
- package/specs/api/PodOverridesAPI.spec.ts +5 -4
- package/specs/dashboard-samples/EmptyWorkspace.spec.ts +10 -2
- package/specs/dashboard-samples/RecomendedExtentions.spec.ts +8 -7
- package/specs/devconsole-intergration/DevConsoleIntegration.spec.ts +4 -4
- package/specs/factory/Factory.spec.ts +21 -19
- package/specs/factory/NoSetupRepoFactory.spec.ts +29 -30
- package/specs/factory/RefusedOAuthFactory.spec.ts +29 -28
- package/tests-library/LoginTests.ts +9 -9
- package/tests-library/ProjectAndFileTests.ts +1 -1
- package/tests-library/WorkspaceHandlingTests.ts +11 -12
- package/utils/BrowserTabsUtil.ts +2 -2
- package/utils/CheReporter.ts +35 -42
- package/utils/DevWorkspaceConfigurationHelper.ts +83 -0
- package/utils/DevfilesRegistryHelper.ts +77 -0
- package/utils/DriverHelper.ts +54 -50
- package/utils/KubernetesCommandLineToolsExecutor.ts +43 -28
- package/utils/Logger.ts +16 -17
- package/utils/ScreenCatcher.ts +8 -9
- package/utils/ShellExecutor.ts +6 -2
- package/utils/StringUtil.ts +46 -0
- package/utils/request-handlers/CheApiRequestHandler.ts +4 -4
- package/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.ts +4 -2
- package/utils/workspace/ApiUrlResolver.ts +2 -2
- package/utils/workspace/TestWorkspaceUtil.ts +16 -14
- package/constants/TestConstants.ts +0 -247
- package/dist/constants/TestConstants.js +0 -198
- package/dist/constants/TestConstants.js.map +0 -1
- package/dist/pageobjects/login/ICheLoginPage.js.map +0 -1
- package/dist/pageobjects/login/IOcpLoginPage.js.map +0 -1
- package/dist/pageobjects/login/OcpRedHatLoginPage.js.map +0 -1
- package/dist/pageobjects/login/OcpUserLoginPage.js.map +0 -1
- package/dist/pageobjects/login/RedHatLoginPage.js.map +0 -1
- package/dist/pageobjects/login/RegularUserOcpCheLoginPage.js.map +0 -1
- package/dist/pageobjects/openshift/CheLoginPage.js.map +0 -1
- package/dist/pageobjects/openshift/OcpLoginPage.js.map +0 -1
- package/dist/specs/api/CloneGitRepoAPI.spec.js +0 -60
- package/dist/specs/api/CloneGitRepoAPI.spec.js.map +0 -1
- package/dist/utils/Sanitizer.js +0 -29
- package/dist/utils/Sanitizer.js.map +0 -1
- package/dist/utils/vsc/GitUtil.js.map +0 -1
- package/pageobjects/openshift/CheLoginPage.ts +0 -42
- package/specs/api/CloneGitRepoAPI.spec.ts +0 -72
- package/utils/Sanitizer.ts +0 -19
- package/utils/vsc/GitUtil.ts +0 -25
- /package/dist/pageobjects/login/{ICheLoginPage.js → interfaces/ICheLoginPage.js} +0 -0
- /package/dist/pageobjects/login/{IOcpLoginPage.js → interfaces/IOcpLoginPage.js} +0 -0
- /package/pageobjects/login/{ICheLoginPage.ts → interfaces/ICheLoginPage.ts} +0 -0
- /package/pageobjects/login/{IOcpLoginPage.ts → interfaces/IOcpLoginPage.ts} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
ViewSection
|
|
28
28
|
} from 'monaco-page-objects';
|
|
29
29
|
import { expect } from 'chai';
|
|
30
|
-
import {
|
|
30
|
+
import { StringUtil } from '../../utils/StringUtil';
|
|
31
31
|
import { CheCodeLocatorLoader } from '../../pageobjects/ide/CheCodeLocatorLoader';
|
|
32
32
|
import WebDriverError = error.WebDriverError;
|
|
33
33
|
import { registerRunningWorkspace } from '../MochaHooks';
|
|
@@ -38,10 +38,12 @@ import { ProjectAndFileTests } from '../../tests-library/ProjectAndFileTests';
|
|
|
38
38
|
import { DriverHelper } from '../../utils/DriverHelper';
|
|
39
39
|
import { Dashboard } from '../../pageobjects/dashboard/Dashboard';
|
|
40
40
|
import { Workspaces } from '../../pageobjects/dashboard/Workspaces';
|
|
41
|
-
import { GitProviderType, TestConstants } from '../../constants/TestConstants';
|
|
42
41
|
import { TimeoutConstants } from '../../constants/TimeoutConstants';
|
|
43
42
|
import { Logger } from '../../utils/Logger';
|
|
44
43
|
import { LoginTests } from '../../tests-library/LoginTests';
|
|
44
|
+
import { FactoryTestConstants, GitProviderType } from '../../constants/FactoryTestConstants';
|
|
45
|
+
import { OAuthConstants } from '../../constants/OAuthConstants';
|
|
46
|
+
import { BaseTestConstants } from '../../constants/BaseTestConstants';
|
|
45
47
|
|
|
46
48
|
const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
|
|
47
49
|
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
|
|
@@ -52,7 +54,7 @@ const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard);
|
|
|
52
54
|
const workspaces: Workspaces = e2eContainer.get(CLASSES.Workspaces);
|
|
53
55
|
const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
|
|
54
56
|
|
|
55
|
-
suite(`Create a workspace via launching a factory from the ${
|
|
57
|
+
suite(`Create a workspace via launching a factory from the ${FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository without OAuth setup`, async function (): Promise<void> {
|
|
56
58
|
|
|
57
59
|
let projectSection: ViewSection;
|
|
58
60
|
let scmProvider: SingleScmProvider;
|
|
@@ -65,11 +67,11 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
|
|
|
65
67
|
const changesToCommit: string = (new Date()).getTime().toString();
|
|
66
68
|
const fileToChange: string = 'Date.txt';
|
|
67
69
|
const pushItemLabel: string = 'Push';
|
|
68
|
-
const commitChangesButtonLabel: string = `Commit Changes on "${
|
|
70
|
+
const commitChangesButtonLabel: string = `Commit Changes on "${FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_REPO_BRANCH}"`;
|
|
69
71
|
const refreshButtonLabel: string = 'Refresh';
|
|
70
|
-
const label: string =
|
|
71
|
-
|
|
72
|
-
const isPrivateRepo: string =
|
|
72
|
+
const label: string = BaseTestConstants.TS_SELENIUM_PROJECT_ROOT_FILE_NAME;
|
|
73
|
+
let testRepoProjectName: string;
|
|
74
|
+
const isPrivateRepo: string = FactoryTestConstants.TS_SELENIUM_IS_PRIVATE_FACTORY_GIT_REPO ? 'private' : 'public';
|
|
73
75
|
|
|
74
76
|
loginTests.loginIntoChe();
|
|
75
77
|
|
|
@@ -80,16 +82,15 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
|
|
|
80
82
|
});
|
|
81
83
|
|
|
82
84
|
test(`Navigate to the ${isPrivateRepo} repository factory URL`, async function (): Promise<void> {
|
|
83
|
-
await browserTabsUtil.navigateTo(
|
|
85
|
+
await browserTabsUtil.navigateTo(FactoryTestConstants.TS_SELENIUM_FACTORY_URL());
|
|
84
86
|
});
|
|
85
87
|
|
|
86
|
-
if (
|
|
88
|
+
if (FactoryTestConstants.TS_SELENIUM_IS_PRIVATE_FACTORY_GIT_REPO) {
|
|
87
89
|
|
|
88
90
|
test(`Check that workspace cannot be created without OAuth for ${isPrivateRepo} repo`, async function (): Promise<void> {
|
|
89
91
|
await dashboard.waitLoader();
|
|
90
92
|
const loaderAlert: string = await dashboard.getLoaderAlert();
|
|
91
|
-
expect(loaderAlert).contains('
|
|
92
|
-
.and.contains('Cause: Unsupported OAuth provider ');
|
|
93
|
+
expect(loaderAlert).contains.oneOf(['Cause: Unsupported OAuth provider', 'Cause: No PersonalAccessTokenFetcher configured']);
|
|
93
94
|
});
|
|
94
95
|
|
|
95
96
|
test(`Check that workspace was not created`, async function (): Promise<void> {
|
|
@@ -114,6 +115,7 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
|
|
|
114
115
|
});
|
|
115
116
|
|
|
116
117
|
test('Check if a project folder has been created', async function (): Promise<void> {
|
|
118
|
+
testRepoProjectName = StringUtil.getProjectNameFromGitUrl(FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_REPO_URL);
|
|
117
119
|
Logger.debug(`new SideBarView().getContent().getSection: get ${testRepoProjectName}`);
|
|
118
120
|
projectSection = await new SideBarView().getContent().getSection(testRepoProjectName);
|
|
119
121
|
});
|
|
@@ -135,7 +137,7 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
|
|
|
135
137
|
await driverHelper.waitDisappearance(webCheCodeLocators.WelcomeContent.text);
|
|
136
138
|
} catch (e) {
|
|
137
139
|
Logger.info(`"Accept the project as a trusted one" dialog was not shown firstly for "${isPrivateRepo}"`);
|
|
138
|
-
if (!
|
|
140
|
+
if (!FactoryTestConstants.TS_SELENIUM_IS_PRIVATE_FACTORY_GIT_REPO) {
|
|
139
141
|
throw new WebDriverError(e as string);
|
|
140
142
|
}
|
|
141
143
|
}
|
|
@@ -170,7 +172,7 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
|
|
|
170
172
|
Logger.debug(`scmView.getProviders: "${scmProvider}, ${scmProvider}"`);
|
|
171
173
|
});
|
|
172
174
|
|
|
173
|
-
test('Check if the changes
|
|
175
|
+
test('Check if the changes are displayed in the source control manager', async function (): Promise<void> {
|
|
174
176
|
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
175
177
|
await driverHelper.wait(timeToRefresh);
|
|
176
178
|
Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
|
|
@@ -207,7 +209,7 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
|
|
|
207
209
|
});
|
|
208
210
|
|
|
209
211
|
test('Push the changes', async function (): Promise<void> {
|
|
210
|
-
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(`Push 1 commits to origin/${
|
|
212
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(`Push 1 commits to origin/${FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_REPO_BRANCH}`));
|
|
211
213
|
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
212
214
|
Logger.debug(`scmProvider.openMoreActions`);
|
|
213
215
|
scmContextMenu = await scmProvider.openMoreActions();
|
|
@@ -216,7 +218,7 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
|
|
|
216
218
|
await scmContextMenu.select(pushItemLabel);
|
|
217
219
|
});
|
|
218
220
|
|
|
219
|
-
if (
|
|
221
|
+
if (FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_PROVIDER === GitProviderType.GITHUB) {
|
|
220
222
|
test('Decline GitHub Extension', async function (): Promise<void> {
|
|
221
223
|
await driverHelper.waitVisibility(webCheCodeLocators.Dialog.details);
|
|
222
224
|
const gitHaExtensionDialog: ModalDialog = new ModalDialog();
|
|
@@ -225,20 +227,18 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
|
|
|
225
227
|
}
|
|
226
228
|
|
|
227
229
|
test('Insert git credentials which were asked after push', async function (): Promise<void> {
|
|
228
|
-
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
229
|
-
|
|
230
230
|
try {
|
|
231
|
-
await driverHelper.waitVisibility(webCheCodeLocators.
|
|
231
|
+
await driverHelper.waitVisibility(webCheCodeLocators.InputBox.message);
|
|
232
232
|
} catch (e) {
|
|
233
233
|
Logger.info(`Workspace did not ask credentials before push - ${e};
|
|
234
|
-
Known issue for github.com - https://issues.redhat.com/browse/CRW-4066`);
|
|
234
|
+
Known issue for github.com - https://issues.redhat.com/browse/CRW-4066, please check if not other git provider. `);
|
|
235
|
+
expect(FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_PROVIDER).eqls(GitProviderType.GITHUB);
|
|
235
236
|
}
|
|
236
237
|
const input: InputBox = new InputBox();
|
|
237
|
-
await input.setText(
|
|
238
|
-
await driverHelper.wait(timeToRefresh);
|
|
238
|
+
await input.setText(OAuthConstants.TS_SELENIUM_GIT_PROVIDER_USERNAME);
|
|
239
239
|
await input.confirm();
|
|
240
240
|
await driverHelper.wait(timeToRefresh);
|
|
241
|
-
await input.setText(
|
|
241
|
+
await input.setText(OAuthConstants.TS_SELENIUM_GIT_PROVIDER_PASSWORD);
|
|
242
242
|
await input.confirm();
|
|
243
243
|
await driverHelper.wait(timeToRefresh);
|
|
244
244
|
});
|
|
@@ -256,16 +256,15 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
|
|
|
256
256
|
expect(isCommitButtonDisabled).eql('true');
|
|
257
257
|
});
|
|
258
258
|
|
|
259
|
-
test(
|
|
260
|
-
await workspaceHandlingTests.
|
|
259
|
+
test('Stop the workspace', async function (): Promise<void> {
|
|
260
|
+
await workspaceHandlingTests.stopWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
261
|
+
await browserTabsUtil.closeAllTabsExceptCurrent();
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
test('Delete the workspace', async function (): Promise<void> {
|
|
265
|
+
await workspaceHandlingTests.removeWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
261
266
|
});
|
|
262
267
|
|
|
263
268
|
loginTests.logoutFromChe();
|
|
264
269
|
}
|
|
265
|
-
|
|
266
|
-
suiteTeardown('Close the browser', async function (): Promise<void> {
|
|
267
|
-
if (!TestConstants.TS_DEBUG_MODE) {
|
|
268
|
-
await driverHelper.getDriver().close();
|
|
269
|
-
}
|
|
270
|
-
});
|
|
271
270
|
});
|
|
@@ -35,12 +35,14 @@ import { WorkspaceHandlingTests } from '../../tests-library/WorkspaceHandlingTes
|
|
|
35
35
|
import { CheCodeLocatorLoader } from '../../pageobjects/ide/CheCodeLocatorLoader';
|
|
36
36
|
import { ProjectAndFileTests } from '../../tests-library/ProjectAndFileTests';
|
|
37
37
|
import { DriverHelper } from '../../utils/DriverHelper';
|
|
38
|
-
import { TestConstants } from '../../constants/TestConstants';
|
|
39
38
|
import { OauthPage } from '../../pageobjects/git-providers/OauthPage';
|
|
40
|
-
import {
|
|
39
|
+
import { StringUtil } from '../../utils/StringUtil';
|
|
41
40
|
import { Logger } from '../../utils/Logger';
|
|
42
41
|
import { TimeoutConstants } from '../../constants/TimeoutConstants';
|
|
43
42
|
import { LoginTests } from '../../tests-library/LoginTests';
|
|
43
|
+
import { OAuthConstants } from '../../constants/OAuthConstants';
|
|
44
|
+
import { BaseTestConstants } from '../../constants/BaseTestConstants';
|
|
45
|
+
import { FactoryTestConstants, GitProviderType } from '../../constants/FactoryTestConstants';
|
|
44
46
|
|
|
45
47
|
const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
|
|
46
48
|
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
|
|
@@ -49,7 +51,7 @@ const webCheCodeLocators: Locators = new CheCodeLocatorLoader().webCheCodeLocato
|
|
|
49
51
|
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
|
|
50
52
|
const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
|
|
51
53
|
|
|
52
|
-
suite(`Create a workspace via launching a factory from the ${
|
|
54
|
+
suite(`Create a workspace via launching a factory from the ${FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_PROVIDER} repository and deny the access`, async function (): Promise<void> {
|
|
53
55
|
const oauthPage: OauthPage = new OauthPage(driverHelper);
|
|
54
56
|
|
|
55
57
|
let projectSection: ViewSection;
|
|
@@ -61,21 +63,21 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
|
|
|
61
63
|
const timeToRefresh: number = 1500;
|
|
62
64
|
const changesToCommit: string = (new Date()).getTime().toString();
|
|
63
65
|
const fileToChange: string = 'Date.txt';
|
|
64
|
-
const commitChangesButtonLabel: string = `Commit Changes on "${
|
|
66
|
+
const commitChangesButtonLabel: string = `Commit Changes on "${FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_REPO_BRANCH}"`;
|
|
65
67
|
const refreshButtonLabel: string = 'Refresh';
|
|
66
68
|
const pushItemLabel: string = 'Push';
|
|
67
|
-
const label: string =
|
|
68
|
-
|
|
69
|
-
const isPrivateRepo: string =
|
|
69
|
+
const label: string = BaseTestConstants.TS_SELENIUM_PROJECT_ROOT_FILE_NAME;
|
|
70
|
+
let testRepoProjectName: string;
|
|
71
|
+
const isPrivateRepo: string = FactoryTestConstants.TS_SELENIUM_IS_PRIVATE_FACTORY_GIT_REPO ? 'private' : 'public';
|
|
70
72
|
|
|
71
73
|
loginTests.loginIntoChe();
|
|
72
74
|
|
|
73
75
|
test(`Navigate to the ${isPrivateRepo} repository factory URL`, async function (): Promise<void> {
|
|
74
|
-
await browserTabsUtil.navigateTo(
|
|
76
|
+
await browserTabsUtil.navigateTo(FactoryTestConstants.TS_SELENIUM_FACTORY_URL());
|
|
75
77
|
});
|
|
76
78
|
|
|
77
|
-
if (
|
|
78
|
-
test(`Authorize with a ${
|
|
79
|
+
if (FactoryTestConstants.TS_SELENIUM_GIT_PROVIDER_OAUTH) {
|
|
80
|
+
test(`Authorize with a ${FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_PROVIDER} OAuth and deny access`, async function (): Promise<void> {
|
|
79
81
|
await oauthPage.login();
|
|
80
82
|
await oauthPage.waitOauthPage();
|
|
81
83
|
await oauthPage.denyAccess();
|
|
@@ -97,6 +99,7 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
|
|
|
97
99
|
});
|
|
98
100
|
|
|
99
101
|
test('Check if a project folder has been created', async function (): Promise<void> {
|
|
102
|
+
testRepoProjectName = StringUtil.getProjectNameFromGitUrl(FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_REPO_URL);
|
|
100
103
|
Logger.debug(`new SideBarView().getContent().getSection: get ${testRepoProjectName}`);
|
|
101
104
|
projectSection = await new SideBarView().getContent().getSection(testRepoProjectName);
|
|
102
105
|
});
|
|
@@ -118,13 +121,13 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
|
|
|
118
121
|
await driverHelper.waitDisappearance(webCheCodeLocators.WelcomeContent.text);
|
|
119
122
|
} catch (e) {
|
|
120
123
|
Logger.info(`"Accept the project as a trusted one" dialog was not shown firstly for "${isPrivateRepo}"`);
|
|
121
|
-
if (!
|
|
124
|
+
if (!FactoryTestConstants.TS_SELENIUM_IS_PRIVATE_FACTORY_GIT_REPO) {
|
|
122
125
|
throw new WebDriverError(e as string);
|
|
123
126
|
}
|
|
124
127
|
}
|
|
125
128
|
});
|
|
126
129
|
|
|
127
|
-
if (
|
|
130
|
+
if (FactoryTestConstants.TS_SELENIUM_IS_PRIVATE_FACTORY_GIT_REPO) {
|
|
128
131
|
test('Check that project can not be cloned', async function (): Promise<void> {
|
|
129
132
|
await driverHelper.waitVisibility(webCheCodeLocators.Dialog.message);
|
|
130
133
|
const workspaceDoesNotExistDialog: ModalDialog = new ModalDialog();
|
|
@@ -167,7 +170,7 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
|
|
|
167
170
|
Logger.debug(`scmView.getProviders: "${scmProvider}, ${scmProvider}"`);
|
|
168
171
|
});
|
|
169
172
|
|
|
170
|
-
test('Check if the changes
|
|
173
|
+
test('Check if the changes are displayed in the source control manager', async function (): Promise<void> {
|
|
171
174
|
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
172
175
|
await driverHelper.wait(timeToRefresh);
|
|
173
176
|
Logger.debug(`scmProvider.takeAction: "${refreshButtonLabel}"`);
|
|
@@ -204,7 +207,7 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
|
|
|
204
207
|
});
|
|
205
208
|
|
|
206
209
|
test('Push the changes', async function (): Promise<void> {
|
|
207
|
-
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(`Push 1 commits to origin/${
|
|
210
|
+
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.actionConstructor(`Push 1 commits to origin/${FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_REPO_BRANCH}`));
|
|
208
211
|
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
209
212
|
Logger.debug(`scmProvider.openMoreActions`);
|
|
210
213
|
scmContextMenu = await scmProvider.openMoreActions();
|
|
@@ -214,19 +217,18 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
|
|
|
214
217
|
});
|
|
215
218
|
|
|
216
219
|
test('Insert git credentials which were asked after push', async function (): Promise<void> {
|
|
217
|
-
await driverHelper.waitVisibility(webCheCodeLocators.ScmView.more);
|
|
218
|
-
|
|
219
220
|
try {
|
|
220
|
-
await driverHelper.waitVisibility(webCheCodeLocators.
|
|
221
|
+
await driverHelper.waitVisibility(webCheCodeLocators.InputBox.message);
|
|
221
222
|
} catch (e) {
|
|
222
223
|
Logger.info(`Workspace did not ask credentials before push - ${e};
|
|
223
|
-
Known issue for github.com - https://issues.redhat.com/browse/CRW-4066`);
|
|
224
|
+
Known issue for github.com - https://issues.redhat.com/browse/CRW-4066, please check if not other git provider. `);
|
|
225
|
+
expect(FactoryTestConstants.TS_SELENIUM_FACTORY_GIT_PROVIDER).eqls(GitProviderType.GITHUB);
|
|
224
226
|
}
|
|
225
227
|
const input: InputBox = new InputBox();
|
|
226
|
-
await input.setText(
|
|
228
|
+
await input.setText(OAuthConstants.TS_SELENIUM_GIT_PROVIDER_USERNAME);
|
|
227
229
|
await input.confirm();
|
|
228
230
|
await driverHelper.wait(timeToRefresh);
|
|
229
|
-
await input.setText(
|
|
231
|
+
await input.setText(OAuthConstants.TS_SELENIUM_GIT_PROVIDER_PASSWORD);
|
|
230
232
|
await input.confirm();
|
|
231
233
|
await driverHelper.wait(timeToRefresh);
|
|
232
234
|
});
|
|
@@ -245,15 +247,14 @@ suite(`Create a workspace via launching a factory from the ${TestConstants.TS_SE
|
|
|
245
247
|
});
|
|
246
248
|
}
|
|
247
249
|
|
|
248
|
-
test(
|
|
249
|
-
await workspaceHandlingTests.
|
|
250
|
+
test('Stop the workspace', async function (): Promise<void> {
|
|
251
|
+
await workspaceHandlingTests.stopWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
252
|
+
await browserTabsUtil.closeAllTabsExceptCurrent();
|
|
250
253
|
});
|
|
251
254
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
suiteTeardown('Close the browser', async function (): Promise<void> {
|
|
255
|
-
if (!TestConstants.TS_DEBUG_MODE) {
|
|
256
|
-
await driverHelper.getDriver().close();
|
|
257
|
-
}
|
|
255
|
+
test('Delete the workspace', async function (): Promise<void> {
|
|
256
|
+
await workspaceHandlingTests.removeWorkspace(WorkspaceHandlingTests.getWorkspaceName());
|
|
258
257
|
});
|
|
258
|
+
|
|
259
|
+
loginTests.logoutFromChe();
|
|
259
260
|
});
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
**********************************************************************/
|
|
10
10
|
|
|
11
11
|
import { CLASSES, TYPES } from '../configs/inversify.types';
|
|
12
|
-
import { ICheLoginPage } from '../pageobjects/login/ICheLoginPage';
|
|
13
|
-
import { TestConstants } from '../constants/TestConstants';
|
|
12
|
+
import { ICheLoginPage } from '../pageobjects/login/interfaces/ICheLoginPage';
|
|
14
13
|
import { BrowserTabsUtil } from '../utils/BrowserTabsUtil';
|
|
15
14
|
import { inject, injectable } from 'inversify';
|
|
16
15
|
import { Dashboard } from '../pageobjects/dashboard/Dashboard';
|
|
17
|
-
import { IOcpLoginPage } from '../pageobjects/login/IOcpLoginPage';
|
|
16
|
+
import { IOcpLoginPage } from '../pageobjects/login/interfaces/IOcpLoginPage';
|
|
17
|
+
import { BaseTestConstants } from '../constants/BaseTestConstants';
|
|
18
18
|
|
|
19
19
|
@injectable()
|
|
20
20
|
export class LoginTests {
|
|
@@ -25,10 +25,10 @@ export class LoginTests {
|
|
|
25
25
|
@inject(CLASSES.Dashboard) private readonly dashboard: Dashboard) {
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
loginIntoChe(): void {
|
|
29
29
|
test('Login', async () => {
|
|
30
|
-
if (!(await this.browserTabsUtil.getCurrentUrl()).includes(
|
|
31
|
-
await this.browserTabsUtil.navigateTo(
|
|
30
|
+
if (!(await this.browserTabsUtil.getCurrentUrl()).includes(BaseTestConstants.TS_SELENIUM_BASE_URL)) {
|
|
31
|
+
await this.browserTabsUtil.navigateTo(BaseTestConstants.TS_SELENIUM_BASE_URL);
|
|
32
32
|
}
|
|
33
33
|
await this.productLoginPage.login();
|
|
34
34
|
await this.browserTabsUtil.maximize();
|
|
@@ -36,16 +36,16 @@ export class LoginTests {
|
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
loginIntoOcpConsole(): void {
|
|
40
40
|
test('Login into ocp console', async () => {
|
|
41
|
-
const openshiftConsoleUrl: string =
|
|
41
|
+
const openshiftConsoleUrl: string = BaseTestConstants.TS_SELENIUM_BASE_URL.replace('devspaces', 'console-openshift-console');
|
|
42
42
|
await this.browserTabsUtil.navigateTo(openshiftConsoleUrl);
|
|
43
43
|
await this.ocpLoginPage.login();
|
|
44
44
|
await this.browserTabsUtil.maximize();
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
logoutFromChe(): void {
|
|
49
49
|
test('Logout', async () => {
|
|
50
50
|
await this.dashboard.logout();
|
|
51
51
|
});
|
|
@@ -22,7 +22,7 @@ export class ProjectAndFileTests {
|
|
|
22
22
|
constructor(
|
|
23
23
|
@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) {}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
async waitWorkspaceReadinessForCheCodeEditor(): Promise<void> {
|
|
26
26
|
Logger.debug(`${this.constructor.name}.${this.waitWorkspaceReadinessForCheCodeEditor.name} - Waiting for editor.`);
|
|
27
27
|
try {
|
|
28
28
|
const start: number = new Date().getTime();
|
|
@@ -20,12 +20,11 @@ import { ApiUrlResolver } from '../utils/workspace/ApiUrlResolver';
|
|
|
20
20
|
import { TimeoutConstants } from '../constants/TimeoutConstants';
|
|
21
21
|
import { DriverHelper } from '../utils/DriverHelper';
|
|
22
22
|
import { By, error } from 'selenium-webdriver';
|
|
23
|
-
import { TestConstants } from '../constants/TestConstants';
|
|
24
23
|
|
|
25
24
|
@injectable()
|
|
26
25
|
export class WorkspaceHandlingTests {
|
|
27
26
|
|
|
28
|
-
|
|
27
|
+
static getWorkspaceName(): string {
|
|
29
28
|
return WorkspaceHandlingTests.workspaceName;
|
|
30
29
|
}
|
|
31
30
|
|
|
@@ -41,15 +40,15 @@ export class WorkspaceHandlingTests {
|
|
|
41
40
|
@inject(CLASSES.ApiUrlResolver) private readonly apiUrlResolver: ApiUrlResolver,
|
|
42
41
|
@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) {}
|
|
43
42
|
|
|
44
|
-
|
|
43
|
+
setWindowHandle(guid: string): void {
|
|
45
44
|
WorkspaceHandlingTests.parentGUID = guid;
|
|
46
45
|
}
|
|
47
46
|
|
|
48
|
-
|
|
47
|
+
getWindowHandle(): string {
|
|
49
48
|
return WorkspaceHandlingTests.parentGUID;
|
|
50
49
|
}
|
|
51
50
|
|
|
52
|
-
|
|
51
|
+
createAndOpenWorkspace(stack: string): void {
|
|
53
52
|
test(`Create and open new workspace, stack:${stack}`, async () => {
|
|
54
53
|
await this.dashboard.clickWorkspacesButton();
|
|
55
54
|
await this.dashboard.waitPage();
|
|
@@ -63,7 +62,7 @@ export class WorkspaceHandlingTests {
|
|
|
63
62
|
});
|
|
64
63
|
}
|
|
65
64
|
|
|
66
|
-
|
|
65
|
+
createAndOpenWorkspaceFromGitRepository(factoryUrl: string): void {
|
|
67
66
|
test(`Create and open new workspace from factory:${factoryUrl}`, async () => {
|
|
68
67
|
await this.dashboard.waitPage();
|
|
69
68
|
Logger.debug(`Fetching user kubernetes namespace, storing auth token by getting workspaces API URL.`);
|
|
@@ -76,7 +75,7 @@ export class WorkspaceHandlingTests {
|
|
|
76
75
|
});
|
|
77
76
|
}
|
|
78
77
|
|
|
79
|
-
|
|
78
|
+
openExistingWorkspace(workspaceName: string): void {
|
|
80
79
|
test('Open and start existing workspace', async () => {
|
|
81
80
|
await this.dashboard.waitPage();
|
|
82
81
|
Logger.debug(`Fetching user kubernetes namespace, storing auth token by getting workspaces API URL.`);
|
|
@@ -87,10 +86,10 @@ export class WorkspaceHandlingTests {
|
|
|
87
86
|
});
|
|
88
87
|
}
|
|
89
88
|
|
|
90
|
-
|
|
89
|
+
obtainWorkspaceNameFromStartingPage(): void {
|
|
91
90
|
test('Obtain workspace name from workspace loader page', async() => {
|
|
92
91
|
const timeout: number = TimeoutConstants.TS_IDE_LOAD_TIMEOUT;
|
|
93
|
-
const polling: number =
|
|
92
|
+
const polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
|
|
94
93
|
const attempts: number = Math.ceil(timeout / polling);
|
|
95
94
|
|
|
96
95
|
for (let i: number = 0; i < attempts; i++) {
|
|
@@ -125,17 +124,17 @@ export class WorkspaceHandlingTests {
|
|
|
125
124
|
});
|
|
126
125
|
}
|
|
127
126
|
|
|
128
|
-
|
|
127
|
+
async stopWorkspace(workspaceName: string): Promise<void> {
|
|
129
128
|
await this.dashboard.openDashboard();
|
|
130
129
|
await this.dashboard.stopWorkspaceByUI(workspaceName);
|
|
131
130
|
}
|
|
132
131
|
|
|
133
|
-
|
|
132
|
+
async removeWorkspace(workspaceName: string): Promise<void> {
|
|
134
133
|
await this.dashboard.openDashboard();
|
|
135
134
|
await this.dashboard.deleteStoppedWorkspaceByUI(workspaceName);
|
|
136
135
|
}
|
|
137
136
|
|
|
138
|
-
|
|
137
|
+
async stopAndRemoveWorkspace(workspaceName: string): Promise<void> {
|
|
139
138
|
await this.dashboard.openDashboard();
|
|
140
139
|
await this.dashboard.stopAndRemoveWorkspaceByUI(workspaceName);
|
|
141
140
|
}
|
package/utils/BrowserTabsUtil.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { CLASSES } from '../configs/inversify.types';
|
|
|
13
13
|
import { DriverHelper } from './DriverHelper';
|
|
14
14
|
import { Logger } from './Logger';
|
|
15
15
|
import { TimeoutConstants } from '../constants/TimeoutConstants';
|
|
16
|
-
import {
|
|
16
|
+
import { ChromeDriverConstants } from '../constants/ChromeDriverConstants';
|
|
17
17
|
|
|
18
18
|
@injectable()
|
|
19
19
|
export class BrowserTabsUtil {
|
|
@@ -92,7 +92,7 @@ export class BrowserTabsUtil {
|
|
|
92
92
|
|
|
93
93
|
async maximize(): Promise<void> {
|
|
94
94
|
Logger.trace(`BrowserTabsUtil.maximize`);
|
|
95
|
-
if (
|
|
95
|
+
if (ChromeDriverConstants.TS_SELENIUM_LAUNCH_FULLSCREEN) {
|
|
96
96
|
Logger.debug(`TS_SELENIUM_LAUNCH_FULLSCREEN is set to true, maximizing window.`);
|
|
97
97
|
await this.driverHelper.getDriver().manage().window().maximize();
|
|
98
98
|
}
|
package/utils/CheReporter.ts
CHANGED
|
@@ -8,31 +8,30 @@
|
|
|
8
8
|
* SPDX-License-Identifier: EPL-2.0
|
|
9
9
|
**********************************************************************/
|
|
10
10
|
import * as mocha from 'mocha';
|
|
11
|
-
import {
|
|
11
|
+
import { CLASSES } from '../configs/inversify.types';
|
|
12
12
|
import * as fs from 'fs';
|
|
13
13
|
import * as rm from 'rimraf';
|
|
14
|
-
import { TestConstants } from '../constants/TestConstants';
|
|
15
14
|
import { logging } from 'selenium-webdriver';
|
|
16
15
|
import { DriverHelper } from './DriverHelper';
|
|
17
16
|
import { ScreenCatcher } from './ScreenCatcher';
|
|
18
|
-
import { ITestWorkspaceUtil } from './workspace/ITestWorkspaceUtil';
|
|
19
17
|
import { TimeoutConstants } from '../constants/TimeoutConstants';
|
|
20
18
|
import { Logger } from './Logger';
|
|
21
|
-
import { Sanitizer } from './Sanitizer';
|
|
22
19
|
import { e2eContainer } from '../configs/inversify.config';
|
|
23
20
|
import { WriteStream } from 'fs';
|
|
21
|
+
import { StringUtil } from './StringUtil';
|
|
22
|
+
import { BaseTestConstants } from '../constants/BaseTestConstants';
|
|
23
|
+
import { ChromeDriverConstants } from '../constants/ChromeDriverConstants';
|
|
24
|
+
import { OAuthConstants } from '../constants/OAuthConstants';
|
|
25
|
+
import { ReporterConstants } from '../constants/ReporterConstants';
|
|
26
|
+
import { PluginsTestConstants } from '../constants/PluginsTestConstants';
|
|
24
27
|
|
|
25
28
|
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
|
|
26
29
|
const screenCatcher: ScreenCatcher = e2eContainer.get(CLASSES.ScreenCatcher);
|
|
27
|
-
const sanitizer: Sanitizer = e2eContainer.get(CLASSES.Sanitizer);
|
|
28
30
|
let methodIndex: number = 0;
|
|
29
31
|
let deleteScreencast: boolean = true;
|
|
30
|
-
let testWorkspaceUtil: ITestWorkspaceUtil = e2eContainer.get(TYPES.WorkspaceUtil);
|
|
31
32
|
|
|
32
33
|
class CheReporter extends mocha.reporters.Spec {
|
|
33
34
|
|
|
34
|
-
private static latestWorkspace: string = '';
|
|
35
|
-
|
|
36
35
|
constructor(runner: mocha.Runner, options: mocha.MochaOptions) {
|
|
37
36
|
super(runner, options);
|
|
38
37
|
|
|
@@ -40,32 +39,32 @@ class CheReporter extends mocha.reporters.Spec {
|
|
|
40
39
|
let launchInformation: string =
|
|
41
40
|
`################## Launch Information ##################
|
|
42
41
|
|
|
43
|
-
TS_SELENIUM_BASE_URL: ${
|
|
44
|
-
TS_SELENIUM_HEADLESS: ${
|
|
45
|
-
TS_SELENIUM_OCP_USERNAME: ${
|
|
46
|
-
TS_SELENIUM_EDITOR: ${
|
|
47
|
-
|
|
48
|
-
TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME: ${
|
|
49
|
-
TS_SELENIUM_DELAY_BETWEEN_SCREENSHOTS: ${
|
|
50
|
-
TS_SELENIUM_REPORT_FOLDER: ${
|
|
51
|
-
TS_SELENIUM_EXECUTION_SCREENCAST: ${
|
|
52
|
-
DELETE_SCREENCAST_IF_TEST_PASS: ${
|
|
53
|
-
TS_SELENIUM_REMOTE_DRIVER_URL: ${
|
|
54
|
-
DELETE_WORKSPACE_ON_FAILED_TEST: ${
|
|
55
|
-
TS_SELENIUM_LOG_LEVEL: ${
|
|
56
|
-
TS_SELENIUM_LAUNCH_FULLSCREEN: ${
|
|
42
|
+
TS_SELENIUM_BASE_URL: ${BaseTestConstants.TS_SELENIUM_BASE_URL}
|
|
43
|
+
TS_SELENIUM_HEADLESS: ${ChromeDriverConstants.TS_SELENIUM_HEADLESS}
|
|
44
|
+
TS_SELENIUM_OCP_USERNAME: ${OAuthConstants.TS_SELENIUM_OCP_USERNAME}
|
|
45
|
+
TS_SELENIUM_EDITOR: ${BaseTestConstants.TS_SELENIUM_EDITOR}
|
|
46
|
+
|
|
47
|
+
TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME: ${BaseTestConstants.TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME}
|
|
48
|
+
TS_SELENIUM_DELAY_BETWEEN_SCREENSHOTS: ${ReporterConstants.TS_SELENIUM_DELAY_BETWEEN_SCREENSHOTS}
|
|
49
|
+
TS_SELENIUM_REPORT_FOLDER: ${ReporterConstants.TS_SELENIUM_REPORT_FOLDER}
|
|
50
|
+
TS_SELENIUM_EXECUTION_SCREENCAST: ${ReporterConstants.TS_SELENIUM_EXECUTION_SCREENCAST}
|
|
51
|
+
DELETE_SCREENCAST_IF_TEST_PASS: ${ReporterConstants.DELETE_SCREENCAST_IF_TEST_PASS}
|
|
52
|
+
TS_SELENIUM_REMOTE_DRIVER_URL: ${ChromeDriverConstants.TS_SELENIUM_REMOTE_DRIVER_URL}
|
|
53
|
+
DELETE_WORKSPACE_ON_FAILED_TEST: ${BaseTestConstants.DELETE_WORKSPACE_ON_FAILED_TEST}
|
|
54
|
+
TS_SELENIUM_LOG_LEVEL: ${ReporterConstants.TS_SELENIUM_LOG_LEVEL}
|
|
55
|
+
TS_SELENIUM_LAUNCH_FULLSCREEN: ${ChromeDriverConstants.TS_SELENIUM_LAUNCH_FULLSCREEN}
|
|
57
56
|
|
|
58
57
|
TS_COMMON_DASHBOARD_WAIT_TIMEOUT: ${TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT}
|
|
59
58
|
TS_SELENIUM_START_WORKSPACE_TIMEOUT: ${TimeoutConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT}
|
|
60
59
|
TS_WAIT_LOADER_PRESENCE_TIMEOUT: ${TimeoutConstants.TS_WAIT_LOADER_PRESENCE_TIMEOUT}
|
|
61
60
|
|
|
62
|
-
TS_SAMPLE_LIST: ${
|
|
61
|
+
TS_SAMPLE_LIST: ${PluginsTestConstants.TS_SAMPLE_LIST}
|
|
63
62
|
|
|
64
63
|
${process.env.MOCHA_DIRECTORY ? 'MOCHA_DIRECTORY: ' + process.env.MOCHA_DIRECTORY : 'MOCHA_DRIRECTORY is not set'}
|
|
65
64
|
${process.env.USERSTORY ? 'USERSTORY: ' + process.env.USERSTORY : 'USERSTORY is not set'}
|
|
66
65
|
`;
|
|
67
66
|
|
|
68
|
-
if (
|
|
67
|
+
if (ReporterConstants.TS_SELENIUM_PRINT_TIMEOUT_VARIABLES) {
|
|
69
68
|
launchInformation += `\n TS_SELENIUM_PRINT_TIMEOUT_VARIABLES is set to true: \n`;
|
|
70
69
|
Object.entries(TimeoutConstants).forEach(
|
|
71
70
|
([key, value]) => launchInformation += `\n ${key}: ${value}`);
|
|
@@ -77,11 +76,11 @@ class CheReporter extends mocha.reporters.Spec {
|
|
|
77
76
|
|
|
78
77
|
console.log(launchInformation);
|
|
79
78
|
|
|
80
|
-
rm.sync(
|
|
79
|
+
rm.sync(ReporterConstants.TS_SELENIUM_REPORT_FOLDER);
|
|
81
80
|
});
|
|
82
81
|
|
|
83
82
|
runner.on('test', async function (test: mocha.Test): Promise<void> {
|
|
84
|
-
if (!
|
|
83
|
+
if (!ReporterConstants.TS_SELENIUM_EXECUTION_SCREENCAST) {
|
|
85
84
|
return;
|
|
86
85
|
}
|
|
87
86
|
|
|
@@ -93,13 +92,13 @@ class CheReporter extends mocha.reporters.Spec {
|
|
|
93
92
|
await screenCatcher.catchMethodScreen(test.title, currentMethodIndex, iterationIndex);
|
|
94
93
|
iterationIndex = iterationIndex + 1;
|
|
95
94
|
|
|
96
|
-
await driverHelper.wait(
|
|
95
|
+
await driverHelper.wait(ReporterConstants.TS_SELENIUM_DELAY_BETWEEN_SCREENSHOTS);
|
|
97
96
|
}
|
|
98
97
|
});
|
|
99
98
|
|
|
100
99
|
runner.on('pass', async (test: mocha.Test) => {
|
|
101
|
-
if (
|
|
102
|
-
const loadTestReportFolder: string =
|
|
100
|
+
if (BaseTestConstants.TS_LOAD_TESTS) {
|
|
101
|
+
const loadTestReportFolder: string = ReporterConstants.TS_SELENIUM_LOAD_TEST_REPORT_FOLDER;
|
|
103
102
|
const loadTestFilePath: string = loadTestReportFolder + '/load-test-results.txt';
|
|
104
103
|
const report: string = test.title + ': ' + test.duration + '\r';
|
|
105
104
|
if (!fs.existsSync(loadTestReportFolder)) {
|
|
@@ -118,8 +117,8 @@ class CheReporter extends mocha.reporters.Spec {
|
|
|
118
117
|
await driverHelper.getDriver().quit();
|
|
119
118
|
|
|
120
119
|
// delete screencast folder if conditions matched
|
|
121
|
-
if (deleteScreencast &&
|
|
122
|
-
rm.sync(
|
|
120
|
+
if (deleteScreencast && ReporterConstants.DELETE_SCREENCAST_IF_TEST_PASS) {
|
|
121
|
+
rm.sync(ReporterConstants.TS_SELENIUM_REPORT_FOLDER);
|
|
123
122
|
}
|
|
124
123
|
});
|
|
125
124
|
|
|
@@ -129,23 +128,23 @@ class CheReporter extends mocha.reporters.Spec {
|
|
|
129
128
|
deleteScreencast = false;
|
|
130
129
|
|
|
131
130
|
Logger.trace(`FullTitle:${test.fullTitle()}`);
|
|
132
|
-
const testFullTitle: string =
|
|
131
|
+
const testFullTitle: string = StringUtil.sanitizeTitle(test.fullTitle());
|
|
133
132
|
Logger.trace(`FullTitleSanitized:${testFullTitle}`);
|
|
134
133
|
Logger.trace(`TestTitle:${test.title}`);
|
|
135
|
-
const testTitle: string =
|
|
134
|
+
const testTitle: string = StringUtil.sanitizeTitle(test.title);
|
|
136
135
|
Logger.trace(`TestTitleSanitized:${testTitle}`);
|
|
137
136
|
|
|
138
|
-
const testReportDirPath: string = `${
|
|
137
|
+
const testReportDirPath: string = `${ReporterConstants.TS_SELENIUM_REPORT_FOLDER}/${testFullTitle}`;
|
|
139
138
|
const screenshotFileName: string = `${testReportDirPath}/screenshot-${testTitle}.png`;
|
|
140
139
|
const pageSourceFileName: string = `${testReportDirPath}/pagesource-${testTitle}.html`;
|
|
141
140
|
const browserLogsFileName: string = `${testReportDirPath}/browserlogs-${testTitle}.txt`;
|
|
142
141
|
|
|
143
142
|
|
|
144
143
|
// create reporter dir if not exist
|
|
145
|
-
const reportDirExists: boolean = fs.existsSync(
|
|
144
|
+
const reportDirExists: boolean = fs.existsSync(ReporterConstants.TS_SELENIUM_REPORT_FOLDER);
|
|
146
145
|
|
|
147
146
|
if (!reportDirExists) {
|
|
148
|
-
fs.mkdirSync(
|
|
147
|
+
fs.mkdirSync(ReporterConstants.TS_SELENIUM_REPORT_FOLDER);
|
|
149
148
|
}
|
|
150
149
|
|
|
151
150
|
// create dir for failed test report if not exist
|
|
@@ -179,12 +178,6 @@ class CheReporter extends mocha.reporters.Spec {
|
|
|
179
178
|
browserLogsStream.write(Buffer.from(browserLogs));
|
|
180
179
|
browserLogsStream.end();
|
|
181
180
|
|
|
182
|
-
// stop and remove running workspace
|
|
183
|
-
if (TestConstants.DELETE_WORKSPACE_ON_FAILED_TEST) {
|
|
184
|
-
Logger.warn('Property DELETE_WORKSPACE_ON_FAILED_TEST se to true - trying to stop and delete running workspace.');
|
|
185
|
-
await testWorkspaceUtil.stopAndDeleteWorkspaceByName(CheReporter.latestWorkspace);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
181
|
});
|
|
189
182
|
}
|
|
190
183
|
}
|