Add version to plugin.

Signed-off-by: kkanova <kkanova@redhat.com>
7.20.x
kkanova 2019-06-07 14:53:20 +02:00
parent 5fd97155a2
commit 4b0254d255
3 changed files with 23 additions and 22 deletions

View File

@ -29,21 +29,21 @@ export class WorkspaceDetailsPlugins {
await this.driverHelper.waitVisibility(pluginListItemLocator, timeout);
}
async enablePlugin(pluginName: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
await this.waitPluginDisabling(pluginName, timeout);
await this.clickOnPluginListItemSwitcher(pluginName, undefined, timeout);
await this.waitPluginEnabling(pluginName, timeout);
async enablePlugin(pluginName: string, pluginVersion?: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
await this.waitPluginDisabling(pluginName, pluginVersion, timeout);
await this.clickOnPluginListItemSwitcher(pluginName, pluginVersion, timeout);
await this.waitPluginEnabling(pluginName, pluginVersion, timeout);
}
async disablePlugin(pluginName: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
await this.waitPluginEnabling(pluginName, timeout);
await this.clickOnPluginListItemSwitcher(pluginName, undefined, timeout);
await this.waitPluginDisabling(pluginName, timeout);
async disablePlugin(pluginName: string, pluginVersion?: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
await this.waitPluginEnabling(pluginName, pluginVersion, timeout);
await this.clickOnPluginListItemSwitcher(pluginName, pluginVersion, timeout);
await this.waitPluginDisabling(pluginName, pluginVersion, timeout);
}
async addPluginAndOpenWorkspace(namespace: string, workspaceName: string, pluginName: string, pluginId: string) {
async addPluginAndOpenWorkspace(namespace: string, workspaceName: string, pluginName: string, pluginId: string, pluginVersion?: string) {
await this.workspaceDetails.selectTab('Plugins');
await this.enablePlugin(pluginName);
await this.enablePlugin(pluginName, pluginVersion);
await this.workspaceDetails.saveChanges();
await this.workspaceDetails.openWorkspace(namespace, workspaceName);
await this.testWorkspaceUtil.waitWorkspaceStatus(namespace, workspaceName, WorkspaceStatus.RUNNING);
@ -52,10 +52,10 @@ export class WorkspaceDetailsPlugins {
private getPluginListItemCssLocator(pluginName: string, pluginVersion?: string): string {
if (pluginVersion) {
return `.plugin-item div[plugin-item-name='${pluginName}'][plugin-item-version='${pluginVersion}']`;
return `.plugin-item div[plugin-item-name*='${pluginName}'][plugin-item-version='${pluginVersion}']`;
}
return `.plugin-item div[plugin-item-name='${pluginName}']`;
return `.plugin-item div[plugin-item-name*='${pluginName}']`;
}
private getPluginListItemSwitcherCssLocator(pluginName: string, pluginVersion?: string): string {
@ -71,14 +71,14 @@ export class WorkspaceDetailsPlugins {
await this.driverHelper.waitAndClick(pluginListItemSwitcherLocator, timeout);
}
private async waitPluginEnabling(pluginName: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
const enabledPluginSwitcherLocator: By = By.css(`${this.getPluginListItemCssLocator(pluginName)} md-switch[aria-checked='true']`);
private async waitPluginEnabling(pluginName: string, pluginVersion?: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
const enabledPluginSwitcherLocator: By = By.css(`${this.getPluginListItemCssLocator(pluginName, pluginVersion)} md-switch[aria-checked='true']`);
await this.driverHelper.waitVisibility(enabledPluginSwitcherLocator, timeout);
}
private async waitPluginDisabling(pluginName: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
const disabledPluginSwitcherLocator: By = By.css(`${this.getPluginListItemCssLocator(pluginName)} md-switch[aria-checked='false']`);
private async waitPluginDisabling(pluginName: string, pluginVersion?: string, timeout: number = TestConstants.TS_SELENIUM_DEFAULT_TIMEOUT) {
const disabledPluginSwitcherLocator: By = By.css(`${this.getPluginListItemCssLocator(pluginName, pluginVersion)} md-switch[aria-checked='false']`);
await this.driverHelper.waitVisibility(disabledPluginSwitcherLocator, timeout);
}

View File

@ -22,8 +22,9 @@ import { Editor } from '../../pageobjects/ide/Editor';
const workspaceName: string = NameGenerator.generate('wksp-test-', 5);
const namespace: string = 'che';
const sampleName: string = 'console-java-simple';
const pluginId: string = 'redhat/java/0.38.0';
const javaPluginName: string = 'Language Support for Java(TM)';
const pluginId: string = 'redhat/java/0.45.0';
const pluginVersion: string = '0.45.0';
const javaPluginName: string = `Language Support for Java`;
const fileFolderPath: string = `${sampleName}/src/main/java/org/eclipse/che/examples`;
const tabTitle: string = 'HelloWorld.java';
@ -53,7 +54,7 @@ suite('E2E', async () => {
});
test('Add \'Java Language Support\' plugin to workspace', async () => {
await workspaceDetailsPlugins.addPluginAndOpenWorkspace(namespace, workspaceName, javaPluginName, pluginId);
await workspaceDetailsPlugins.addPluginAndOpenWorkspace(namespace, workspaceName, javaPluginName, pluginId, pluginVersion);
});
});

View File

@ -51,7 +51,7 @@ export class TestWorkspaceUtil {
throw new Error(`Exceeded the maximum number of checking attempts, workspace status is different to '${expectedWorkspaceStatus}'`);
}
public async waitPluginAdding(namespace: string, workspaceName: string, pluginName: string) {
public async waitPluginAdding(namespace: string, workspaceName: string, pluginId: string) {
const workspaceStatusApiUrl: string = `${TestConstants.TS_SELENIUM_BASE_URL}/api/workspace/${namespace}:${workspaceName}`;
const attempts: number = TestConstants.TS_SELENIUM_PLUGIN_PRECENCE_ATTEMPTS;
const polling: number = TestConstants.TS_SELENIUM_PLUGIN_PRECENCE_POLLING;
@ -65,14 +65,14 @@ export class TestWorkspaceUtil {
}
const machines: string = JSON.stringify(response.result.runtime.machines);
const isPluginPresent: boolean = machines.search(pluginName) > 0;
const isPluginPresent: boolean = machines.search(pluginId) > 0;
if (isPluginPresent) {
break;
}
if (i === attempts - 1) {
throw new Error(`Exceeded maximum tries attempts, the '${pluginName}' plugin is not present in the workspace runtime.`);
throw new Error(`Exceeded maximum tries attempts, the '${pluginId}' plugin is not present in the workspace runtime.`);
}
await this.driverHelper.wait(polling);