@eclipse-che/che-e2e 7.64.0-dev-20514b2 → 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 (165) hide show
  1. package/README.md +11 -37
  2. package/build/dockerfiles/entrypoint.sh +1 -1
  3. package/configs/inversify.config.ts +11 -26
  4. package/configs/inversify.types.ts +5 -35
  5. package/configs/mocharc.ts +9 -3
  6. package/configs/sh-scripts/initDefaultValues.sh +0 -5
  7. package/constants/TestConstants.ts +35 -97
  8. package/constants/TimeoutConstants.ts +1 -1
  9. package/dist/configs/inversify.config.js +8 -23
  10. package/dist/configs/inversify.config.js.map +1 -1
  11. package/dist/configs/inversify.types.js +3 -33
  12. package/dist/configs/inversify.types.js.map +1 -1
  13. package/dist/configs/mocharc.js +11 -4
  14. package/dist/configs/mocharc.js.map +1 -1
  15. package/dist/constants/TestConstants.js +31 -86
  16. package/dist/constants/TestConstants.js.map +1 -1
  17. package/dist/constants/TimeoutConstants.js.map +1 -1
  18. package/dist/driver/ChromeDriver.js +1 -1
  19. package/dist/driver/ChromeDriver.js.map +1 -1
  20. package/dist/index.js +63 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/pageobjects/dashboard/CreateWorkspace.js +8 -16
  23. package/dist/pageobjects/dashboard/CreateWorkspace.js.map +1 -1
  24. package/dist/pageobjects/dashboard/Dashboard.js +16 -1
  25. package/dist/pageobjects/dashboard/Dashboard.js.map +1 -1
  26. package/dist/pageobjects/dashboard/Workspaces.js +1 -3
  27. package/dist/pageobjects/dashboard/Workspaces.js.map +1 -1
  28. package/dist/pageobjects/git-providers/OauthPage.js +150 -0
  29. package/dist/pageobjects/git-providers/OauthPage.js.map +1 -0
  30. package/dist/pageobjects/ide/CheCodeLocatorLoader.js +65 -0
  31. package/dist/pageobjects/ide/CheCodeLocatorLoader.js.map +1 -0
  32. package/dist/pageobjects/login/OcpRedHatLoginPage.js +67 -0
  33. package/dist/pageobjects/login/OcpRedHatLoginPage.js.map +1 -0
  34. package/dist/pageobjects/login/RedHatLoginPage.js +78 -0
  35. package/dist/pageobjects/login/RedHatLoginPage.js.map +1 -0
  36. package/dist/pageobjects/login/RegularUserOcpCheLoginPage.js +3 -21
  37. package/dist/pageobjects/login/RegularUserOcpCheLoginPage.js.map +1 -1
  38. package/dist/pageobjects/openshift/CheLoginPage.js +0 -33
  39. package/dist/pageobjects/openshift/CheLoginPage.js.map +1 -1
  40. package/dist/pageobjects/openshift/OcpLoginPage.js +0 -14
  41. package/dist/pageobjects/openshift/OcpLoginPage.js.map +1 -1
  42. package/dist/specs/MochaHooks.js +2 -2
  43. package/dist/specs/MochaHooks.js.map +1 -1
  44. package/dist/specs/SmokeTest.spec.js +49 -0
  45. package/dist/specs/SmokeTest.spec.js.map +1 -0
  46. package/dist/specs/devfiles/EmptyWorkspace.spec.js +1 -0
  47. package/dist/specs/devfiles/EmptyWorkspace.spec.js.map +1 -1
  48. package/dist/specs/devfiles/Quarkus.spec.js +50 -0
  49. package/dist/specs/devfiles/Quarkus.spec.js.map +1 -0
  50. package/dist/specs/factory/Factory.spec.js +160 -0
  51. package/dist/specs/factory/Factory.spec.js.map +1 -0
  52. package/dist/specs/factory/NoSetupRepoFactory.spec.js +228 -0
  53. package/dist/specs/factory/NoSetupRepoFactory.spec.js.map +1 -0
  54. package/dist/specs/factory/RefusedOAuthFactory.spec.js +220 -0
  55. package/dist/specs/factory/RefusedOAuthFactory.spec.js.map +1 -0
  56. package/dist/specs/miscellaneous/PredefinedNamespace.spec.js +66 -0
  57. package/dist/specs/miscellaneous/PredefinedNamespace.spec.js.map +1 -0
  58. package/dist/tests-library/LoginTests.js +10 -2
  59. package/dist/tests-library/LoginTests.js.map +1 -1
  60. package/dist/tests-library/WorkspaceHandlingTests.js +15 -6
  61. package/dist/tests-library/WorkspaceHandlingTests.js.map +1 -1
  62. package/dist/utils/BrowserTabsUtil.js +2 -21
  63. package/dist/utils/BrowserTabsUtil.js.map +1 -1
  64. package/dist/utils/CheReporter.js +5 -2
  65. package/dist/utils/CheReporter.js.map +1 -1
  66. package/dist/utils/DriverHelper.js +11 -73
  67. package/dist/utils/DriverHelper.js.map +1 -1
  68. package/dist/utils/Logger.js +5 -0
  69. package/dist/utils/Logger.js.map +1 -1
  70. package/dist/utils/Sanitizer.js.map +1 -1
  71. package/dist/utils/ScreenCatcher.js.map +1 -1
  72. package/dist/utils/request-handlers/CheApiRequestHandler.js +1 -1
  73. package/dist/utils/request-handlers/CheApiRequestHandler.js.map +1 -1
  74. package/dist/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.js.map +1 -1
  75. package/dist/utils/vsc/GitUtil.js +36 -0
  76. package/dist/utils/vsc/GitUtil.js.map +1 -0
  77. package/dist/utils/workspace/ApiUrlResolver.js +0 -3
  78. package/dist/utils/workspace/ApiUrlResolver.js.map +1 -1
  79. package/dist/utils/workspace/TestWorkspaceUtil.js +3 -193
  80. package/dist/utils/workspace/TestWorkspaceUtil.js.map +1 -1
  81. package/driver/ChromeDriver.ts +3 -3
  82. package/index.ts +37 -0
  83. package/package.json +9 -5
  84. package/pageobjects/dashboard/CreateWorkspace.ts +10 -21
  85. package/pageobjects/dashboard/Dashboard.ts +37 -16
  86. package/pageobjects/dashboard/Workspaces.ts +21 -23
  87. package/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts +16 -16
  88. package/pageobjects/git-providers/OauthPage.ts +156 -0
  89. package/pageobjects/ide/CheCodeLocatorLoader.ts +69 -0
  90. package/pageobjects/login/OcpRedHatLoginPage.ts +49 -0
  91. package/pageobjects/login/OcpUserLoginPage.ts +1 -1
  92. package/pageobjects/login/RedHatLoginPage.ts +62 -0
  93. package/pageobjects/login/RegularUserOcpCheLoginPage.ts +2 -21
  94. package/pageobjects/openshift/CheLoginPage.ts +8 -57
  95. package/pageobjects/openshift/OcpLoginPage.ts +8 -29
  96. package/specs/MochaHooks.ts +9 -9
  97. package/specs/SmokeTest.spec.ts +50 -0
  98. package/specs/devfiles/EmptyWorkspace.spec.ts +1 -0
  99. package/specs/devfiles/Quarkus.spec.ts +52 -0
  100. package/specs/factory/Factory.spec.ts +199 -0
  101. package/specs/factory/NoSetupRepoFactory.spec.ts +272 -0
  102. package/specs/factory/RefusedOAuthFactory.spec.ts +260 -0
  103. package/specs/miscellaneous/PredefinedNamespace.spec.ts +74 -0
  104. package/tests-library/LoginTests.ts +9 -1
  105. package/tests-library/WorkspaceHandlingTests.ts +16 -7
  106. package/tslint.json +4 -4
  107. package/utils/BrowserTabsUtil.ts +9 -31
  108. package/utils/CheReporter.ts +12 -8
  109. package/utils/DriverHelper.ts +40 -115
  110. package/utils/Logger.ts +13 -8
  111. package/utils/Sanitizer.ts +0 -1
  112. package/utils/ScreenCatcher.ts +8 -7
  113. package/utils/request-handlers/CheApiRequestHandler.ts +1 -1
  114. package/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.ts +2 -1
  115. package/utils/vsc/GitUtil.ts +25 -0
  116. package/utils/workspace/ApiUrlResolver.ts +3 -6
  117. package/utils/workspace/ITestWorkspaceUtil.ts +1 -56
  118. package/utils/workspace/TestWorkspaceUtil.ts +24 -265
  119. package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetailsPlugins.js +0 -97
  120. package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetailsPlugins.js.map +0 -1
  121. package/dist/pageobjects/login/MultiUserLoginPage.js +0 -49
  122. package/dist/pageobjects/login/MultiUserLoginPage.js.map +0 -1
  123. package/dist/pageobjects/login/UpdateAccountInformationPage.js +0 -74
  124. package/dist/pageobjects/login/UpdateAccountInformationPage.js.map +0 -1
  125. package/dist/pageobjects/third-parties/GitLoginPage.js +0 -85
  126. package/dist/pageobjects/third-parties/GitLoginPage.js.map +0 -1
  127. package/dist/pageobjects/third-parties/GitOauthAppsSettings.js +0 -110
  128. package/dist/pageobjects/third-parties/GitOauthAppsSettings.js.map +0 -1
  129. package/dist/specs/login/LinkCheAndOcpUsers.spec.js +0 -40
  130. package/dist/specs/login/LinkCheAndOcpUsers.spec.js.map +0 -1
  131. package/dist/utils/WorkspaceNameHandler.js +0 -60
  132. package/dist/utils/WorkspaceNameHandler.js.map +0 -1
  133. package/dist/utils/request-handlers/tokens/CheMultiuserTokenHandler.js +0 -50
  134. package/dist/utils/request-handlers/tokens/CheMultiuserTokenHandler.js.map +0 -1
  135. package/dist/utils/request-handlers/tokens/ITokenHandler.js +0 -12
  136. package/dist/utils/request-handlers/tokens/ITokenHandler.js.map +0 -1
  137. package/dist/utils/vsc/CheGitApi.js +0 -42
  138. package/dist/utils/vsc/CheGitApi.js.map +0 -1
  139. package/dist/utils/vsc/github/GitHubUtil.js +0 -126
  140. package/dist/utils/vsc/github/GitHubUtil.js.map +0 -1
  141. package/files/devfiles/plugins/GitHubPullRequestPlugin.yaml +0 -11
  142. package/files/devfiles/plugins/InstallPluginUsingUI.yaml +0 -3
  143. package/files/devfiles/plugins/Java11PluginTest.yaml +0 -17
  144. package/files/devfiles/plugins/PhpPluginTest.yaml +0 -47
  145. package/files/devfiles/plugins/PythonPluginTest.yaml +0 -14
  146. package/files/devfiles/plugins/TypescriptNodeDebug2PluginTest.yaml +0 -49
  147. package/files/devfiles/plugins/VscodeKubernetesPlugin.yaml +0 -12
  148. package/files/devfiles/plugins/VscodeShellcheckPlugin.yaml +0 -12
  149. package/files/devfiles/plugins/VscodeValePlugin.yaml +0 -42
  150. package/files/devfiles/plugins/VscodeXmlPlugin.yaml +0 -12
  151. package/files/devfiles/plugins/VscodeYamlPlugin.yaml +0 -12
  152. package/files/happy-path/containers-happy-path.yaml +0 -127
  153. package/files/happy-path/happy-path-workspace.yaml +0 -95
  154. package/files/happy-path/petclinic-classpath.txt +0 -49
  155. package/pageobjects/dashboard/workspace-details/WorkspaceDetailsPlugins.ts +0 -95
  156. package/pageobjects/login/MultiUserLoginPage.ts +0 -33
  157. package/pageobjects/login/UpdateAccountInformationPage.ts +0 -70
  158. package/pageobjects/third-parties/GitLoginPage.ts +0 -81
  159. package/pageobjects/third-parties/GitOauthAppsSettings.ts +0 -110
  160. package/specs/login/LinkCheAndOcpUsers.spec.ts +0 -49
  161. package/utils/WorkspaceNameHandler.ts +0 -48
  162. package/utils/request-handlers/tokens/CheMultiuserTokenHandler.ts +0 -41
  163. package/utils/request-handlers/tokens/ITokenHandler.ts +0 -14
  164. package/utils/vsc/CheGitApi.ts +0 -22
  165. package/utils/vsc/github/GitHubUtil.ts +0 -110
@@ -28,25 +28,25 @@ export class Workspaces {
28
28
  constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) {
29
29
  }
30
30
 
31
- async waitPage(timeout: number = TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
31
+ async waitPage(timeout: number = TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT): Promise<void> {
32
32
  Logger.debug('Workspaces.waitPage');
33
33
 
34
34
  await this.driverHelper.waitVisibility(By.xpath(Workspaces.ADD_WORKSPACE_BUTTON_XPATH), timeout);
35
35
  }
36
36
 
37
- async clickAddWorkspaceButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT) {
37
+ async clickAddWorkspaceButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT): Promise<void> {
38
38
  Logger.debug('Workspaces.clickAddWorkspaceButton');
39
39
 
40
40
  await this.driverHelper.waitAndClick(By.xpath(Workspaces.ADD_WORKSPACE_BUTTON_XPATH), timeout);
41
41
  }
42
42
 
43
- async clickOpenButton(workspaceName: string, timeout: number = TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
43
+ async clickOpenButton(workspaceName: string, timeout: number = TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT): Promise<void> {
44
44
  Logger.debug('Workspaces.clickOpenButton');
45
45
 
46
46
  await this.driverHelper.waitAndClick(this.getOpenButtonLocator(workspaceName), timeout);
47
47
  }
48
48
 
49
- async waitWorkspaceListItem(workspaceName: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
49
+ async waitWorkspaceListItem(workspaceName: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
50
50
  Logger.debug(`Workspaces.waitWorkspaceListItem "${workspaceName}"`);
51
51
 
52
52
  const workspaceListItemLocator: By = By.xpath(this.getWorkspaceListItemLocator(workspaceName));
@@ -54,7 +54,7 @@ export class Workspaces {
54
54
  await this.driverHelper.waitVisibility(workspaceListItemLocator, timeout);
55
55
  }
56
56
 
57
- async waitWorkspaceWithRunningStatus(workspaceName: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
57
+ async waitWorkspaceWithRunningStatus(workspaceName: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
58
58
  Logger.debug(`Workspaces.waitWorkspaceWithRunningStatus "${workspaceName}"`);
59
59
 
60
60
  const runningStatusLocator: By = this.getWorkspaceStatusLocator(workspaceName, WorkspaceStatusUI.Running);
@@ -62,7 +62,7 @@ export class Workspaces {
62
62
  await this.driverHelper.waitVisibility(runningStatusLocator, timeout);
63
63
  }
64
64
 
65
- async waitWorkspaceWithStoppedStatus(workspaceName: string, timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT) {
65
+ async waitWorkspaceWithStoppedStatus(workspaceName: string, timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT): Promise<void> {
66
66
  Logger.debug(`Workspaces.waitWorkspaceWithStoppedStatus "${workspaceName}"`);
67
67
 
68
68
  const stoppedStatusLocator: By = this.getWorkspaceStatusLocator(workspaceName, WorkspaceStatusUI.Stopped);
@@ -70,7 +70,7 @@ export class Workspaces {
70
70
  await this.driverHelper.waitVisibility(stoppedStatusLocator, timeout);
71
71
  }
72
72
 
73
- async clickWorkspaceListItem(workspaceName: string, timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT) {
73
+ async clickWorkspaceListItem(workspaceName: string, timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT): Promise<void> {
74
74
  Logger.debug(`Workspaces.clickWorkspaceListItem "${workspaceName}"`);
75
75
 
76
76
  const workspaceListItemLocator: By = By.xpath(this.getWorkspaceListItemLocator(workspaceName));
@@ -78,34 +78,33 @@ export class Workspaces {
78
78
  await this.driverHelper.waitAndClick(workspaceListItemLocator, timeout);
79
79
  }
80
80
 
81
- async clickActionsButton(workspaceName: string) {
81
+ async clickActionsButton(workspaceName: string): Promise<void> {
82
82
  Logger.debug(`Workspaces.clickActionsButton of the '${workspaceName}' list item`);
83
83
 
84
84
  await this.driverHelper.waitAndClick(this.getActionsLocator(workspaceName));
85
85
  }
86
86
 
87
- async waitActionsPopup(workspaceName: string, timeout: number = TimeoutConstants.TS_CONTEXT_MENU_TIMEOUT) {
87
+ async waitActionsPopup(workspaceName: string, timeout: number = TimeoutConstants.TS_CONTEXT_MENU_TIMEOUT): Promise<void> {
88
88
  Logger.debug(`Workspaces.waitActionsPopup of the '${workspaceName}' list item`);
89
89
 
90
90
  await this.driverHelper.waitVisibility(this.getExpandedActionsLocator(workspaceName), timeout);
91
- await this.driverHelper.wait(2000);
92
91
  }
93
92
 
94
- async openActionsPopup(workspaceName: string, timeout: number = TimeoutConstants.TS_CONTEXT_MENU_TIMEOUT) {
93
+ async openActionsPopup(workspaceName: string, timeout: number = TimeoutConstants.TS_CONTEXT_MENU_TIMEOUT): Promise<void> {
95
94
  Logger.debug(`Workspaces.openActionsPopup for the '${workspaceName}' list item`);
96
95
  await this.clickActionsButton(workspaceName);
97
96
  await this.waitActionsPopup(workspaceName, timeout);
98
97
  }
99
98
 
100
- async clickActionsDeleteButton(workspaceName: string) {
99
+ async clickActionsDeleteButton(workspaceName: string): Promise<void> {
101
100
  Logger.debug(`Workspaces.clickActionsDeleteButton for the '${workspaceName}' list item`);
102
101
 
103
102
  await this.driverHelper.waitAndClick(this.getActionsPopupButtonLocator(workspaceName, 'Delete Workspace'));
104
103
  }
105
104
 
106
- async clickActionsStopWorkspaceButton(workspaceName: string) {
105
+ async clickActionsStopWorkspaceButton(workspaceName: string): Promise<void> {
107
106
  Logger.debug(`Workspaces.clickActionsStopWorkspaceButton for the '${workspaceName}' list item`);
108
- // workaround because of issue CRW-3649
107
+ // todo: workaround because of issue CRW-3649
109
108
  try {
110
109
  await this.driverHelper.waitAndClick(this.getActionsPopupButtonLocator(workspaceName, 'Stop Workspace'));
111
110
  } catch (e) {
@@ -116,17 +115,16 @@ export class Workspaces {
116
115
  }
117
116
  }
118
117
 
119
- async waitDeleteWorkspaceConfirmationWindow(timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT) {
118
+ async waitDeleteWorkspaceConfirmationWindow(timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT): Promise<void> {
120
119
  Logger.debug(`Workspaces.waitDeleteWorkspaceConfirmationWindow`);
121
120
 
122
121
  const confirmationWindowLocator: By = By.xpath(`//div[@aria-label='Delete workspaces confirmation window']`);
123
122
 
124
123
  await this.driverHelper.waitVisibility(confirmationWindowLocator, timeout);
125
- await this.driverHelper.wait(5000);
126
124
  }
127
125
 
128
126
 
129
- async clickToDeleteConfirmationCheckbox(timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT) {
127
+ async clickToDeleteConfirmationCheckbox(timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT): Promise<void> {
130
128
  Logger.debug(`Workspaces.clickToDeleteConfirmationCheckbox`);
131
129
 
132
130
  const deleteConfirmationCheckboxLocator: By = By.xpath(`//input[@data-testid='confirmation-checkbox']`);
@@ -134,7 +132,7 @@ export class Workspaces {
134
132
  await this.driverHelper.waitAndClick(deleteConfirmationCheckboxLocator, timeout);
135
133
  }
136
134
 
137
- async waitAndClickEnabledConfirmationWindowDeleteButton(timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT) {
135
+ async waitAndClickEnabledConfirmationWindowDeleteButton(timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT): Promise<void> {
138
136
  Logger.debug(`Workspaces.waitEnabledConfirmationWindowDeleteButton`);
139
137
 
140
138
  const enabledConfirmationWindowDeleteButton: By = By.xpath(`//button[@data-testid='delete-workspace-button' and not(@disabled)]`);
@@ -143,7 +141,7 @@ export class Workspaces {
143
141
  }
144
142
 
145
143
 
146
- async deleteWorkspaceByActionsButton(workspaceName: string, timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT) {
144
+ async deleteWorkspaceByActionsButton(workspaceName: string, timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT): Promise<void> {
147
145
  Logger.debug('Workspaces.deleteWorkspaceByActionsButton');
148
146
 
149
147
  await this.waitWorkspaceListItem(workspaceName, timeout);
@@ -154,7 +152,7 @@ export class Workspaces {
154
152
  await this.waitAndClickEnabledConfirmationWindowDeleteButton(timeout);
155
153
  }
156
154
 
157
- async stopWorkspaceByActionsButton(workspaceName: string, timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT) {
155
+ async stopWorkspaceByActionsButton(workspaceName: string, timeout: number = TimeoutConstants.TS_DASHBOARD_WORKSPACE_STOP_TIMEOUT): Promise<void> {
158
156
  Logger.debug('Workspaces.stopWorkspaceByActionsButton');
159
157
 
160
158
  await this.waitWorkspaceListItem(workspaceName, timeout);
@@ -162,7 +160,7 @@ export class Workspaces {
162
160
  await this.clickActionsStopWorkspaceButton(workspaceName);
163
161
  }
164
162
 
165
- async waitWorkspaceListItemAbcence(workspaceName: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
163
+ async waitWorkspaceListItemAbcence(workspaceName: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
166
164
  Logger.debug(`Workspaces.waitWorkspaceListItemAbcence "${workspaceName}"`);
167
165
 
168
166
  const workspaceListItemLocator: By = By.xpath(this.getWorkspaceListItemLocator(workspaceName));
@@ -170,7 +168,7 @@ export class Workspaces {
170
168
  await this.driverHelper.waitDisappearance(workspaceListItemLocator, timeout);
171
169
  }
172
170
 
173
- async getAllCreatedWorkspacesNames(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
171
+ async getAllCreatedWorkspacesNames(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<string[]> {
174
172
  Logger.debug('Workspaces.getAllCreatedWorkspacesNames');
175
173
 
176
174
  const workspaceNames: string[] = [];
@@ -209,7 +207,7 @@ export class Workspaces {
209
207
  return By.xpath(`${this.getWorkspaceListItemLocator(workspaceName)}//li[@role='menuitem']//button[text()='${buttonText}']`);
210
208
  }
211
209
 
212
- private getOpenButtonLocator(workspaceName: string) {
210
+ private getOpenButtonLocator(workspaceName: string): By {
213
211
  return By.xpath(`${this.getWorkspaceListItemLocator(workspaceName)}//td[@data-key=5]//a[text()='Open']`);
214
212
  }
215
213
  }
@@ -31,13 +31,13 @@ export class WorkspaceDetails {
31
31
  @inject(TYPES.WorkspaceUtil) private readonly testWorkspaceUtil: ITestWorkspaceUtil,
32
32
  @inject(CLASSES.ProjectAndFileTests) private readonly testProjectAndFileCheCode: ProjectAndFileTests) { }
33
33
 
34
- async waitLoaderDisappearance(attempts: number = TestConstants.TS_SELENIUM_DEFAULT_ATTEMPTS, polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING) {
34
+ async waitLoaderDisappearance(attempts: number = TestConstants.TS_SELENIUM_DEFAULT_ATTEMPTS, polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING): Promise<void> {
35
35
  Logger.debug('WorkspaceDetails.waitLoaderDisappearance');
36
36
 
37
37
  await this.driverHelper.waitDisappearance(By.css(WorkspaceDetails.WORKSPACE_DETAILS_LOADER_CSS), attempts, polling);
38
38
  }
39
39
 
40
- async saveChanges() {
40
+ async saveChanges(): Promise<void> {
41
41
  Logger.debug('WorkspaceDetails.saveChanges');
42
42
 
43
43
  await this.waitSaveButton();
@@ -45,7 +45,7 @@ export class WorkspaceDetails {
45
45
  await this.waitSaveButtonDisappearance();
46
46
  }
47
47
 
48
- async waitPage(workspaceName: string, timeout: number = TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
48
+ async waitPage(workspaceName: string, timeout: number = TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT): Promise<void> {
49
49
  Logger.debug(`WorkspaceDetails.saveChanges workspace: "${workspaceName}"`);
50
50
 
51
51
  await this.waitWorkspaceTitle(workspaceName, timeout);
@@ -55,7 +55,7 @@ export class WorkspaceDetails {
55
55
  await this.waitLoaderDisappearance(timeout);
56
56
  }
57
57
 
58
- async waitWorkspaceTitle(workspaceName: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
58
+ async waitWorkspaceTitle(workspaceName: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
59
59
  Logger.debug(`WorkspaceDetails.waitWorkspaceTitle title: "${workspaceName}"`);
60
60
 
61
61
  const workspaceTitleLocator: By = By.css(this.getWorkspaceTitleCssLocator(workspaceName));
@@ -63,25 +63,25 @@ export class WorkspaceDetails {
63
63
  await this.driverHelper.waitVisibility(workspaceTitleLocator, timeout);
64
64
  }
65
65
 
66
- async waitRunButton(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
66
+ async waitRunButton(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
67
67
  Logger.debug('WorkspaceDetails.waitRunButton');
68
68
 
69
69
  await this.driverHelper.waitVisibility(By.css(WorkspaceDetails.RUN_BUTTON_CSS), timeout);
70
70
  }
71
71
 
72
- async clickOnRunButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT) {
72
+ async clickOnRunButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT): Promise<void> {
73
73
  Logger.debug('WorkspaceDetails.clickOnRunButton');
74
74
 
75
75
  await this.driverHelper.waitAndClick(By.css(WorkspaceDetails.RUN_BUTTON_CSS), timeout);
76
76
  }
77
77
 
78
- async waitOpenButton(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
78
+ async waitOpenButton(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
79
79
  Logger.debug('WorkspaceDetails.waitOpenButton');
80
80
 
81
81
  await this.driverHelper.waitVisibility(By.css(WorkspaceDetails.OPEN_BUTTON_CSS), timeout);
82
82
  }
83
83
 
84
- async openWorkspace(namespace: string, workspaceName: string, timeout: number = TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT) {
84
+ async openWorkspace(namespace: string, workspaceName: string, timeout: number = TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT): Promise<void> {
85
85
  Logger.debug(`WorkspaceDetails.openWorkspace "${namespace}/${workspaceName}"`);
86
86
 
87
87
  await this.clickOnOpenButton(timeout);
@@ -89,7 +89,7 @@ export class WorkspaceDetails {
89
89
  await this.testWorkspaceUtil.waitWorkspaceStatus(namespace, workspaceName, WorkspaceStatus.STARTING);
90
90
  }
91
91
 
92
- async waitTabsPresence(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
92
+ async waitTabsPresence(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
93
93
  Logger.debug('WorkspaceDetails.waitTabsPresence');
94
94
 
95
95
  const workspaceDetailsTabs: Array<string> = ['Overview', 'Projects', 'Containers', 'Servers',
@@ -102,7 +102,7 @@ export class WorkspaceDetails {
102
102
  }
103
103
  }
104
104
 
105
- async selectTab(tabTitle: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
105
+ async selectTab(tabTitle: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
106
106
  Logger.debug(`WorkspaceDetails.selectTab ${tabTitle}`);
107
107
 
108
108
  await this.clickOnTab(tabTitle, timeout);
@@ -121,30 +121,30 @@ export class WorkspaceDetails {
121
121
  return `//md-tabs-canvas[@role='tablist']//md-tab-item[@aria-selected='true']//span[text()='${tabTitle}']`;
122
122
  }
123
123
 
124
- private async waitSaveButton(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
124
+ private async waitSaveButton(timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
125
125
  await this.driverHelper.waitVisibility(By.css(WorkspaceDetails.ENABLED_SAVE_BUTTON_CSS), timeout);
126
126
  }
127
127
 
128
- private async waitSaveButtonDisappearance(attempts: number = TestConstants.TS_SELENIUM_DEFAULT_ATTEMPTS, polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING) {
128
+ private async waitSaveButtonDisappearance(attempts: number = TestConstants.TS_SELENIUM_DEFAULT_ATTEMPTS, polling: number = TestConstants.TS_SELENIUM_DEFAULT_POLLING): Promise<void> {
129
129
  await this.driverHelper.waitDisappearance(By.css(WorkspaceDetails.SAVE_BUTTON_CSS), attempts, polling);
130
130
  }
131
131
 
132
- private async clickOnSaveButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT) {
132
+ private async clickOnSaveButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT): Promise<void> {
133
133
  await this.driverHelper.waitAndClick(By.css(WorkspaceDetails.ENABLED_SAVE_BUTTON_CSS), timeout);
134
134
  }
135
135
 
136
- private async clickOnOpenButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT) {
136
+ private async clickOnOpenButton(timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT): Promise<void> {
137
137
  await this.driverHelper.waitAndClick(By.css(WorkspaceDetails.OPEN_BUTTON_CSS), timeout);
138
138
  }
139
139
 
140
- private async clickOnTab(tabTitle: string, timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT) {
140
+ private async clickOnTab(tabTitle: string, timeout: number = TimeoutConstants.TS_CLICK_DASHBOARD_ITEM_TIMEOUT): Promise<void> {
141
141
  const workspaceDetailsTabLocator: By = By.xpath(this.getTabXpathLocator(tabTitle));
142
142
 
143
143
 
144
144
  await this.driverHelper.waitAndClick(workspaceDetailsTabLocator, timeout);
145
145
  }
146
146
 
147
- private async waitTabSelected(tabTitle: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT) {
147
+ private async waitTabSelected(tabTitle: string, timeout: number = TimeoutConstants.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
148
148
  const selectedTabLocator: By = By.xpath(this.getSelectedTabXpathLocator(tabTitle));
149
149
 
150
150
  await this.driverHelper.waitVisibility(selectedTabLocator, timeout);
@@ -0,0 +1,156 @@
1
+ /*********************************************************************
2
+ * Copyright (c) 2019 Red Hat, Inc.
3
+ *
4
+ * This program and the accompanying materials are made
5
+ * available under the terms of the Eclipse Public License 2.0
6
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
7
+ *
8
+ * SPDX-License-Identifier: EPL-2.0
9
+ **********************************************************************/
10
+ import { inject, injectable } from 'inversify';
11
+ import { By } from 'selenium-webdriver';
12
+ import { CLASSES } from '../../configs/inversify.types';
13
+ import { DriverHelper } from '../../utils/DriverHelper';
14
+ import { GitProviderType, TestConstants } from '../../constants/TestConstants';
15
+ import { Logger } from '../../utils/Logger';
16
+ import { TimeoutConstants } from '../../constants/TimeoutConstants';
17
+
18
+ @injectable()
19
+ export class OauthPage {
20
+ private readonly loginForm: By;
21
+ private readonly passwordForm: By;
22
+ private readonly submitButton: By;
23
+ private readonly approveButton: By;
24
+ private readonly denyAccessButton: By;
25
+
26
+ constructor(@inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) {
27
+ switch (TestConstants.TS_SELENIUM_FACTORY_GIT_PROVIDER) {
28
+ case GitProviderType.BITBUCKET : {
29
+ this.loginForm = By.id('j_username');
30
+ this.passwordForm = By.id('j_password');
31
+ this.approveButton = By.xpath('//*[@id="approve"]');
32
+ this.submitButton = By.xpath('//*[@id="submit"]');
33
+ this.denyAccessButton = By.xpath('//*[@id="deny"]');
34
+ }
35
+ break;
36
+ case GitProviderType.GITLAB: {
37
+ this.loginForm = TestConstants.TS_SELENIUM_GIT_PROVIDER_IS_LDAP_LOGIN ? By.id('username') : By.id('user_login');
38
+ this.passwordForm = TestConstants.TS_SELENIUM_GIT_PROVIDER_IS_LDAP_LOGIN ? By.id('password') : By.id('user_password');
39
+ this.submitButton = TestConstants.TS_SELENIUM_GIT_PROVIDER_IS_LDAP_LOGIN ? By.xpath('//input[@data-qa-selector="sign_in_button"]') : By.xpath('//button[@data-qa-selector="sign_in_button"]');
40
+ this.approveButton = By.xpath('//*[@value="Authorize"]');
41
+ this.denyAccessButton = By.xpath('//input[@value="Deny"]');
42
+ }
43
+ break;
44
+ case GitProviderType.GITHUB: {
45
+ this.loginForm = By.id('login_field');
46
+ this.passwordForm = By.id('password');
47
+ this.approveButton = By.xpath('//*[@id="js-oauth-authorize-btn"]');
48
+ this.submitButton = By.xpath('//*[@value="Sign in"]');
49
+ this.denyAccessButton = By.xpath('//button[contains(., "Cancel")]');
50
+ }
51
+ break;
52
+ default: {
53
+ throw new Error(`Invalid git provider. The value should be ${GitProviderType.GITHUB}, ${GitProviderType.GITLAB} or ${GitProviderType.BITBUCKET}`);
54
+ }
55
+ }
56
+ }
57
+
58
+ async waitLoginPage(): Promise<void> {
59
+ Logger.debug('OauthPage.waitLoginPage');
60
+
61
+ // for gitlab server https://gitlab.cee.redhat.com
62
+ if (!TestConstants.TS_SELENIUM_GIT_PROVIDER_IS_LDAP_LOGIN &&
63
+ TestConstants.TS_SELENIUM_FACTORY_GIT_PROVIDER === GitProviderType.GITLAB) {
64
+ {
65
+ Logger.debug(`OauthPage.login - go to ${TestConstants.TS_SELENIUM_FACTORY_GIT_PROVIDER} Standard login section`);
66
+ await this.driverHelper.waitAndClick(By.xpath('//a[@data-qa-selector="standard_tab"]'));
67
+ }
68
+ }
69
+
70
+ await this.driverHelper.waitVisibility(this.loginForm, TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM * 3);
71
+ }
72
+
73
+ async enterUserName(userName: string): Promise<void> {
74
+ Logger.debug(`this.enterUserName "${userName}"`);
75
+
76
+ await this.driverHelper.enterValue(this.loginForm, userName);
77
+ }
78
+
79
+ async enterPassword(password: string): Promise<void> {
80
+ Logger.debug(`OauthPage.enterPassword`);
81
+
82
+ await this.driverHelper.enterValue(this.passwordForm, password);
83
+ }
84
+
85
+ async clickOnLoginButton(): Promise<void> {
86
+ Logger.debug('OauthPage.clickOnLoginButton');
87
+
88
+ await this.driverHelper.waitAndClick(this.submitButton);
89
+ }
90
+
91
+ async waitClosingLoginPage(): Promise<void> {
92
+ Logger.debug('OauthPage.waitClosingLoginPage');
93
+
94
+ await this.driverHelper.waitDisappearance(this.loginForm);
95
+ }
96
+
97
+ async waitOauthPage(): Promise<void> {
98
+ Logger.debug('OauthPage.waitOauthPage');
99
+
100
+ await this.driverHelper.waitVisibility(this.approveButton);
101
+ }
102
+
103
+ async clickOnApproveButton(): Promise<void> {
104
+ Logger.debug('OauthPage.clickOnApproveButton');
105
+
106
+ await this.driverHelper.waitAndClick(this.approveButton);
107
+ }
108
+
109
+ async clickOnDenyAccessButton(): Promise<void> {
110
+ Logger.debug('OauthPage.clickOnDenyAccessButton');
111
+
112
+ await this.driverHelper.waitAndClick(this.denyAccessButton);
113
+ }
114
+
115
+ async waitDisappearanceOauthPage(): Promise<void> {
116
+ Logger.debug('OauthPage.waitDisappearanceOauthPage');
117
+
118
+ await this.driverHelper.waitDisappearance(this.approveButton);
119
+ }
120
+
121
+ async login(): Promise<void> {
122
+ Logger.debug('OauthPage.login');
123
+
124
+ await this.waitLoginPage();
125
+ await this.enterUserName(TestConstants.TS_SELENIUM_GIT_PROVIDER_USERNAME);
126
+ await this.enterPassword(TestConstants.TS_SELENIUM_GIT_PROVIDER_PASSWORD);
127
+ await this.clickOnLoginButton();
128
+ await this.waitClosingLoginPage();
129
+ }
130
+
131
+ async confirmAccess(): Promise<void> {
132
+ Logger.debug('OauthPage.confirmAccess');
133
+
134
+ try {
135
+ await this.clickOnApproveButton();
136
+ await this.waitDisappearanceOauthPage();
137
+ } catch (e) {
138
+ Logger.debug('OauthPage.confirmAccess - access was not confirmed, retrying to click conformation button');
139
+ // workaround for github oauth conformation page (bot security)
140
+ await this.driverHelper.getAction()
141
+ .move({
142
+ origin: await this.driverHelper.waitPresence(this.approveButton)
143
+ })
144
+ .click()
145
+ .perform();
146
+ await this.waitDisappearanceOauthPage();
147
+ }
148
+ }
149
+
150
+ async denyAccess(): Promise<void> {
151
+ Logger.debug('OauthPage.denyAccess');
152
+
153
+ await this.clickOnDenyAccessButton();
154
+ await this.waitDisappearanceOauthPage();
155
+ }
156
+ }
@@ -0,0 +1,69 @@
1
+ /*********************************************************************
2
+ * Copyright (c) 2019 Red Hat, Inc.
3
+ *
4
+ * This program and the accompanying materials are made
5
+ * available under the terms of the Eclipse Public License 2.0
6
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
7
+ *
8
+ * SPDX-License-Identifier: EPL-2.0
9
+ **********************************************************************/
10
+ import { LocatorLoader } from 'monaco-page-objects/out/locators/loader';
11
+ import { getLocatorsPath } from 'vscode-extension-tester-locators';
12
+ import { LocatorDiff, Locators } from 'monaco-page-objects';
13
+ import { By } from 'selenium-webdriver';
14
+ import clone from 'clone-deep';
15
+ import { TestConstants } from '../../constants/TestConstants';
16
+
17
+ /**
18
+ * This class allows us to change or add some specific locators base on "monaco-page-object" and "vscode-extension-tester-locators".
19
+ * Use method webLocatorDiff(). To change place locator into field "locators", to add - "extras".
20
+ * To see full locators list check "node_modules/vscode-extension-tester-locators/out/lib".
21
+ */
22
+
23
+ export class CheCodeLocatorLoader extends LocatorLoader {
24
+ readonly webCheCodeLocators: Locators;
25
+
26
+ constructor() {
27
+ super(TestConstants.TS_SELENIUM_MONACO_PAGE_OBJECTS_BASE_VERSION, TestConstants.TS_SELENIUM_MONACO_PAGE_OBJECTS_BASE_VERSION, getLocatorsPath());
28
+ this.webCheCodeLocators = this.mergeLocators() as Locators;
29
+ }
30
+
31
+ private webLocatorDiff(): LocatorDiff {
32
+ return {
33
+ locators: {
34
+ WelcomeContent: {
35
+ text: By.xpath('//*[@class="dialog-message-text" and contains(text(), "trust")]'),
36
+ button: By.xpath('//a[contains(., "trust")]')
37
+ },
38
+ },
39
+ };
40
+ }
41
+
42
+ private merge(target: any, obj: any): object {
43
+ for (const key in obj) {
44
+ if (!Object.prototype.hasOwnProperty.call(obj, key)) {
45
+ continue;
46
+ }
47
+
48
+ let oldVal: any = obj[key];
49
+ let newVal: any = target[key];
50
+
51
+ if (typeof (newVal) === 'object' && typeof (oldVal) === 'object') {
52
+ target[key] = this.merge(newVal, oldVal);
53
+ } else {
54
+ target[key] = clone(oldVal);
55
+ }
56
+ }
57
+ return target;
58
+ }
59
+
60
+ private mergeLocators(): Locators {
61
+ const target: Locators = super.loadLocators();
62
+
63
+ this.merge(target, this.webLocatorDiff().locators as Locators);
64
+ this.merge(target, this.webLocatorDiff().extras as Locators);
65
+
66
+ return target;
67
+ }
68
+ }
69
+
@@ -0,0 +1,49 @@
1
+ /*********************************************************************
2
+ * Copyright (c) 2019 Red Hat, Inc.
3
+ *
4
+ * This program and the accompanying materials are made
5
+ * available under the terms of the Eclipse Public License 2.0
6
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
7
+ *
8
+ * SPDX-License-Identifier: EPL-2.0
9
+ **********************************************************************/
10
+ import 'reflect-metadata';
11
+ import { injectable, inject } from 'inversify';
12
+ import { RedHatLoginPage } from './RedHatLoginPage';
13
+ import { CLASSES } from '../../configs/inversify.types';
14
+ import { By } from 'selenium-webdriver';
15
+ import { TimeoutConstants } from '../../constants/TimeoutConstants';
16
+ import { ICheLoginPage } from './ICheLoginPage';
17
+ import { OcpLoginPage } from '../openshift/OcpLoginPage';
18
+ import { DriverHelper } from '../../utils/DriverHelper';
19
+ import { Logger } from '../../utils/Logger';
20
+
21
+ @injectable()
22
+ export class OcpRedHatLoginPage implements ICheLoginPage {
23
+
24
+ private readonly OPEN_SHIFT_LOGIN_LANDING_PAGE_LOCATOR: string = `//div[@class='panel-login']`;
25
+ private readonly OPEN_SHIFT_LOGIN_LANDING_PAGE_BUTTON_LOCATOR: string = `${this.OPEN_SHIFT_LOGIN_LANDING_PAGE_LOCATOR}/div[contains(@class, 'panel-content')]/form/button`;
26
+
27
+ constructor(
28
+ @inject(CLASSES.OcpLoginPage) private readonly ocpLogin: OcpLoginPage,
29
+ @inject(CLASSES.RedHatLoginPage) private readonly redHatLogin: RedHatLoginPage,
30
+ @inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { }
31
+
32
+ async login(): Promise<void> {
33
+ Logger.debug('OcpRedHatLoginPage.login');
34
+
35
+ Logger.debug('OcpRedHatLoginPage.login wait for LogInWithOpenShift page and click button');
36
+ await this.driverHelper.waitPresence(By.xpath(this.OPEN_SHIFT_LOGIN_LANDING_PAGE_LOCATOR), TimeoutConstants.TS_SELENIUM_LOAD_PAGE_TIMEOUT);
37
+ await this.driverHelper.waitAndClick(By.xpath(this.OPEN_SHIFT_LOGIN_LANDING_PAGE_BUTTON_LOCATOR));
38
+
39
+ await this.ocpLogin.isIdentityProviderLinkVisible();
40
+ await this.ocpLogin.clickOnLoginProviderTitle();
41
+
42
+ await this.redHatLogin.waitRedHatLoginWelcomePage();
43
+ await this.redHatLogin.enterUserNameRedHat();
44
+ await this.redHatLogin.clickNextButton();
45
+ await this.redHatLogin.enterPasswordRedHat();
46
+ await this.redHatLogin.clickOnLoginButton();
47
+ await this.redHatLogin.waitDisappearanceRedHatLoginWelcomePage();
48
+ }
49
+ }
@@ -21,7 +21,7 @@ export class OcpUserLoginPage implements IOcpLoginPage {
21
21
  constructor(
22
22
  @inject(CLASSES.OcpLoginPage) private readonly ocpLogin: OcpLoginPage) { }
23
23
 
24
- async login() {
24
+ async login(): Promise<void> {
25
25
  Logger.debug('OcpUserLoginPage.login');
26
26
 
27
27
  if (TestConstants.TS_OCP_LOGIN_PAGE_PROVIDER_TITLE !== '') {
@@ -0,0 +1,62 @@
1
+ /*********************************************************************
2
+ * Copyright (c) 2019 Red Hat, Inc.
3
+ *
4
+ * This program and the accompanying materials are made
5
+ * available under the terms of the Eclipse Public License 2.0
6
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
7
+ *
8
+ * SPDX-License-Identifier: EPL-2.0
9
+ **********************************************************************/
10
+ import 'reflect-metadata';
11
+ import { injectable, inject } from 'inversify';
12
+ import { By } from 'selenium-webdriver';
13
+ import { CLASSES } from '../../configs/inversify.types';
14
+ import { DriverHelper } from '../../utils/DriverHelper';
15
+ import { Logger } from '../../utils/Logger';
16
+ import { TestConstants } from '../../constants/TestConstants';
17
+
18
+ const USERNAME_INPUT_ID: string = 'username-verification';
19
+ const PASSWORD_INPUT_ID: string = 'password';
20
+ const NEXT_BUTTON_ID: string = 'login-show-step2';
21
+ const LOGIN_BUTTON_ID: string = 'rh-password-verification-submit-button';
22
+ const timeout: number = 10000;
23
+
24
+ @injectable()
25
+ export class RedHatLoginPage {
26
+
27
+ constructor(
28
+ @inject(CLASSES.DriverHelper) private readonly driverHelper: DriverHelper) { }
29
+
30
+ async waitRedHatLoginWelcomePage(): Promise<void> {
31
+ Logger.debug('RedHatLoginPage.waitRedHatLoginWelcomePage');
32
+ await this.driverHelper.waitVisibility(By.id(USERNAME_INPUT_ID));
33
+ }
34
+
35
+ async enterPasswordRedHat(): Promise<void> {
36
+ Logger.debug('RedHatLoginPage.enterPasswordRedHat');
37
+ const passwordFieldLocator: By = By.id(PASSWORD_INPUT_ID);
38
+ await this.driverHelper.waitVisibility(passwordFieldLocator, 3000);
39
+ await this.driverHelper.enterValue(passwordFieldLocator, TestConstants.TS_SELENIUM_PASSWORD, timeout );
40
+ }
41
+ async clickOnLoginButton(): Promise<void> {
42
+ Logger.debug('RedHatLoginPage.clickOnLoginButton');
43
+ const loginButtonLocator: By = By.id(LOGIN_BUTTON_ID);
44
+ await this.driverHelper.waitAndClick(loginButtonLocator, timeout);
45
+ }
46
+ async waitDisappearanceRedHatLoginWelcomePage(): Promise<void> {
47
+ Logger.debug('RedHatLoginPage.waitDisappearanceRedHatLoginWelcomePage');
48
+ await this.driverHelper.waitDisappearance(By.id(LOGIN_BUTTON_ID));
49
+ }
50
+ async enterUserNameRedHat(): Promise<void> {
51
+ Logger.debug('RedHatLoginPage.enterUserNameRedHat');
52
+ const usernameFieldLocator: By = By.id(USERNAME_INPUT_ID);
53
+ await this.driverHelper.waitVisibility(usernameFieldLocator, 20000);
54
+ await this.driverHelper.enterValue(usernameFieldLocator, TestConstants.TS_SELENIUM_USERNAME, timeout );
55
+ }
56
+
57
+ async clickNextButton(): Promise<void> {
58
+ Logger.debug('RedHatLoginPage.clickNextButton');
59
+ const nextButtonLocator: By = By.id(NEXT_BUTTON_ID);
60
+ await this.driverHelper.waitAndClick(nextButtonLocator, timeout);
61
+ }
62
+ }