@eclipse-che/che-e2e 7.75.0-next-b6eb83e → 7.75.0-next-17b7a3e
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/.eslintrc.js +1 -1
- package/README.md +1 -0
- package/configs/mocharc.ts +2 -1
- package/configs/reporters-config.json +6 -0
- package/constants/BASE_TEST_CONSTANTS.ts +16 -0
- package/constants/PLUGIN_TEST_CONSTANTS.ts +3 -1
- package/constants/TIMEOUT_CONSTANTS.ts +8 -2
- package/dist/configs/mocharc.js +2 -1
- package/dist/configs/mocharc.js.map +1 -1
- package/dist/constants/BASE_TEST_CONSTANTS.js +12 -0
- package/dist/constants/BASE_TEST_CONSTANTS.js.map +1 -1
- package/dist/constants/PLUGIN_TEST_CONSTANTS.js +2 -1
- package/dist/constants/PLUGIN_TEST_CONSTANTS.js.map +1 -1
- package/dist/constants/TIMEOUT_CONSTANTS.js +6 -2
- package/dist/constants/TIMEOUT_CONSTANTS.js.map +1 -1
- package/dist/pageobjects/dashboard/CreateWorkspace.js +2 -2
- package/dist/pageobjects/dashboard/Dashboard.js +43 -0
- package/dist/pageobjects/dashboard/Dashboard.js.map +1 -1
- package/dist/pageobjects/dashboard/Workspaces.js +10 -2
- package/dist/pageobjects/dashboard/Workspaces.js.map +1 -1
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js +24 -24
- package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js.map +1 -1
- package/dist/pageobjects/ide/CheCodeLocatorLoader.js +1 -1
- package/dist/pageobjects/ide/CheCodeLocatorLoader.js.map +1 -1
- package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js +0 -4
- package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js.map +1 -1
- package/dist/specs/MochaHooks.js +16 -4
- package/dist/specs/MochaHooks.js.map +1 -1
- package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js +3 -6
- package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js.map +1 -1
- package/dist/specs/api/EmptyWorkspaceAPI.spec.js +1 -2
- package/dist/specs/api/EmptyWorkspaceAPI.spec.js.map +1 -1
- package/dist/specs/dashboard-samples/Documentation.spec.js +105 -0
- package/dist/specs/dashboard-samples/Documentation.spec.js.map +1 -0
- package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js +67 -73
- package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js.map +1 -1
- package/dist/specs/factory/Factory.spec.js +1 -5
- package/dist/specs/factory/Factory.spec.js.map +1 -1
- package/dist/specs/factory/NoSetupRepoFactory.spec.js +1 -24
- package/dist/specs/factory/NoSetupRepoFactory.spec.js.map +1 -1
- package/dist/specs/factory/RefusedOAuthFactory.spec.js +1 -24
- package/dist/specs/factory/RefusedOAuthFactory.spec.js.map +1 -1
- package/dist/specs/miscellaneous/WorkpaseUsingParent.spec.js +2 -2
- package/dist/specs/miscellaneous/WorkpaseUsingParent.spec.js.map +1 -1
- package/dist/tests-library/ProjectAndFileTests.js +10 -14
- package/dist/tests-library/ProjectAndFileTests.js.map +1 -1
- package/dist/tests-library/WorkspaceHandlingTests.js +1 -1
- package/dist/tests-library/WorkspaceHandlingTests.js.map +1 -1
- package/dist/utils/BrowserTabsUtil.js +2 -1
- package/dist/utils/BrowserTabsUtil.js.map +1 -1
- package/dist/utils/DevWorkspaceConfigurationHelper.js +4 -1
- package/dist/utils/DevWorkspaceConfigurationHelper.js.map +1 -1
- package/dist/utils/DevfilesRegistryHelper.js +1 -1
- package/dist/utils/DevfilesRegistryHelper.js.map +1 -1
- package/dist/utils/DriverHelper.js +3 -3
- package/dist/utils/DriverHelper.js.map +1 -1
- package/dist/utils/workspace/TestWorkspaceUtil.js +2 -3
- package/dist/utils/workspace/TestWorkspaceUtil.js.map +1 -1
- package/package.json +8 -1
- package/pageobjects/dashboard/CreateWorkspace.ts +2 -2
- package/pageobjects/dashboard/Dashboard.ts +63 -1
- package/pageobjects/dashboard/Workspaces.ts +13 -2
- package/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts +32 -27
- package/pageobjects/ide/CheCodeLocatorLoader.ts +1 -1
- package/pageobjects/login/openshift/RegularUserOcpCheLoginPage.ts +0 -4
- package/resources/default-devfile.yaml +27 -0
- package/specs/MochaHooks.ts +15 -2
- package/specs/dashboard-samples/Documentation.spec.ts +134 -0
- package/specs/dashboard-samples/RecommendedExtensions.spec.ts +64 -71
- package/specs/factory/Factory.spec.ts +1 -6
- package/specs/factory/NoSetupRepoFactory.spec.ts +1 -26
- package/specs/factory/RefusedOAuthFactory.spec.ts +1 -26
- package/tests-library/ProjectAndFileTests.ts +17 -15
- package/tests-library/WorkspaceHandlingTests.ts +1 -1
- package/tsconfig.json +2 -2
- package/utils/BrowserTabsUtil.ts +5 -1
- package/utils/DriverHelper.ts +2 -2
|
@@ -26,12 +26,22 @@ export class Dashboard {
|
|
|
26
26
|
private static readonly LOADER_ALERT: By = By.xpath('//*[@data-testid="loader-alert"]');
|
|
27
27
|
private static readonly LOGOUT_BUTTON: By = By.xpath('//button[text()="Logout"]');
|
|
28
28
|
private static readonly USER_SETTINGS_DROPDOWN: By = By.xpath('//header//button/span[text()!=""]//parent::button');
|
|
29
|
+
private static readonly INFO_DROPDOWN_BUTTON: By = By.xpath('//button[@aria-label="About Menu"]');
|
|
30
|
+
private static readonly ABOUT_DIALOG_WINDOW_CLOSE_BUTTON: By = By.xpath('//button[@aria-label="Close Dialog"]');
|
|
29
31
|
private static readonly EXISTING_WORKSPACE_FOUND_ALERT: By = By.xpath('//h4[text()="Existing workspace found"]');
|
|
30
32
|
private static readonly CREATE_NEW_WORKSPACE_LINK: By = By.xpath('//button[text()="Create a new workspace"]');
|
|
33
|
+
private static readonly ABOUT_DIALOG_ITEM_DATA_TEST_IDS: any = {
|
|
34
|
+
serverVersion: 'server-version',
|
|
35
|
+
dashboardVersion: 'dashboard-version',
|
|
36
|
+
browserName: 'browser-name',
|
|
37
|
+
browserOs: 'browser-os',
|
|
38
|
+
browserVersion: 'browser-version',
|
|
39
|
+
username: 'username'
|
|
40
|
+
};
|
|
31
41
|
|
|
32
42
|
constructor(
|
|
33
43
|
@inject(CLASSES.DriverHelper)
|
|
34
|
-
|
|
44
|
+
readonly driverHelper: DriverHelper,
|
|
35
45
|
@inject(CLASSES.Workspaces) private readonly workspaces: Workspaces
|
|
36
46
|
) {}
|
|
37
47
|
|
|
@@ -71,6 +81,44 @@ export class Dashboard {
|
|
|
71
81
|
await this.waitPage();
|
|
72
82
|
}
|
|
73
83
|
|
|
84
|
+
async openAboutMenu(): Promise<void> {
|
|
85
|
+
Logger.debug();
|
|
86
|
+
|
|
87
|
+
await this.driverHelper.waitAndClick(Dashboard.INFO_DROPDOWN_BUTTON);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
async selectAboutMenuItem(text: string): Promise<void> {
|
|
91
|
+
Logger.debug();
|
|
92
|
+
|
|
93
|
+
await this.driverHelper.waitAndClick(this.getAboutMenuItemButtonLocator(text));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async waitAboutDialogWindowMenuElements(timeout: number = TIMEOUT_CONSTANTS.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
|
|
97
|
+
Logger.debug();
|
|
98
|
+
|
|
99
|
+
for (const testId of Object.values(Dashboard.ABOUT_DIALOG_ITEM_DATA_TEST_IDS)) {
|
|
100
|
+
const workspaceDetailsTabLocator: By = this.getAboutDialogWindowItemLocator(<string>testId);
|
|
101
|
+
|
|
102
|
+
await this.driverHelper.waitVisibility(workspaceDetailsTabLocator, timeout);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async getApplicationVersionFromAboutDialogWindow(): Promise<string> {
|
|
107
|
+
Logger.debug();
|
|
108
|
+
|
|
109
|
+
return await this.driverHelper.waitAndGetText(
|
|
110
|
+
this.getAboutDialogWindowItemLocator(Dashboard.ABOUT_DIALOG_ITEM_DATA_TEST_IDS.serverVersion)
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
async getUsernameFromAboutDialogWindow(): Promise<string> {
|
|
115
|
+
Logger.debug();
|
|
116
|
+
|
|
117
|
+
return await this.driverHelper.waitAndGetText(
|
|
118
|
+
this.getAboutDialogWindowItemLocator(Dashboard.ABOUT_DIALOG_ITEM_DATA_TEST_IDS.username)
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
74
122
|
async waitPage(timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_LOAD_PAGE_TIMEOUT): Promise<void> {
|
|
75
123
|
Logger.debug();
|
|
76
124
|
|
|
@@ -109,6 +157,12 @@ export class Dashboard {
|
|
|
109
157
|
await this.driverHelper.wait(TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING);
|
|
110
158
|
}
|
|
111
159
|
|
|
160
|
+
async closeAboutDialogWindow(): Promise<void> {
|
|
161
|
+
Logger.debug();
|
|
162
|
+
|
|
163
|
+
await this.driverHelper.waitAndClick(Dashboard.ABOUT_DIALOG_WINDOW_CLOSE_BUTTON);
|
|
164
|
+
}
|
|
165
|
+
|
|
112
166
|
async waitExistingWorkspaceFoundAlert(timeout: number = TIMEOUT_CONSTANTS.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
|
|
113
167
|
Logger.debug();
|
|
114
168
|
|
|
@@ -129,4 +183,12 @@ export class Dashboard {
|
|
|
129
183
|
await this.driverHelper.waitAndClick(Dashboard.LOGOUT_BUTTON, timeout);
|
|
130
184
|
await this.driverHelper.waitDisappearance(Dashboard.USER_SETTINGS_DROPDOWN, timeout);
|
|
131
185
|
}
|
|
186
|
+
|
|
187
|
+
private getAboutMenuItemButtonLocator(text: string): By {
|
|
188
|
+
return By.xpath(`//li/button[text()="${text}"]`);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
private getAboutDialogWindowItemLocator(itemDataTestId: string): By {
|
|
192
|
+
return By.xpath(`//dd[@data-testid="${itemDataTestId}"]`);
|
|
193
|
+
}
|
|
132
194
|
}
|
|
@@ -29,6 +29,7 @@ export class Workspaces {
|
|
|
29
29
|
);
|
|
30
30
|
private static readonly DELETE_CONFIRMATION_CHECKBOX: By = By.xpath('//input[@data-testid="confirmation-checkbox"]');
|
|
31
31
|
private static readonly CONFIRMATION_WINDOW: By = By.xpath('//div[@aria-label="Delete workspaces confirmation window"]');
|
|
32
|
+
private static readonly LEARN_MORE_DOC_LINK: By = By.xpath('//div/p/a');
|
|
32
33
|
|
|
33
34
|
constructor(
|
|
34
35
|
@inject(CLASSES.DriverHelper)
|
|
@@ -80,13 +81,13 @@ export class Workspaces {
|
|
|
80
81
|
await this.driverHelper.waitVisibility(this.getWorkspaceStatusLocator(workspaceName, WorkspaceStatusUI.Stopped), timeout);
|
|
81
82
|
}
|
|
82
83
|
|
|
83
|
-
async
|
|
84
|
+
async clickWorkspaceListItemLink(
|
|
84
85
|
workspaceName: string,
|
|
85
86
|
timeout: number = TIMEOUT_CONSTANTS.TS_CLICK_DASHBOARD_ITEM_TIMEOUT
|
|
86
87
|
): Promise<void> {
|
|
87
88
|
Logger.debug(`"${workspaceName}"`);
|
|
88
89
|
|
|
89
|
-
await this.driverHelper.waitAndClick(this.
|
|
90
|
+
await this.driverHelper.waitAndClick(this.getOpenWorkspaceDetailsLinkLocator(workspaceName), timeout);
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
async clickActionsButton(workspaceName: string): Promise<void> {
|
|
@@ -206,6 +207,12 @@ export class Workspaces {
|
|
|
206
207
|
return workspaceNames;
|
|
207
208
|
}
|
|
208
209
|
|
|
210
|
+
async getLearnMoreDocumentationLink(): Promise<string> {
|
|
211
|
+
Logger.debug();
|
|
212
|
+
|
|
213
|
+
return await this.driverHelper.waitAndGetElementAttribute(Workspaces.LEARN_MORE_DOC_LINK, 'href');
|
|
214
|
+
}
|
|
215
|
+
|
|
209
216
|
private getWorkspaceListItemLocator(workspaceName: string): By {
|
|
210
217
|
return By.xpath(`//tr[td//a[text()='${workspaceName}']]`);
|
|
211
218
|
}
|
|
@@ -235,4 +242,8 @@ export class Workspaces {
|
|
|
235
242
|
private getOpenButtonLocator(workspaceName: string): By {
|
|
236
243
|
return By.xpath(`${this.getWorkspaceListItemLocator(workspaceName).value}//td[@data-key=5]//a[text()='Open']`);
|
|
237
244
|
}
|
|
245
|
+
|
|
246
|
+
private getOpenWorkspaceDetailsLinkLocator(workspaceName: string): By {
|
|
247
|
+
return By.xpath(`${this.getWorkspaceListItemLocator(workspaceName).value}//a[text()='${workspaceName}']`);
|
|
248
|
+
}
|
|
238
249
|
}
|
|
@@ -25,6 +25,10 @@ export class WorkspaceDetails {
|
|
|
25
25
|
private static readonly SAVE_BUTTON: By = By.css('button[name="save-button"]');
|
|
26
26
|
private static readonly ENABLED_SAVE_BUTTON: By = By.css('button[name="save-button"][aria-disabled="false"]');
|
|
27
27
|
private static readonly WORKSPACE_DETAILS_LOADER: By = By.css('workspace-details-overview md-progress-linear');
|
|
28
|
+
private static readonly STORAGE_TYPE_INFO_BUTTON: By = By.xpath('//label[@for="storage-type"]//following-sibling::button');
|
|
29
|
+
private static readonly CLOSE_STORAGE_TYPE_INFO_BUTTON: By = By.xpath('//button[@aria-label="Close"]');
|
|
30
|
+
private static readonly STORAGE_TYPE_DOC_LINK: By = By.xpath('//div/p/a');
|
|
31
|
+
private static readonly DEVFILE_DOC_LINK: By = By.xpath('//a[text()="Devfile Documentation"]');
|
|
28
32
|
|
|
29
33
|
constructor(
|
|
30
34
|
@inject(CLASSES.DriverHelper)
|
|
@@ -101,20 +105,9 @@ export class WorkspaceDetails {
|
|
|
101
105
|
}
|
|
102
106
|
|
|
103
107
|
async waitTabsPresence(timeout: number = TIMEOUT_CONSTANTS.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
|
|
104
|
-
Logger.debug(
|
|
105
|
-
|
|
106
|
-
const workspaceDetailsTabs: Array<string> = [
|
|
107
|
-
'Overview',
|
|
108
|
-
'Projects',
|
|
109
|
-
'Containers',
|
|
110
|
-
'Servers',
|
|
111
|
-
'Env Variables',
|
|
112
|
-
'Volumes',
|
|
113
|
-
'Config',
|
|
114
|
-
'SSH',
|
|
115
|
-
'Plugins',
|
|
116
|
-
'Editors'
|
|
117
|
-
];
|
|
108
|
+
Logger.debug();
|
|
109
|
+
|
|
110
|
+
const workspaceDetailsTabs: Array<string> = ['Overview', 'Devfile', 'DevWorkspace', 'Logs', 'Events'];
|
|
118
111
|
|
|
119
112
|
for (const tabTitle of workspaceDetailsTabs) {
|
|
120
113
|
const workspaceDetailsTabLocator: By = this.getTabLocator(tabTitle);
|
|
@@ -124,22 +117,39 @@ export class WorkspaceDetails {
|
|
|
124
117
|
}
|
|
125
118
|
|
|
126
119
|
async selectTab(tabTitle: string, timeout: number = TIMEOUT_CONSTANTS.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
|
|
127
|
-
Logger.debug(
|
|
120
|
+
Logger.debug(`${tabTitle}`);
|
|
128
121
|
|
|
129
122
|
await this.clickOnTab(tabTitle, timeout);
|
|
130
|
-
await this.waitTabSelected(tabTitle, timeout);
|
|
131
123
|
}
|
|
132
124
|
|
|
133
|
-
|
|
134
|
-
|
|
125
|
+
async clickStorageTypeInfo(): Promise<void> {
|
|
126
|
+
Logger.debug();
|
|
127
|
+
|
|
128
|
+
await this.driverHelper.waitAndClick(WorkspaceDetails.STORAGE_TYPE_INFO_BUTTON);
|
|
135
129
|
}
|
|
136
130
|
|
|
137
|
-
|
|
138
|
-
|
|
131
|
+
async getOpenStorageTypeDocumentationLink(): Promise<string> {
|
|
132
|
+
Logger.debug();
|
|
133
|
+
|
|
134
|
+
return await this.driverHelper.waitAndGetElementAttribute(WorkspaceDetails.STORAGE_TYPE_DOC_LINK, 'href');
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
async closeStorageTypeInfo(): Promise<void> {
|
|
138
|
+
Logger.debug();
|
|
139
|
+
|
|
140
|
+
await this.driverHelper.waitAndClick(WorkspaceDetails.CLOSE_STORAGE_TYPE_INFO_BUTTON);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
async getDevfileDocumentationLink(): Promise<string> {
|
|
144
|
+
return await this.driverHelper.waitAndGetElementAttribute(WorkspaceDetails.DEVFILE_DOC_LINK, 'href');
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
private getWorkspaceTitleLocator(workspaceName: string): By {
|
|
148
|
+
return By.xpath(`//h1[text()='${workspaceName}']`);
|
|
139
149
|
}
|
|
140
150
|
|
|
141
|
-
private
|
|
142
|
-
return By.xpath(`//
|
|
151
|
+
private getTabLocator(tabTitle: string): By {
|
|
152
|
+
return By.xpath(`//button[contains(@id,'${tabTitle}')]`);
|
|
143
153
|
}
|
|
144
154
|
|
|
145
155
|
private async waitSaveButton(timeout: number = TIMEOUT_CONSTANTS.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
|
|
@@ -165,9 +175,4 @@ export class WorkspaceDetails {
|
|
|
165
175
|
const workspaceDetailsTabLocator: By = this.getTabLocator(tabTitle);
|
|
166
176
|
await this.driverHelper.waitAndClick(workspaceDetailsTabLocator, timeout);
|
|
167
177
|
}
|
|
168
|
-
|
|
169
|
-
private async waitTabSelected(tabTitle: string, timeout: number = TIMEOUT_CONSTANTS.TS_COMMON_DASHBOARD_WAIT_TIMEOUT): Promise<void> {
|
|
170
|
-
const selectedTabLocator: By = this.getSelectedTabLocator(tabTitle);
|
|
171
|
-
await this.driverHelper.waitVisibility(selectedTabLocator, timeout);
|
|
172
|
-
}
|
|
173
178
|
}
|
|
@@ -39,7 +39,7 @@ export class CheCodeLocatorLoader extends LocatorLoader {
|
|
|
39
39
|
locators: {
|
|
40
40
|
WelcomeContent: {
|
|
41
41
|
text: By.xpath('//*[@class="dialog-message-text" and contains(text(), "trust")]'),
|
|
42
|
-
button: By.xpath('//a[
|
|
42
|
+
button: By.xpath('//div[@class="monaco-dialog-box"]//a[@class="monaco-button monaco-text-button"]')
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
extras: {
|
|
@@ -30,10 +30,6 @@ export class RegularUserOcpCheLoginPage implements ICheLoginPage {
|
|
|
30
30
|
private readonly driverHelper: DriverHelper
|
|
31
31
|
) {}
|
|
32
32
|
|
|
33
|
-
/**
|
|
34
|
-
* @param userName
|
|
35
|
-
* @param password
|
|
36
|
-
*/
|
|
37
33
|
async login(
|
|
38
34
|
userName: string = OAUTH_CONSTANTS.TS_SELENIUM_OCP_USERNAME,
|
|
39
35
|
password: string = OAUTH_CONSTANTS.TS_SELENIUM_OCP_PASSWORD
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
kind: DevWorkspace
|
|
2
|
+
apiVersion: workspace.devfile.io/v1alpha2
|
|
3
|
+
metadata:
|
|
4
|
+
name: default
|
|
5
|
+
spec:
|
|
6
|
+
started: true
|
|
7
|
+
template:
|
|
8
|
+
projects:
|
|
9
|
+
- name: web-nodejs-sample
|
|
10
|
+
git:
|
|
11
|
+
remotes:
|
|
12
|
+
origin: "https://github.com/che-samples/web-nodejs-sample.git"
|
|
13
|
+
commands:
|
|
14
|
+
- id: say-hello
|
|
15
|
+
exec:
|
|
16
|
+
component: che-code-runtime-description
|
|
17
|
+
commandLine: echo "Hello from $(pwd)"
|
|
18
|
+
workingDir: ${PROJECT_SOURCE}/app
|
|
19
|
+
contributions:
|
|
20
|
+
- name: che-code
|
|
21
|
+
uri: https://eclipse-che.github.io/che-plugin-registry/main/v3/plugins/che-incubator/che-code/latest/devfile.yaml
|
|
22
|
+
components:
|
|
23
|
+
- name: che-code-runtime-description
|
|
24
|
+
container:
|
|
25
|
+
env:
|
|
26
|
+
- name: CODE_HOST
|
|
27
|
+
value: 0.0.0.0
|
package/specs/MochaHooks.ts
CHANGED
|
@@ -18,15 +18,17 @@ import { e2eContainer } from '../configs/inversify.config';
|
|
|
18
18
|
import { DriverHelper } from '../utils/DriverHelper';
|
|
19
19
|
import { ITestWorkspaceUtil } from '../utils/workspace/ITestWorkspaceUtil';
|
|
20
20
|
import { Logger } from '../utils/Logger';
|
|
21
|
+
import { allure } from 'allure-mocha/runtime';
|
|
21
22
|
import { BASE_TEST_CONSTANTS } from '../constants/BASE_TEST_CONSTANTS';
|
|
22
|
-
import { CHROME_DRIVER_CONSTANTS } from '../constants/CHROME_DRIVER_CONSTANTS';
|
|
23
23
|
import { MONACO_CONSTANTS } from '../constants/MONACO_CONSTANTS';
|
|
24
|
+
import { CHROME_DRIVER_CONSTANTS } from '../constants/CHROME_DRIVER_CONSTANTS';
|
|
24
25
|
|
|
25
26
|
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
|
|
26
27
|
let latestWorkspace: string = '';
|
|
27
28
|
|
|
28
29
|
export function registerRunningWorkspace(workspaceName: string): void {
|
|
29
|
-
Logger.debug(`with workspaceName:${workspaceName}`);
|
|
30
|
+
workspaceName !== '' ? Logger.debug(`with workspaceName:${workspaceName}`) : Logger.debug('delete workspace name');
|
|
31
|
+
|
|
30
32
|
latestWorkspace = workspaceName;
|
|
31
33
|
}
|
|
32
34
|
|
|
@@ -63,6 +65,16 @@ exports.mochaHooks = {
|
|
|
63
65
|
}
|
|
64
66
|
],
|
|
65
67
|
afterEach: [
|
|
68
|
+
async function (this: Mocha.Context): Promise<void> {
|
|
69
|
+
if (this.currentTest?.state === 'failed') {
|
|
70
|
+
try {
|
|
71
|
+
const screenshot: string = await driverHelper.getDriver().takeScreenshot();
|
|
72
|
+
allure.attachment('Screenshot', Buffer.from(screenshot, 'base64'), 'image/png');
|
|
73
|
+
} catch (e) {
|
|
74
|
+
allure.attachment('No screenshot', 'Could not take a screenshot', 'text/plain');
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
},
|
|
66
78
|
// stop and remove running workspace
|
|
67
79
|
function deleteWorkspaceOnFailedTest(this: Mocha.Context): void {
|
|
68
80
|
if (this.currentTest?.state === 'failed') {
|
|
@@ -75,6 +87,7 @@ exports.mochaHooks = {
|
|
|
75
87
|
}
|
|
76
88
|
],
|
|
77
89
|
afterAll: [
|
|
90
|
+
// stop and remove running workspace
|
|
78
91
|
async function stopTheDriver(): Promise<void> {
|
|
79
92
|
if (!BASE_TEST_CONSTANTS.TS_DEBUG_MODE && CHROME_DRIVER_CONSTANTS.TS_USE_WEB_DRIVER_FOR_TEST) {
|
|
80
93
|
// ensure that fired events done
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/** *******************************************************************
|
|
2
|
+
* copyright (c) 2023 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 { KubernetesCommandLineToolsExecutor } from '../../utils/KubernetesCommandLineToolsExecutor';
|
|
11
|
+
import fs from 'fs';
|
|
12
|
+
import path from 'path';
|
|
13
|
+
import YAML from 'yaml';
|
|
14
|
+
import { expect } from 'chai';
|
|
15
|
+
import { e2eContainer } from '../../configs/inversify.config';
|
|
16
|
+
import { CLASSES } from '../../configs/inversify.types';
|
|
17
|
+
import { LoginTests } from '../../tests-library/LoginTests';
|
|
18
|
+
import { Dashboard } from '../../pageobjects/dashboard/Dashboard';
|
|
19
|
+
import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
|
|
20
|
+
import { Workspaces } from '../../pageobjects/dashboard/Workspaces';
|
|
21
|
+
import { ShellExecutor } from '../../utils/ShellExecutor';
|
|
22
|
+
import { WorkspaceDetails } from '../../pageobjects/dashboard/workspace-details/WorkspaceDetails';
|
|
23
|
+
import axios from 'axios';
|
|
24
|
+
import { BASE_TEST_CONSTANTS } from '../../constants/BASE_TEST_CONSTANTS';
|
|
25
|
+
import { OAUTH_CONSTANTS } from '../../constants/OAUTH_CONSTANTS';
|
|
26
|
+
|
|
27
|
+
// suit works for DevSpaces
|
|
28
|
+
suite('Check links to documentation page in Dashboard.', function (): void {
|
|
29
|
+
const pathToSampleFile: string = path.resolve('resources/default-devfile.yaml');
|
|
30
|
+
const workspaceName: string = YAML.parse(fs.readFileSync(pathToSampleFile, 'utf8')).metadata.name;
|
|
31
|
+
const kubernetesCommandLineToolsExecutor: KubernetesCommandLineToolsExecutor = e2eContainer.get(
|
|
32
|
+
CLASSES.KubernetesCommandLineToolsExecutor
|
|
33
|
+
);
|
|
34
|
+
kubernetesCommandLineToolsExecutor.workspaceName = workspaceName;
|
|
35
|
+
const loginTests: LoginTests = e2eContainer.get(CLASSES.LoginTests);
|
|
36
|
+
const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard);
|
|
37
|
+
const workspaces: Workspaces = e2eContainer.get(CLASSES.Workspaces);
|
|
38
|
+
const workspaceDetails: WorkspaceDetails = e2eContainer.get(CLASSES.WorkspaceDetails);
|
|
39
|
+
const shellExecutor: ShellExecutor = e2eContainer.get(CLASSES.ShellExecutor);
|
|
40
|
+
const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
|
|
41
|
+
|
|
42
|
+
const testingVersion: string = BASE_TEST_CONSTANTS.TESTING_APPLICATION_VERSION;
|
|
43
|
+
let parentGUID: string = '';
|
|
44
|
+
|
|
45
|
+
// get links from product version github branch
|
|
46
|
+
const { docs, links, productVersion }: any = JSON.parse(
|
|
47
|
+
shellExecutor.curl(
|
|
48
|
+
`https://raw.githubusercontent.com/redhat-developer/devspaces-images/devspaces-${testingVersion}-rhel-8/devspaces-dashboard/packages/dashboard-frontend/assets/branding/product.json`
|
|
49
|
+
)
|
|
50
|
+
);
|
|
51
|
+
const { webSocketTroubleshooting, workspace, devfile, general, storageTypes } = docs;
|
|
52
|
+
|
|
53
|
+
suiteSetup('Login into OC client and apply default DevFile', function (): void {
|
|
54
|
+
kubernetesCommandLineToolsExecutor.loginToOcp();
|
|
55
|
+
kubernetesCommandLineToolsExecutor.applyYamlConfigurationAsFile(pathToSampleFile);
|
|
56
|
+
shellExecutor.wait(5);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
suiteTeardown('Delete default DevWorkspace', function (): void {
|
|
60
|
+
kubernetesCommandLineToolsExecutor.deleteDevWorkspace();
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test('Check if product.json config contains correct application version', function (): void {
|
|
64
|
+
[productVersion, links[1].href, devfile, workspace, general, storageTypes, webSocketTroubleshooting].forEach((e): void => {
|
|
65
|
+
expect(e).contains(testingVersion);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
loginTests.loginIntoChe();
|
|
70
|
+
|
|
71
|
+
test('Check if documentation section "About" present on Dashboard', async function (): Promise<void> {
|
|
72
|
+
await dashboard.openAboutMenu();
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test('Check if documentation section "About" in top menu has required links', async function (): Promise<void> {
|
|
76
|
+
parentGUID = await browserTabsUtil.getCurrentWindowHandle();
|
|
77
|
+
for (const link of links) {
|
|
78
|
+
await dashboard.selectAboutMenuItem(link.text);
|
|
79
|
+
await browserTabsUtil.waitAndSwitchToAnotherWindow(parentGUID);
|
|
80
|
+
const currentUrl: string = await browserTabsUtil.getCurrentUrl();
|
|
81
|
+
expect(link.href).oneOf([currentUrl, currentUrl + '/']);
|
|
82
|
+
await browserTabsUtil.switchToWindow(parentGUID);
|
|
83
|
+
await browserTabsUtil.closeAllTabsExceptCurrent();
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test('Check if "About" dialog menu contains correct application version and username', async function (): Promise<void> {
|
|
88
|
+
await dashboard.selectAboutMenuItem('About');
|
|
89
|
+
await dashboard.waitAboutDialogWindowMenuElements();
|
|
90
|
+
expect(await dashboard.getApplicationVersionFromAboutDialogWindow()).eqls(productVersion);
|
|
91
|
+
expect(await dashboard.getUsernameFromAboutDialogWindow()).eqls(OAUTH_CONSTANTS.TS_SELENIUM_OCP_USERNAME);
|
|
92
|
+
await dashboard.closeAboutDialogWindow();
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
test('Check if Workspaces page contains "Learn More" documentation link', async function (): Promise<void> {
|
|
96
|
+
await dashboard.clickWorkspacesButton();
|
|
97
|
+
await workspaces.waitPage();
|
|
98
|
+
expect(await workspaces.getLearnMoreDocumentationLink()).eqls(workspace);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
test('Check if Workspace Details page contains "Storage types" documentation link', async function (): Promise<void> {
|
|
102
|
+
await workspaces.clickWorkspaceListItemLink(workspaceName);
|
|
103
|
+
await workspaceDetails.waitWorkspaceTitle(workspaceName);
|
|
104
|
+
await workspaceDetails.clickStorageTypeInfo();
|
|
105
|
+
expect(await workspaceDetails.getOpenStorageTypeDocumentationLink()).eqls(storageTypes);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
test('Check if Workspace Details page contains "Devfile" documentation link', async function (): Promise<void> {
|
|
109
|
+
await workspaceDetails.closeStorageTypeInfo();
|
|
110
|
+
await workspaceDetails.selectTab('Devfile');
|
|
111
|
+
expect(await workspaceDetails.getDevfileDocumentationLink()).eqls(devfile);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
if (BASE_TEST_CONSTANTS.IS_PRODUCT_DOCUMENTATION_RELEASED) {
|
|
115
|
+
test('Check if product.json documentation links returns status code 200', async function (): Promise<void> {
|
|
116
|
+
const documentationLinks: string[] = [devfile, workspace, general, storageTypes, webSocketTroubleshooting];
|
|
117
|
+
links.forEach((link: any): void => {
|
|
118
|
+
documentationLinks.push(link.href);
|
|
119
|
+
});
|
|
120
|
+
for (const e of documentationLinks) {
|
|
121
|
+
let responseData: any;
|
|
122
|
+
try {
|
|
123
|
+
responseData = await axios.get(e);
|
|
124
|
+
} catch (e) {
|
|
125
|
+
responseData = e;
|
|
126
|
+
} finally {
|
|
127
|
+
expect(responseData.status).eqls(200);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
loginTests.loginIntoChe();
|
|
134
|
+
});
|