Rework plugin tests for the openshift CI (#19785)

pull/3/head
Ihor Okhrimenko 2021-05-11 19:28:29 +03:00 committed by GitHub
parent d4e695ecac
commit 754c2c8f09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 97 additions and 61 deletions

View File

@ -228,6 +228,11 @@ export const TestConstants = {
/**
* This variable specifies that run test is used for load testing and that all artifacts will be sent to ftp client.
*/
TS_LOAD_TESTS: process.env.TS_LOAD_TESTS || 'false'
TS_LOAD_TESTS: process.env.TS_LOAD_TESTS || 'false',
/**
* This variable determines whether to delete the workspace after the test or leave the workspace running.
*/
TS_DELETE_PLUGINS_TEST_WORKSPACE: process.env.TS_DELETE_PLUGINS_TEST_WORKSPACE || 'true'
};

View File

@ -25,6 +25,7 @@
"tsc": "tsc -p .",
"init-mocha-opts": "tsc && mocha --opts mocha-single-devfile.opts --spec dist/tests/login/Login.spec.js",
"test-plugin": "npm run init-mocha-opts -- --spec dist/tests/plugins/${USERSTORY}.spec.js",
"test-plugin-ci": "export TS_DELETE_PLUGINS_TEST_WORKSPACE=false && npm run init-mocha-opts -- --spec dist/tests/plugins/${USERSTORY}.spec.js",
"test-all-plugins": "tsc && mocha --opts mocha-all-plugins.opts"
},
"author": "Ihor Okhrimenko (iokhrime@redhat.com)",

View File

@ -72,7 +72,7 @@ export class PluginsView {
// it will cause to the random result
for (let i: number = 0; i < text.length; i++) {
await this.driverHelper.type(PluginsView.SEARCH_FIELD_LOCATOR, text.charAt(i), timeout);
await this.driverHelper.wait(1000);
await this.driverHelper.wait(2000);
}
}

View File

@ -18,6 +18,7 @@ import { TestWorkspaceUtil } from '../../utils/workspace/TestWorkspaceUtil';
import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
import { PluginsView } from '../../pageobjects/ide/plugins/PluginsView';
import { WorkspaceHandlingTests } from '../../testsLibrary/WorkspaceHandlingTests';
import { Logger } from '../../utils/Logger';
const ide: Ide = e2eContainer.get(CLASSES.Ide);
const projectTree: ProjectTree = e2eContainer.get(CLASSES.ProjectTree);
@ -67,7 +68,12 @@ suite(`The 'InstallPluginUsingUI' test`, async () => {
suite('Stopping and deleting the workspace', async () => {
test(`Stop and remove workspace`, async () => {
await workspaceHandling.stopAndRemoveWorkspace(workspaceName);
if (TestConstants.TS_DELETE_PLUGINS_TEST_WORKSPACE === 'true') {
await workspaceHandling.stopAndRemoveWorkspace(workspaceName);
return;
}
Logger.info(`As far as the "TS_DELETE_PLUGINS_TEST_WORKSPACE" value is "false the workspace deletion is skipped"`);
});
});

View File

@ -20,6 +20,7 @@ import { Key } from 'selenium-webdriver';
import { Editor } from '../../pageobjects/ide/Editor';
import { ProjectAndFileTests } from '../../testsLibrary/ProjectAndFileTests';
import { WorkspaceHandlingTests } from '../../testsLibrary/WorkspaceHandlingTests';
import { Logger } from '../../utils/Logger';
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests);
@ -86,14 +87,15 @@ suite(`The 'JavaPlugin' test`, async () => {
});
suite('Stopping and deleting the workspace', async () => {
let workspaceName = 'not defined';
suiteSetup(async () => {
workspaceName = await WorkspaceNameHandler.getNameFromUrl();
test('Stop and remove workspace', async () => {
if (TestConstants.TS_DELETE_PLUGINS_TEST_WORKSPACE === 'true') {
let workspaceName = await WorkspaceNameHandler.getNameFromUrl();
await workspaceHandlingTests.stopAndRemoveWorkspace(workspaceName);
return;
}
Logger.info(`As far as the "TS_DELETE_PLUGINS_TEST_WORKSPACE" value is "false the workspace deletion is skipped"`);
});
test(`Stop and remove workspace`, async () => {
await workspaceHandlingTests.stopAndRemoveWorkspace(workspaceName);
});
});
});

View File

@ -21,6 +21,7 @@ import { TopMenu } from '../../pageobjects/ide/TopMenu';
import { DebugView } from '../../pageobjects/ide/DebugView';
import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
import { WorkspaceHandlingTests } from '../../testsLibrary/WorkspaceHandlingTests';
import { Logger } from '../../utils/Logger';
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
const ide: Ide = e2eContainer.get(CLASSES.Ide);
@ -94,13 +95,14 @@ suite(`The 'PhpPlugin' tests`, async () => {
});
suite('Stopping and deleting the workspace', async () => {
test(`Stop and remove workspace`, async () => {
let workspaceName = 'not defined';
suiteSetup(async () => {
workspaceName = await WorkspaceNameHandler.getNameFromUrl();
});
test('Stop and remove workspace', async () => {
if (TestConstants.TS_DELETE_PLUGINS_TEST_WORKSPACE === 'true') {
let workspaceName = await WorkspaceNameHandler.getNameFromUrl();
await workspaceHandlingTests.stopAndRemoveWorkspace(workspaceName);
return;
}
await workspaceHandlingTests.stopAndRemoveWorkspace(workspaceName);
Logger.info(`As far as the "TS_DELETE_PLUGINS_TEST_WORKSPACE" value is "false the workspace deletion is skipped"`);
});
});
});

View File

@ -19,6 +19,7 @@ import { ProjectTree } from '../../pageobjects/ide/ProjectTree';
import { Key } from 'selenium-webdriver';
import { Editor } from '../../pageobjects/ide/Editor';
import { WorkspaceHandlingTests } from '../../testsLibrary/WorkspaceHandlingTests';
import { Logger } from '../../utils/Logger';
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
@ -71,14 +72,14 @@ suite(`The 'PythonPlugin' test`, async () => {
});
suite('Stopping and deleting the workspace', async () => {
let workspaceName = 'not defined';
suiteSetup(async () => {
workspaceName = await WorkspaceNameHandler.getNameFromUrl();
});
test('Stop and remove workspace', async () => {
if (TestConstants.TS_DELETE_PLUGINS_TEST_WORKSPACE === 'true') {
let workspaceName = await WorkspaceNameHandler.getNameFromUrl();
await workspaceHandlingTests.stopAndRemoveWorkspace(workspaceName);
return;
}
test(`Stop and remove workspace`, async () => {
await workspaceHandlingTests.stopAndRemoveWorkspace(workspaceName);
Logger.info(`As far as the "TS_DELETE_PLUGINS_TEST_WORKSPACE" value is "false the workspace deletion is skipped"`);
});
});
});

View File

@ -24,6 +24,7 @@ import { DebugView } from '../../pageobjects/ide/DebugView';
import { Terminal } from '../../pageobjects/ide/Terminal';
import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil';
import { WorkspaceHandlingTests } from '../../testsLibrary/WorkspaceHandlingTests';
import { Logger } from '../../utils/Logger';
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
@ -154,13 +155,14 @@ suite(`The 'TypescriptPlugin and Node-debug' tests`, async () => {
});
suite('Stopping and deleting the workspace', async () => {
let workspaceName = 'not defined';
suiteSetup(async () => {
workspaceName = await WorkspaceNameHandler.getNameFromUrl();
});
test('Stop and remove workspace', async () => {
if (TestConstants.TS_DELETE_PLUGINS_TEST_WORKSPACE === 'true') {
let workspaceName = await WorkspaceNameHandler.getNameFromUrl();
await workspaceHandlingTests.stopAndRemoveWorkspace(workspaceName);
return;
}
test(`Stop and remove workspace`, async () => {
await workspaceHandlingTests.stopAndRemoveWorkspace(workspaceName);
Logger.info(`As far as the "TS_DELETE_PLUGINS_TEST_WORKSPACE" value is "false the workspace deletion is skipped"`);
});
});
});

View File

@ -19,6 +19,7 @@ import { PreferencesHandler } from '../../utils/PreferencesHandler';
import { KubernetesPlugin } from '../../pageobjects/ide/plugins/KubernetesPlugin';
import { ProjectTree } from '../../pageobjects/ide/ProjectTree';
import { WorkspaceHandlingTests } from '../../testsLibrary/WorkspaceHandlingTests';
import { Logger } from '../../utils/Logger';
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
@ -62,14 +63,14 @@ suite(`The 'VscodeKubernetesPlugin' test`, async () => {
});
suite('Stopping and deleting the workspace', async () => {
let workspaceName = 'not defined';
suiteSetup(async () => {
workspaceName = await WorkspaceNameHandler.getNameFromUrl();
});
test('Stop and remove workspace', async () => {
if (TestConstants.TS_DELETE_PLUGINS_TEST_WORKSPACE === 'true') {
let workspaceName = await WorkspaceNameHandler.getNameFromUrl();
await workspaceHandlingTests.stopAndRemoveWorkspace(workspaceName);
return;
}
test(`Stop and remowe workspace`, async () => {
await workspaceHandlingTests.stopAndRemoveWorkspace(workspaceName);
Logger.info(`As far as the "TS_DELETE_PLUGINS_TEST_WORKSPACE" value is "false the workspace deletion is skipped"`);
});
});
});

View File

@ -20,6 +20,7 @@ import { Editor } from '../../pageobjects/ide/Editor';
import { ProjectTree } from '../../pageobjects/ide/ProjectTree';
import { Key } from 'selenium-webdriver';
import { WorkspaceHandlingTests } from '../../testsLibrary/WorkspaceHandlingTests';
import { Logger } from '../../utils/Logger';
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
@ -35,8 +36,7 @@ const subRootFolder: string = 'app';
const pathToFile: string = `${sampleName}`;
const fileName: string = 'test.sh';
// skipped until issue: https://github.com/eclipse/che/issues/19376 resolved
suite.skip(`The 'VscodeShellcheckPlugin' test`, async () => {
suite(`The 'VscodeShellcheckPlugin' test`, async () => {
suite('Create workspace', async () => {
test('Set shellcheck path', async () => {
const shellcheckExecutablePathPropertyName: string = 'shellcheck.executablePath';
@ -86,14 +86,14 @@ suite.skip(`The 'VscodeShellcheckPlugin' test`, async () => {
});
suite('Stopping and deleting the workspace', async () => {
let workspaceName = 'not defined';
suiteSetup(async () => {
workspaceName = await WorkspaceNameHandler.getNameFromUrl();
});
test('Stop and remove workspace', async () => {
if (TestConstants.TS_DELETE_PLUGINS_TEST_WORKSPACE === 'true') {
let workspaceName = await WorkspaceNameHandler.getNameFromUrl();
await workspaceHandlingTests.stopAndRemoveWorkspace(workspaceName);
return;
}
test(`Stop and remowe workspace`, async () => {
await workspaceHandlingTests.stopAndRemoveWorkspace(workspaceName);
Logger.info(`As far as the "TS_DELETE_PLUGINS_TEST_WORKSPACE" value is "false the workspace deletion is skipped"`);
});
});
});

View File

@ -10,7 +10,6 @@
import { Key } from 'selenium-webdriver';
import { e2eContainer } from '../../inversify.config';
import { Dashboard } from '../../pageobjects/dashboard/Dashboard';
import { CLASSES } from '../../inversify.types';
import { Ide } from '../../pageobjects/ide/Ide';
import { ProjectTree } from '../../pageobjects/ide/ProjectTree';
@ -20,14 +19,15 @@ import { TestConstants } from '../../TestConstants';
import { TimeoutConstants } from '../../TimeoutConstants';
import { WorkspaceNameHandler } from '../../utils/WorkspaceNameHandler';
import { Terminal } from '../../pageobjects/ide/Terminal';
const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard);
import { Logger } from '../../utils/Logger';
import { WorkspaceHandlingTests } from '../../testsLibrary/WorkspaceHandlingTests';
const ide: Ide = e2eContainer.get(CLASSES.Ide);
const projectTree: ProjectTree = e2eContainer.get(CLASSES.ProjectTree);
const editor: Editor = e2eContainer.get(CLASSES.Editor);
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
const terminal: Terminal = e2eContainer.get(CLASSES.Terminal);
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
let workspaceName: string = '';
@ -75,9 +75,14 @@ suite('The "VscodeValePlugin" userstory', async () => {
});
suite('Delete workspace', async () => {
test('Delete workspace', async () => {
await dashboard.stopAndRemoveWorkspaceByUI(workspaceName);
suite('Stopping and deleting the workspace', async () => {
test('Stop and remove workspace', async () => {
if (TestConstants.TS_DELETE_PLUGINS_TEST_WORKSPACE === 'true') {
await workspaceHandlingTests.stopAndRemoveWorkspace(workspaceName);
return;
}
Logger.info(`As far as the "TS_DELETE_PLUGINS_TEST_WORKSPACE" value is "false the workspace deletion is skipped"`);
});
});
});

View File

@ -11,7 +11,6 @@
import { Key } from 'selenium-webdriver';
import { e2eContainer } from '../../inversify.config';
import { WorkspaceNameHandler } from '../../utils/WorkspaceNameHandler';
import { Dashboard } from '../../pageobjects/dashboard/Dashboard';
import { Ide } from '../../pageobjects/ide/Ide';
import { CLASSES } from '../../inversify.types';
import { ProjectTree } from '../../pageobjects/ide/ProjectTree';
@ -19,13 +18,14 @@ import { Editor } from '../../pageobjects/ide/Editor';
import { DriverHelper } from '../../utils/DriverHelper';
import { TestConstants } from '../../TestConstants';
import { TimeoutConstants } from '../../TimeoutConstants';
const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard);
import { WorkspaceHandlingTests } from '../../testsLibrary/WorkspaceHandlingTests';
import { Logger } from '../../utils/Logger';
const ide: Ide = e2eContainer.get(CLASSES.Ide);
const projectTree: ProjectTree = e2eContainer.get(CLASSES.ProjectTree);
const editor: Editor = e2eContainer.get(CLASSES.Editor);
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
let workspaceName: string = '';
@ -104,8 +104,14 @@ suite('The "VscodeXmlPlugin" userstory', async () => {
});
suite('Delete workspace', async () => {
test('Delete workspace', async () => {
await dashboard.stopAndRemoveWorkspaceByUI(workspaceName);
test('Stop and remove workspace', async () => {
if (TestConstants.TS_DELETE_PLUGINS_TEST_WORKSPACE === 'true') {
await workspaceHandlingTests.stopAndRemoveWorkspace(workspaceName);
return;
}
Logger.info(`As far as the "TS_DELETE_PLUGINS_TEST_WORKSPACE" value is "false the workspace deletion is skipped"`);
});
});
});

View File

@ -10,7 +10,6 @@
import { Key } from 'selenium-webdriver';
import { e2eContainer } from '../../inversify.config';
import { Dashboard } from '../../pageobjects/dashboard/Dashboard';
import { CLASSES } from '../../inversify.types';
import { Ide } from '../../pageobjects/ide/Ide';
import { ProjectTree } from '../../pageobjects/ide/ProjectTree';
@ -20,14 +19,15 @@ import { PreferencesHandler } from '../../utils/PreferencesHandler';
import { TestConstants } from '../../TestConstants';
import { TimeoutConstants } from '../../TimeoutConstants';
import { WorkspaceNameHandler } from '../../utils/WorkspaceNameHandler';
const dashboard: Dashboard = e2eContainer.get(CLASSES.Dashboard);
import { Logger } from '../../utils/Logger';
import { WorkspaceHandlingTests } from '../../testsLibrary/WorkspaceHandlingTests';
const ide: Ide = e2eContainer.get(CLASSES.Ide);
const projectTree: ProjectTree = e2eContainer.get(CLASSES.ProjectTree);
const editor: Editor = e2eContainer.get(CLASSES.Editor);
const driverHelper: DriverHelper = e2eContainer.get(CLASSES.DriverHelper);
const preferencesHandler: PreferencesHandler = e2eContainer.get(CLASSES.PreferencesHandler);
const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests);
let workspaceName: string = '';
@ -101,8 +101,13 @@ suite('The "VscodeYamlPlugin" userstory', async () => {
});
suite('Delete workspace', async () => {
test('Delete workspace', async () => {
await dashboard.stopAndRemoveWorkspaceByUI(workspaceName);
test('Stop and remove workspace', async () => {
if (TestConstants.TS_DELETE_PLUGINS_TEST_WORKSPACE === 'true') {
await workspaceHandlingTests.stopAndRemoveWorkspace(workspaceName);
return;
}
Logger.info(`As far as the "TS_DELETE_PLUGINS_TEST_WORKSPACE" value is "false the workspace deletion is skipped"`);
});
});
});