From 4b0254d2552ce4b331b628ebf3e3d8ad0eff1ede Mon Sep 17 00:00:00 2001 From: kkanova Date: Fri, 7 Jun 2019 14:53:20 +0200 Subject: [PATCH] Add version to plugin. Signed-off-by: kkanova --- .../WorkspaceDetailsPlugins.ts | 32 +++++++++---------- ...rkspaceCreationAndLsInitialization.spec.ts | 7 ++-- e2e/utils/workspace/TestWorkspaceUtil.ts | 6 ++-- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/e2e/pageobjects/dashboard/workspace-details/WorkspaceDetailsPlugins.ts b/e2e/pageobjects/dashboard/workspace-details/WorkspaceDetailsPlugins.ts index f07a6f602e..518b1e4dc8 100644 --- a/e2e/pageobjects/dashboard/workspace-details/WorkspaceDetailsPlugins.ts +++ b/e2e/pageobjects/dashboard/workspace-details/WorkspaceDetailsPlugins.ts @@ -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); } diff --git a/e2e/tests/e2e/WorkspaceCreationAndLsInitialization.spec.ts b/e2e/tests/e2e/WorkspaceCreationAndLsInitialization.spec.ts index 2e242cc760..164bf27f1b 100644 --- a/e2e/tests/e2e/WorkspaceCreationAndLsInitialization.spec.ts +++ b/e2e/tests/e2e/WorkspaceCreationAndLsInitialization.spec.ts @@ -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); }); }); diff --git a/e2e/utils/workspace/TestWorkspaceUtil.ts b/e2e/utils/workspace/TestWorkspaceUtil.ts index bc56961291..880ec5b836 100644 --- a/e2e/utils/workspace/TestWorkspaceUtil.ts +++ b/e2e/utils/workspace/TestWorkspaceUtil.ts @@ -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);