Skip to content

Commit bb7829f

Browse files
authored
Use TS_TEST_WORKSPACE_DEVFILE_REPO const for setting test repo in plugin tests (#21523)
1 parent 6c69f4f commit bb7829f

File tree

4 files changed

+17
-51
lines changed

4 files changed

+17
-51
lines changed

tests/e2e/TestConstants.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -259,5 +259,10 @@ export const TestConstants = {
259259
/**
260260
* URL of Gogs self-hosted Git server.
261261
*/
262-
TS_SELF_HOSTED_GIT_SERVER_URL: process.env.TS_SELF_HOSTED_GIT_SERVER_URL || '10.0.104.86:10080'
262+
TS_SELF_HOSTED_GIT_SERVER_URL: process.env.TS_SELF_HOSTED_GIT_SERVER_URL || '10.0.104.86:10080',
263+
264+
/**
265+
* URL of workspace devfile test repository.
266+
*/
267+
TS_TEST_WORKSPACE_DEVFILE_REPO: process.env.TS_TEST_WORKSPACE_DEVFILE_REPO || ''
263268
};

tests/e2e/mocha-all-plugins.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"require": "source-map-support/register",
77
"spec": [
88
"dist/tests/login/Login.spec.js",
9-
"dist/tests/plugins/*.spec.js"
9+
"dist/tests/plugins/VscodeXmlPlugin.spec.js",
10+
"dist/tests/plugins/VscodeYamlPlugin.spec.js"
1011
]
1112
}

tests/e2e/tests/plugins/VscodeXmlPlugin.spec.ts

+5-36
Original file line numberDiff line numberDiff line change
@@ -10,61 +10,35 @@
1010

1111
import { Key } from 'selenium-webdriver';
1212
import { e2eContainer } from '../../inversify.config';
13-
import { Ide } from '../../pageobjects/ide/Ide';
1413
import { CLASSES } from '../../inversify.types';
1514
import { ProjectTree } from '../../pageobjects/ide/ProjectTree';
1615
import { Editor } from '../../pageobjects/ide/Editor';
1716
import { TestConstants } from '../../TestConstants';
18-
import { Logger } from '../../utils/Logger';
1917
import { WorkspaceHandlingTests } from '../../testsLibrary/WorkspaceHandlingTests';
20-
import CheReporter from '../../driver/CheReporter';
2118
import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
22-
import { PreferencesHandler } from '../../utils/PreferencesHandler';
2319
import { ProjectAndFileTests } from '../../testsLibrary/ProjectAndFileTests';
24-
import { TimeoutConstants } from '../../TimeoutConstants';
2520

2621
const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
2722
const projectTree: ProjectTree = e2eContainer.get(CLASSES.ProjectTree);
2823
const editor: Editor = e2eContainer.get(CLASSES.Editor);
29-
const ide: Ide = e2eContainer.get(CLASSES.Ide);
3024
const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil);
3125
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
32-
const preferencesHandler: PreferencesHandler = e2eContainer.get(CLASSES.PreferencesHandler);
33-
34-
const devfileUrl: string = 'https://github.com/che-samples/web-nodejs-sample/tree/xml-plugin';
26+
const devfileUrl: string = TestConstants.TS_TEST_WORKSPACE_DEVFILE_REPO || 'https://github.com/che-samples/web-nodejs-sample/tree/xml-plugin';
3527
const factoryUrl: string = `${TestConstants.TS_SELENIUM_BASE_URL}/f?url=${devfileUrl}`;
3628
const projectName: string = 'web-nodejs-sample';
3729
const pathToFile: string = `${projectName}`;
3830
const xmlFileName: string = 'hello.xml';
3931
const subRootFolder: string = 'app';
40-
let workspaceName: string = 'xml-plugin';
4132

4233
suite('The "VscodeXmlPlugin" userstory', async () => {
4334
suite('Create workspace', async () => {
4435
test('Create workspace using factory', async () => {
4536
await browserTabsUtil.navigateTo(factoryUrl);
4637
});
4738

48-
projectAndFileTests.waitWorkspaceReadiness(projectName, subRootFolder);
49-
50-
test('Wait until created workspace is started', async () => {
51-
WorkspaceHandlingTests.setWorkspaceName(workspaceName);
52-
CheReporter.registerRunningWorkspace(workspaceName);
39+
workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
5340

54-
await preferencesHandler.setPreferenceUsingUI('application.confirmExit', 'never');
55-
});
56-
57-
test('Wait until created workspace is started', async () => {
58-
await ide.waitIde(TimeoutConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT);
59-
await ide.waitNotificationAndClickOnButton('Do you trust the authors of', 'Yes, I trust', 60_000);
60-
});
61-
});
62-
63-
suite('Check workspace readiness to work', async () => {
64-
test('Wait until project is imported', async () => {
65-
await projectTree.openProjectTreeContainer();
66-
await projectTree.waitProjectImported(projectName, 'app');
67-
});
41+
projectAndFileTests.waitWorkspaceReadiness(projectName, subRootFolder);
6842
});
6943

7044
suite('Check the "vscode-xml" plugin', async () => {
@@ -114,14 +88,9 @@ suite('The "VscodeXmlPlugin" userstory', async () => {
11488

11589
});
11690

117-
suite('Delete workspace', async () => {
91+
suite ('Stopping and deleting the workspace', async () => {
11892
test('Stop and remove workspace', async () => {
119-
if (TestConstants.TS_DELETE_PLUGINS_TEST_WORKSPACE === 'true') {
120-
await workspaceHandlingTests.stopAndRemoveWorkspace(WorkspaceHandlingTests.getWorkspaceName());
121-
return;
122-
}
123-
124-
Logger.info(`As far as the "TS_DELETE_PLUGINS_TEST_WORKSPACE" value is "false the workspace deletion is skipped"`);
93+
await workspaceHandlingTests.stopAndRemoveWorkspace(WorkspaceHandlingTests.getWorkspaceName());
12594
});
12695
});
12796

tests/e2e/tests/plugins/VscodeYamlPlugin.spec.ts

+4-13
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { CLASSES } from '../../inversify.types';
1414
import { ProjectTree } from '../../pageobjects/ide/ProjectTree';
1515
import { Editor } from '../../pageobjects/ide/Editor';
1616
import { TestConstants } from '../../TestConstants';
17-
import { Logger } from '../../utils/Logger';
1817
import { WorkspaceHandlingTests } from '../../testsLibrary/WorkspaceHandlingTests';
1918
import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
2019
import { PreferencesHandler } from '../../utils/PreferencesHandler';
@@ -27,7 +26,7 @@ const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUti
2726
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
2827
const preferencesHandler: PreferencesHandler = e2eContainer.get(CLASSES.PreferencesHandler);
2928

30-
const devfileUrl: string = 'https://github.com/che-samples/web-nodejs-sample/tree/yaml-plugin';
29+
const devfileUrl: string = TestConstants.TS_TEST_WORKSPACE_DEVFILE_REPO || 'https://github.com/che-samples/web-nodejs-sample/tree/yaml-plugin';
3130
const factoryUrl: string = `${TestConstants.TS_SELENIUM_BASE_URL}/f?url=${devfileUrl}`;
3231
const projectName: string = 'web-nodejs-sample';
3332
const subRootFolder: string = 'app';
@@ -44,10 +43,6 @@ suite('The "VscodeYamlPlugin" userstory', async () => {
4443
workspaceHandlingTests.obtainWorkspaceNameFromStartingPage();
4544

4645
projectAndFileTests.waitWorkspaceReadiness(projectName, subRootFolder);
47-
48-
test('Set confirmExit preference to never', async () => {
49-
await preferencesHandler.setPreferenceUsingUI('application.confirmExit', 'never');
50-
});
5146
});
5247

5348
suite('Check the "vscode-yaml" plugin', async () => {
@@ -91,14 +86,10 @@ suite('The "VscodeYamlPlugin" userstory', async () => {
9186

9287
});
9388

94-
suite('Delete workspace', async () => {
89+
suite ('Stopping and deleting the workspace', async () => {
9590
test('Stop and remove workspace', async () => {
96-
if (TestConstants.TS_DELETE_PLUGINS_TEST_WORKSPACE === 'true') {
97-
await workspaceHandlingTests.stopAndRemoveWorkspace(WorkspaceHandlingTests.getWorkspaceName());
98-
return;
99-
}
100-
101-
Logger.info(`As far as the "TS_DELETE_PLUGINS_TEST_WORKSPACE" value is "false the workspace deletion is skipped"`);
91+
await workspaceHandlingTests.stopAndRemoveWorkspace(WorkspaceHandlingTests.getWorkspaceName());
10292
});
10393
});
94+
10495
});

0 commit comments

Comments
 (0)