@eclipse-che/che-e2e 7.73.0 → 7.74.0-dev-41d1364
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/.eslintignore +10 -0
- package/.eslintrc.js +183 -0
- package/.prettierignore +10 -0
- package/.prettierrc.json +10 -0
- package/README.md +47 -47
- package/configs/inversify.config.ts +14 -10
- package/configs/inversify.types.ts +29 -29
- package/configs/mocharc.ts +21 -24
- package/constants/API_TEST_CONSTANTS.ts +67 -0
- package/constants/BASE_TEST_CONSTANTS.ts +80 -0
- package/constants/CHROME_DRIVER_CONSTANTS.ts +54 -0
- package/constants/FACTORY_TEST_CONSTANTS.ts +61 -0
- package/constants/MONACO_CONSTANTS.ts +25 -0
- package/constants/OAUTH_CONSTANTS.ts +67 -0
- package/constants/PLUGIN_TEST_CONSTANTS.ts +15 -0
- package/constants/REPORTER_CONSTANTS.ts +53 -0
- package/constants/TIMEOUT_CONSTANTS.ts +131 -0
- package/dist/configs/inversify.config.js +14 -8
- package/dist/configs/inversify.config.js.map +1 -1
- package/dist/configs/inversify.types.js +2 -2
- package/dist/configs/inversify.types.js.map +1 -1
- package/dist/configs/mocharc.js +13 -16
- package/dist/configs/mocharc.js.map +1 -1
- package/dist/constants/{APITestConstants.js → API_TEST_CONSTANTS.js} +13 -13
- package/dist/constants/API_TEST_CONSTANTS.js.map +1 -0
- package/dist/constants/{BaseTestConstants.js → BASE_TEST_CONSTANTS.js} +17 -16
- package/dist/constants/BASE_TEST_CONSTANTS.js.map +1 -0
- package/dist/constants/{ChromeDriverConstants.js → CHROME_DRIVER_CONSTANTS.js} +14 -14
- package/dist/constants/CHROME_DRIVER_CONSTANTS.js.map +1 -0
- package/dist/constants/{FactoryTestConstants.js → FACTORY_TEST_CONSTANTS.js} +15 -14
- package/dist/constants/FACTORY_TEST_CONSTANTS.js.map +1 -0
- package/dist/constants/{MonacoConstants.js → MONACO_CONSTANTS.js} +8 -8
- package/dist/constants/MONACO_CONSTANTS.js.map +1 -0
- package/dist/constants/{OAuthConstants.js → OAUTH_CONSTANTS.js} +15 -15
- package/dist/constants/OAUTH_CONSTANTS.js.map +1 -0
- package/dist/constants/{PluginsTestConstants.js → PLUGIN_TEST_CONSTANTS.js} +7 -7
- package/dist/constants/PLUGIN_TEST_CONSTANTS.js.map +1 -0
- package/dist/constants/{ReporterConstants.js → REPORTER_CONSTANTS.js} +13 -13
- package/dist/constants/REPORTER_CONSTANTS.js.map +1 -0
- package/dist/constants/{TimeoutConstants.js → TIMEOUT_CONSTANTS.js} +24 -24
- package/dist/constants/TIMEOUT_CONSTANTS.js.map +1 -0
- package/dist/driver/ChromeDriver.js +12 -16
- package/dist/driver/ChromeDriver.js.map +1 -1
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/pageobjects/dashboard/CreateWorkspace.js +18 -18
- package/dist/pageobjects/dashboard/CreateWorkspace.js.map +1 -1
- package/dist/pageobjects/dashboard/Dashboard.js +27 -27
- package/dist/pageobjects/dashboard/Dashboard.js.map +1 -1
- package/dist/pageobjects/dashboard/Workspaces.js +42 -42
- package/dist/pageobjects/dashboard/Workspaces.js.map +1 -1
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js +44 -33
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js.map +1 -1
- package/dist/pageobjects/git-providers/OauthPage.js +37 -35
- package/dist/pageobjects/git-providers/OauthPage.js.map +1 -1
- package/dist/pageobjects/ide/CheCodeLocatorLoader.js +10 -10
- package/dist/pageobjects/ide/CheCodeLocatorLoader.js.map +1 -1
- package/dist/pageobjects/login/interfaces/ICheLoginPage.js +2 -2
- package/dist/pageobjects/login/interfaces/IOcpLoginPage.js +2 -2
- package/dist/pageobjects/login/kubernetes/DexLoginPage.js +10 -10
- package/dist/pageobjects/login/kubernetes/DexLoginPage.js.map +1 -1
- package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js +6 -6
- package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/OcpLoginPage.js +23 -23
- package/dist/pageobjects/login/openshift/OcpLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js +7 -7
- package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/OcpUserLoginPage.js +7 -7
- package/dist/pageobjects/login/openshift/OcpUserLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/RedHatLoginPage.js +11 -11
- package/dist/pageobjects/login/openshift/RedHatLoginPage.js.map +1 -1
- package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js +10 -10
- package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js.map +1 -1
- package/dist/pageobjects/openshift/OcpApplicationPage.js +7 -7
- package/dist/pageobjects/openshift/OcpApplicationPage.js.map +1 -1
- package/dist/pageobjects/openshift/OcpImportFromGitPage.js +9 -9
- package/dist/pageobjects/openshift/OcpImportFromGitPage.js.map +1 -1
- package/dist/pageobjects/openshift/OcpMainPage.js +15 -15
- package/dist/pageobjects/openshift/OcpMainPage.js.map +1 -1
- package/dist/specs/MochaHooks.js +27 -24
- package/dist/specs/MochaHooks.js.map +1 -1
- package/dist/specs/SmokeTest.spec.js +17 -13
- package/dist/specs/SmokeTest.spec.js.map +1 -1
- package/dist/specs/api/ContainerOverridesAPI.spec.js +10 -1
- package/dist/specs/api/ContainerOverridesAPI.spec.js.map +1 -1
- package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js +31 -18
- package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js.map +1 -1
- package/dist/specs/api/EmptyWorkspaceAPI.spec.js +18 -12
- package/dist/specs/api/EmptyWorkspaceAPI.spec.js.map +1 -1
- package/dist/specs/api/PodOverridesAPI.spec.js +12 -2
- package/dist/specs/api/PodOverridesAPI.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js +12 -8
- package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/Quarkus.spec.js +13 -9
- package/dist/specs/dashboard-samples/Quarkus.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js +47 -43
- package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js.map +1 -1
- package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js +17 -10
- package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js.map +1 -1
- package/dist/specs/factory/Factory.spec.js +28 -26
- package/dist/specs/factory/Factory.spec.js.map +1 -1
- package/dist/specs/factory/NoSetupRepoFactory.spec.js +41 -36
- package/dist/specs/factory/NoSetupRepoFactory.spec.js.map +1 -1
- package/dist/specs/factory/RefusedOAuthFactory.spec.js +37 -35
- package/dist/specs/factory/RefusedOAuthFactory.spec.js.map +1 -1
- package/dist/specs/miscellaneous/PredefinedNamespace.spec.js +18 -5
- package/dist/specs/miscellaneous/PredefinedNamespace.spec.js.map +1 -1
- package/dist/tests-library/LoginTests.js +7 -7
- package/dist/tests-library/LoginTests.js.map +1 -1
- package/dist/tests-library/ProjectAndFileTests.js +9 -7
- package/dist/tests-library/ProjectAndFileTests.js.map +1 -1
- package/dist/tests-library/WorkspaceHandlingTests.js +61 -78
- package/dist/tests-library/WorkspaceHandlingTests.js.map +1 -1
- package/dist/utils/BrowserTabsUtil.js +29 -24
- package/dist/utils/BrowserTabsUtil.js.map +1 -1
- package/dist/utils/CheReporter.js +44 -44
- package/dist/utils/CheReporter.js.map +1 -1
- package/dist/utils/DevWorkspaceConfigurationHelper.js +19 -10
- package/dist/utils/DevWorkspaceConfigurationHelper.js.map +1 -1
- package/dist/utils/DevfilesRegistryHelper.js +25 -19
- package/dist/utils/DevfilesRegistryHelper.js.map +1 -1
- package/dist/utils/DriverHelper.js +126 -128
- package/dist/utils/DriverHelper.js.map +1 -1
- package/dist/utils/KubernetesCommandLineToolsExecutor.js +53 -46
- package/dist/utils/KubernetesCommandLineToolsExecutor.js.map +1 -1
- package/dist/utils/Logger.js +62 -39
- package/dist/utils/Logger.js.map +1 -1
- package/dist/utils/ScreenCatcher.js +18 -12
- package/dist/utils/ScreenCatcher.js.map +1 -1
- package/dist/utils/ShellExecutor.js +9 -0
- package/dist/utils/ShellExecutor.js.map +1 -1
- package/dist/utils/StringUtil.js +17 -9
- package/dist/utils/StringUtil.js.map +1 -1
- package/dist/utils/request-handlers/CheApiRequestHandler.js +36 -34
- package/dist/utils/request-handlers/CheApiRequestHandler.js.map +1 -1
- package/dist/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.js +10 -6
- package/dist/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.js.map +1 -1
- package/dist/utils/request-handlers/headers/IAuthorizationHeaderHandler.js +2 -2
- package/dist/utils/workspace/ApiUrlResolver.js +5 -5
- package/dist/utils/workspace/ApiUrlResolver.js.map +1 -1
- package/dist/utils/workspace/ITestWorkspaceUtil.js +2 -2
- package/dist/utils/workspace/TestWorkspaceUtil.js +36 -30
- package/dist/utils/workspace/TestWorkspaceUtil.js.map +1 -1
- package/dist/utils/workspace/WorkspaceStatus.js +2 -2
- package/dist/utils/workspace/WorkspaceStatus.js.map +1 -1
- package/driver/ChromeDriver.ts +45 -51
- package/driver/IDriver.ts +3 -3
- package/index.ts +9 -9
- package/package.json +59 -49
- package/pageobjects/dashboard/CreateWorkspace.ts +65 -56
- package/pageobjects/dashboard/Dashboard.ts +101 -100
- package/pageobjects/dashboard/Workspaces.ts +197 -166
- package/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts +151 -127
- package/pageobjects/git-providers/OauthPage.ts +177 -166
- package/pageobjects/ide/CheCodeLocatorLoader.ts +49 -46
- package/pageobjects/login/interfaces/ICheLoginPage.ts +3 -3
- package/pageobjects/login/interfaces/IOcpLoginPage.ts +3 -3
- package/pageobjects/login/kubernetes/DexLoginPage.ts +32 -31
- package/pageobjects/login/kubernetes/KubernetesLoginPage.ts +16 -15
- package/pageobjects/login/openshift/OcpLoginPage.ts +62 -55
- package/pageobjects/login/openshift/OcpRedHatLoginPage.ts +30 -25
- package/pageobjects/login/openshift/OcpUserLoginPage.ts +16 -19
- package/pageobjects/login/openshift/RedHatLoginPage.ts +49 -44
- package/pageobjects/login/openshift/RegularUserOcpCheLoginPage.ts +39 -35
- package/pageobjects/openshift/OcpApplicationPage.ts +21 -20
- package/pageobjects/openshift/OcpImportFromGitPage.ts +70 -68
- package/pageobjects/openshift/OcpMainPage.ts +69 -68
- package/resources/pod-overrides-airgap.yaml +37 -0
- package/specs/MochaHooks.ts +59 -50
- package/specs/SmokeTest.spec.ts +43 -36
- package/specs/api/ContainerOverridesAPI.spec.ts +33 -26
- package/specs/api/DevfileAcceptanceTestAPI.spec.ts +107 -94
- package/specs/api/EmptyWorkspaceAPI.spec.ts +62 -57
- package/specs/api/PodOverridesAPI.spec.ts +42 -32
- package/specs/dashboard-samples/EmptyWorkspace.spec.ts +31 -27
- package/specs/dashboard-samples/Quarkus.spec.ts +34 -30
- package/specs/dashboard-samples/RecommendedExtensions.spec.ts +192 -170
- package/specs/devconsole-intergration/DevConsoleIntegration.spec.ts +62 -55
- package/specs/factory/Factory.spec.ts +178 -166
- package/specs/factory/NoSetupRepoFactory.spec.ts +227 -210
- package/specs/factory/RefusedOAuthFactory.spec.ts +219 -203
- package/specs/miscellaneous/PredefinedNamespace.spec.ts +64 -50
- package/tests-library/LoginTests.ts +34 -32
- package/tests-library/ProjectAndFileTests.ts +21 -18
- package/tests-library/WorkspaceHandlingTests.ts +98 -108
- package/tsconfig.json +15 -15
- package/utils/BrowserTabsUtil.ts +104 -98
- package/utils/CheReporter.ts +142 -148
- package/utils/DevWorkspaceConfigurationHelper.ts +70 -61
- package/utils/DevfilesRegistryHelper.ts +67 -58
- package/utils/DriverHelper.ts +726 -701
- package/utils/KubernetesCommandLineToolsExecutor.ts +196 -172
- package/utils/Logger.ts +104 -75
- package/utils/ScreenCatcher.ts +59 -48
- package/utils/ShellExecutor.ts +19 -11
- package/utils/StringUtil.ts +40 -32
- package/utils/request-handlers/CheApiRequestHandler.ts +92 -87
- package/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.ts +32 -21
- package/utils/request-handlers/headers/IAuthorizationHeaderHandler.ts +3 -3
- package/utils/workspace/ApiUrlResolver.ts +31 -26
- package/utils/workspace/ITestWorkspaceUtil.ts +31 -31
- package/utils/workspace/TestWorkspaceUtil.ts +153 -142
- package/utils/workspace/WorkspaceStatus.ts +5 -5
- package/constants/APITestConstants.ts +0 -56
- package/constants/BaseTestConstants.ts +0 -65
- package/constants/ChromeDriverConstants.ts +0 -46
- package/constants/FactoryTestConstants.ts +0 -51
- package/constants/MonacoConstants.ts +0 -22
- package/constants/OAuthConstants.ts +0 -57
- package/constants/PluginsTestConstants.ts +0 -15
- package/constants/ReporterConstants.ts +0 -45
- package/constants/TimeoutConstants.ts +0 -113
- package/dist/constants/APITestConstants.js.map +0 -1
- package/dist/constants/BaseTestConstants.js.map +0 -1
- package/dist/constants/ChromeDriverConstants.js.map +0 -1
- package/dist/constants/FactoryTestConstants.js.map +0 -1
- package/dist/constants/MonacoConstants.js.map +0 -1
- package/dist/constants/OAuthConstants.js.map +0 -1
- package/dist/constants/PluginsTestConstants.js.map +0 -1
- package/dist/constants/ReporterConstants.js.map +0 -1
- package/dist/constants/TimeoutConstants.js.map +0 -1
- package/tslint.json +0 -126
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
1
|
+
/** *******************************************************************
|
|
2
|
+
* copyright (c) 2019 Red Hat, Inc.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made
|
|
5
5
|
* available under the terms of the Eclipse Public License 2.0
|
|
@@ -12,171 +12,182 @@ import { By } from 'selenium-webdriver';
|
|
|
12
12
|
import { CLASSES } from '../../configs/inversify.types';
|
|
13
13
|
import { DriverHelper } from '../../utils/DriverHelper';
|
|
14
14
|
import { Logger } from '../../utils/Logger';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
15
|
+
import { TIMEOUT_CONSTANTS } from '../../constants/TIMEOUT_CONSTANTS';
|
|
16
|
+
import { FACTORY_TEST_CONSTANTS, GitProviderType } from '../../constants/FACTORY_TEST_CONSTANTS';
|
|
17
|
+
import { OAUTH_CONSTANTS } from '../../constants/OAUTH_CONSTANTS';
|
|
18
18
|
|
|
19
19
|
@injectable()
|
|
20
20
|
export class OauthPage {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
21
|
+
private static LOGIN_FORM: By;
|
|
22
|
+
private static PASSWORD_FORM: By;
|
|
23
|
+
private static SUBMIT_BUTTON: By;
|
|
24
|
+
private static APPROVE_BUTTON: By;
|
|
25
|
+
private static DENY_ACCESS_BUTTON: By;
|
|
26
|
+
private static DENY_SAVE_CREDENTIALS_BUTTON: By;
|
|
27
|
+
|
|
28
|
+
constructor(
|
|
29
|
+
@inject(CLASSES.DriverHelper)
|
|
30
|
+
private readonly driverHelper: DriverHelper
|
|
31
|
+
) {
|
|
32
|
+
switch (FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER) {
|
|
33
|
+
case GitProviderType.BITBUCKET:
|
|
34
|
+
{
|
|
35
|
+
OauthPage.LOGIN_FORM = By.id('j_username');
|
|
36
|
+
OauthPage.PASSWORD_FORM = By.id('j_password');
|
|
37
|
+
OauthPage.APPROVE_BUTTON = By.id('approve');
|
|
38
|
+
OauthPage.SUBMIT_BUTTON = By.id('submit');
|
|
39
|
+
OauthPage.DENY_ACCESS_BUTTON = By.id('deny');
|
|
40
|
+
}
|
|
41
|
+
break;
|
|
42
|
+
case GitProviderType.GITLAB:
|
|
43
|
+
{
|
|
44
|
+
OauthPage.LOGIN_FORM = By.id('user_login');
|
|
45
|
+
OauthPage.PASSWORD_FORM = By.id('user_password');
|
|
46
|
+
OauthPage.SUBMIT_BUTTON = By.xpath('//button[@data-qa-selector="sign_in_button"]');
|
|
47
|
+
OauthPage.APPROVE_BUTTON = By.xpath('//*[@value="Authorize"]');
|
|
48
|
+
OauthPage.DENY_ACCESS_BUTTON = By.xpath('//input[@value="Deny"]');
|
|
49
|
+
}
|
|
50
|
+
break;
|
|
51
|
+
case GitProviderType.GITHUB:
|
|
52
|
+
{
|
|
53
|
+
OauthPage.LOGIN_FORM = By.id('login_field');
|
|
54
|
+
OauthPage.PASSWORD_FORM = By.id('password');
|
|
55
|
+
OauthPage.APPROVE_BUTTON = By.xpath('//*[@id="js-oauth-authorize-btn"]');
|
|
56
|
+
OauthPage.SUBMIT_BUTTON = By.xpath('//*[@value="Sign in"]');
|
|
57
|
+
OauthPage.DENY_ACCESS_BUTTON = By.xpath('//button[contains(., "Cancel")]');
|
|
58
|
+
}
|
|
59
|
+
break;
|
|
60
|
+
case GitProviderType.AZURE_DEVOPS:
|
|
61
|
+
{
|
|
62
|
+
OauthPage.LOGIN_FORM = By.xpath('//input[@type="email"]');
|
|
63
|
+
OauthPage.PASSWORD_FORM = By.xpath('//input[@type="password"]');
|
|
64
|
+
OauthPage.APPROVE_BUTTON = By.id('accept-button');
|
|
65
|
+
OauthPage.SUBMIT_BUTTON = By.xpath('//input[@type="submit"]');
|
|
66
|
+
OauthPage.DENY_SAVE_CREDENTIALS_BUTTON = By.xpath('//input[@type="button"]');
|
|
67
|
+
OauthPage.DENY_ACCESS_BUTTON = By.id('deny-button');
|
|
68
|
+
}
|
|
69
|
+
break;
|
|
70
|
+
default: {
|
|
71
|
+
throw new Error(
|
|
72
|
+
`Invalid git provider. The value should be ${GitProviderType.GITHUB}, ${GitProviderType.GITLAB}, ${GitProviderType.AZURE_DEVOPS} or ${GitProviderType.BITBUCKET}`
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async waitLoginPage(): Promise<void> {
|
|
79
|
+
Logger.debug();
|
|
80
|
+
|
|
81
|
+
await this.driverHelper.waitVisibility(OauthPage.LOGIN_FORM, TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM * 3);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async enterUserName(userName: string): Promise<void> {
|
|
85
|
+
Logger.debug(`"${userName}"`);
|
|
86
|
+
|
|
87
|
+
await this.driverHelper.enterValue(OauthPage.LOGIN_FORM, userName);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
async enterPassword(password: string): Promise<void> {
|
|
91
|
+
Logger.debug();
|
|
92
|
+
|
|
93
|
+
await this.driverHelper.enterValue(OauthPage.PASSWORD_FORM, password);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async clickOnSubmitButton(): Promise<void> {
|
|
97
|
+
Logger.debug();
|
|
98
|
+
|
|
99
|
+
await this.driverHelper.waitAndClick(OauthPage.SUBMIT_BUTTON);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
async clickOnNotRememberCredentialsButton(): Promise<void> {
|
|
103
|
+
Logger.debug();
|
|
104
|
+
|
|
105
|
+
await this.driverHelper.waitAndClick(OauthPage.DENY_SAVE_CREDENTIALS_BUTTON);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async waitClosingLoginPage(): Promise<void> {
|
|
109
|
+
Logger.debug();
|
|
110
|
+
|
|
111
|
+
await this.driverHelper.waitDisappearance(OauthPage.PASSWORD_FORM);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
async waitOauthPage(): Promise<void> {
|
|
115
|
+
Logger.debug();
|
|
116
|
+
|
|
117
|
+
await this.driverHelper.waitVisibility(OauthPage.APPROVE_BUTTON);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
async clickOnApproveButton(): Promise<void> {
|
|
121
|
+
Logger.debug();
|
|
122
|
+
|
|
123
|
+
await this.driverHelper.waitAndClick(OauthPage.APPROVE_BUTTON);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
async clickOnDenyAccessButton(): Promise<void> {
|
|
127
|
+
Logger.debug();
|
|
128
|
+
|
|
129
|
+
await this.driverHelper.waitAndClick(OauthPage.DENY_ACCESS_BUTTON);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
async waitDisappearanceOauthPage(): Promise<void> {
|
|
133
|
+
Logger.debug();
|
|
134
|
+
|
|
135
|
+
await this.driverHelper.waitDisappearance(OauthPage.APPROVE_BUTTON);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
async login(): Promise<void> {
|
|
139
|
+
Logger.debug();
|
|
140
|
+
|
|
141
|
+
await this.waitLoginPage();
|
|
142
|
+
await this.enterUserName(OAUTH_CONSTANTS.TS_SELENIUM_GIT_PROVIDER_USERNAME);
|
|
143
|
+
if (FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER === GitProviderType.AZURE_DEVOPS) {
|
|
144
|
+
await this.clickOnSubmitButton();
|
|
145
|
+
}
|
|
146
|
+
await this.enterPassword(OAUTH_CONSTANTS.TS_SELENIUM_GIT_PROVIDER_PASSWORD);
|
|
147
|
+
await this.clickOnSubmitButton();
|
|
148
|
+
if (FACTORY_TEST_CONSTANTS.TS_SELENIUM_FACTORY_GIT_PROVIDER === GitProviderType.AZURE_DEVOPS) {
|
|
149
|
+
await this.clickOnNotRememberCredentialsButton();
|
|
150
|
+
}
|
|
151
|
+
await this.waitClosingLoginPage();
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
async confirmAccess(): Promise<void> {
|
|
155
|
+
Logger.debug();
|
|
156
|
+
|
|
157
|
+
try {
|
|
158
|
+
await this.clickOnApproveButton();
|
|
159
|
+
await this.waitDisappearanceOauthPage();
|
|
160
|
+
} catch (e) {
|
|
161
|
+
Logger.debug('access was not confirmed, retrying to click confirmation button');
|
|
162
|
+
// workaround for GITHUB, AZURE_DEVOPS oauth confirmation page (bot security)
|
|
163
|
+
await this.driverHelper
|
|
164
|
+
.getAction()
|
|
165
|
+
.move({
|
|
166
|
+
origin: await this.driverHelper.waitPresence(OauthPage.APPROVE_BUTTON)
|
|
167
|
+
})
|
|
168
|
+
.click()
|
|
169
|
+
.perform();
|
|
170
|
+
await this.waitDisappearanceOauthPage();
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
async denyAccess(): Promise<void> {
|
|
175
|
+
Logger.debug();
|
|
176
|
+
|
|
177
|
+
try {
|
|
178
|
+
await this.clickOnDenyAccessButton();
|
|
179
|
+
await this.waitDisappearanceOauthPage();
|
|
180
|
+
} catch (e) {
|
|
181
|
+
Logger.debug('deny access was not confirmed, retrying to click confirmation button');
|
|
182
|
+
// workaround for GITHUB, AZURE_DEVOPS oauth confirmation page (bot security)
|
|
183
|
+
await this.driverHelper
|
|
184
|
+
.getAction()
|
|
185
|
+
.move({
|
|
186
|
+
origin: await this.driverHelper.waitPresence(OauthPage.DENY_ACCESS_BUTTON)
|
|
187
|
+
})
|
|
188
|
+
.click()
|
|
189
|
+
.perform();
|
|
190
|
+
await this.waitDisappearanceOauthPage();
|
|
191
|
+
}
|
|
192
|
+
}
|
|
182
193
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
1
|
+
/** *******************************************************************
|
|
2
|
+
* copyright (c) 2019 Red Hat, Inc.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made
|
|
5
5
|
* available under the terms of the Eclipse Public License 2.0
|
|
@@ -12,63 +12,66 @@ import { getLocatorsPath } from 'vscode-extension-tester-locators';
|
|
|
12
12
|
import { LocatorDiff, Locators } from 'monaco-page-objects';
|
|
13
13
|
import { By } from 'selenium-webdriver';
|
|
14
14
|
import clone from 'clone-deep';
|
|
15
|
-
import {
|
|
15
|
+
import { MONACO_CONSTANTS } from '../../constants/MONACO_CONSTANTS';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* this class allows us to change or add some specific locators base on "monaco-page-object" and "vscode-extension-tester-locators".
|
|
19
19
|
* Use method webLocatorDiff(). To change place locator into field "locators", to add - "extras".
|
|
20
20
|
* To see full locators list check "node_modules/vscode-extension-tester-locators/out/lib".
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
export class CheCodeLocatorLoader extends LocatorLoader {
|
|
24
|
-
|
|
24
|
+
readonly webCheCodeLocators: Locators;
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
constructor() {
|
|
27
|
+
super(
|
|
28
|
+
MONACO_CONSTANTS.TS_SELENIUM_MONACO_PAGE_OBJECTS_BASE_VERSION,
|
|
29
|
+
MONACO_CONSTANTS.TS_SELENIUM_MONACO_PAGE_OBJECTS_BASE_VERSION,
|
|
30
|
+
getLocatorsPath()
|
|
31
|
+
);
|
|
32
|
+
this.webCheCodeLocators = this.mergeLocators();
|
|
33
|
+
}
|
|
30
34
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
35
|
+
private webLocatorDiff(): LocatorDiff {
|
|
36
|
+
return {
|
|
37
|
+
locators: {
|
|
38
|
+
WelcomeContent: {
|
|
39
|
+
text: By.xpath('//*[@class="dialog-message-text" and contains(text(), "trust")]'),
|
|
40
|
+
button: By.xpath('//a[contains(., "trust")]')
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
extras: {
|
|
44
|
+
ExtensionsViewSection: {
|
|
45
|
+
requireReloadButton: By.xpath('//a[text()="Reload Required"]')
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
46
50
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
private merge(target: any, obj: any): object {
|
|
52
|
+
for (const key in obj) {
|
|
53
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
52
56
|
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
const oldVal: any = obj[key];
|
|
58
|
+
const newVal: any = target[key];
|
|
55
59
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
if (typeof newVal === 'object' && typeof oldVal === 'object') {
|
|
61
|
+
target[key] = this.merge(newVal, oldVal);
|
|
62
|
+
} else {
|
|
63
|
+
target[key] = clone(oldVal);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return target;
|
|
67
|
+
}
|
|
64
68
|
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
private mergeLocators(): Locators {
|
|
70
|
+
const target: Locators = super.loadLocators();
|
|
67
71
|
|
|
68
|
-
|
|
69
|
-
|
|
72
|
+
this.merge(target, this.webLocatorDiff().locators as Locators);
|
|
73
|
+
this.merge(target, this.webLocatorDiff().extras as Locators);
|
|
70
74
|
|
|
71
|
-
|
|
72
|
-
|
|
75
|
+
return target;
|
|
76
|
+
}
|
|
73
77
|
}
|
|
74
|
-
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
1
|
+
/** *******************************************************************
|
|
2
|
+
* copyright (c) 2019-2023 Red Hat, Inc.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made
|
|
5
5
|
* available under the terms of the Eclipse Public License 2.0
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
**********************************************************************/
|
|
10
10
|
|
|
11
11
|
export interface ICheLoginPage {
|
|
12
|
-
|
|
12
|
+
login(): Promise<void>;
|
|
13
13
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
1
|
+
/** *******************************************************************
|
|
2
|
+
* copyright (c) 2019-2023 Red Hat, Inc.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made
|
|
5
5
|
* available under the terms of the Eclipse Public License 2.0
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
**********************************************************************/
|
|
10
10
|
|
|
11
11
|
export interface IOcpLoginPage {
|
|
12
|
-
|
|
12
|
+
login(): void;
|
|
13
13
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
1
|
+
/** *******************************************************************
|
|
2
|
+
* copyright (c) 2019-2023 Red Hat, Inc.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made
|
|
5
5
|
* available under the terms of the Eclipse Public License 2.0
|
|
@@ -8,51 +8,52 @@
|
|
|
8
8
|
* SPDX-License-Identifier: EPL-2.0
|
|
9
9
|
**********************************************************************/
|
|
10
10
|
import 'reflect-metadata';
|
|
11
|
-
import {
|
|
11
|
+
import { inject, injectable } from 'inversify';
|
|
12
12
|
import { CLASSES } from '../../../configs/inversify.types';
|
|
13
13
|
import { Logger } from '../../../utils/Logger';
|
|
14
14
|
import { By } from 'selenium-webdriver';
|
|
15
|
-
import {
|
|
15
|
+
import { TIMEOUT_CONSTANTS } from '../../../constants/TIMEOUT_CONSTANTS';
|
|
16
16
|
import { DriverHelper } from '../../../utils/DriverHelper';
|
|
17
17
|
|
|
18
18
|
@injectable()
|
|
19
19
|
export class DexLoginPage {
|
|
20
|
+
private static readonly dexPageContentContainer: By = By.className('dex-container');
|
|
21
|
+
private static readonly loginInput: By = By.id('login');
|
|
22
|
+
private static readonly passwordInput: By = By.id('password');
|
|
23
|
+
private static readonly submitButton: By = By.id('submit-login');
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
constructor(
|
|
26
|
+
@inject(CLASSES.DriverHelper)
|
|
27
|
+
private readonly driverHelper: DriverHelper
|
|
28
|
+
) {}
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
async waitDexLoginPage(): Promise<void> {
|
|
31
|
+
Logger.debug();
|
|
28
32
|
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
await this.driverHelper.waitVisibility(DexLoginPage.dexPageContentContainer, TIMEOUT_CONSTANTS.TS_SELENIUM_LOAD_PAGE_TIMEOUT);
|
|
34
|
+
}
|
|
31
35
|
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
async clickOnLoginButton(): Promise<void> {
|
|
37
|
+
Logger.debug();
|
|
34
38
|
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
await this.driverHelper.waitAndClick(DexLoginPage.submitButton);
|
|
40
|
+
}
|
|
37
41
|
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
async enterUserNameKubernetes(userName: string): Promise<void> {
|
|
43
|
+
Logger.debug();
|
|
40
44
|
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
await this.driverHelper.enterValue(DexLoginPage.loginInput, userName);
|
|
46
|
+
}
|
|
43
47
|
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
async enterPasswordKubernetes(password: string): Promise<void> {
|
|
49
|
+
Logger.debug();
|
|
46
50
|
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
await this.driverHelper.enterValue(DexLoginPage.passwordInput, password);
|
|
52
|
+
}
|
|
49
53
|
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
async waitDexLoginPageDisappearance(): Promise<void> {
|
|
55
|
+
Logger.debug();
|
|
52
56
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
await this.driverHelper.waitDisappearance(DexLoginPage.dexPageContentContainer, TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT);
|
|
57
|
-
}
|
|
57
|
+
await this.driverHelper.waitDisappearance(DexLoginPage.dexPageContentContainer, TIMEOUT_CONSTANTS.TS_SELENIUM_LOAD_PAGE_TIMEOUT);
|
|
58
|
+
}
|
|
58
59
|
}
|