From 29d4f0d449dda1a67412b303fe115270dbc330fe Mon Sep 17 00:00:00 2001 From: Sergey Skorik Date: Tue, 10 May 2022 11:38:00 +0300 Subject: [PATCH] adapt XmlPlugin test to works with devfile v2 (#21375) --- .../e2e/tests/plugins/VscodeXmlPlugin.spec.ts | 32 +++++++------------ 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/tests/e2e/tests/plugins/VscodeXmlPlugin.spec.ts b/tests/e2e/tests/plugins/VscodeXmlPlugin.spec.ts index 45f055d5fc5..e4afd1a8864 100644 --- a/tests/e2e/tests/plugins/VscodeXmlPlugin.spec.ts +++ b/tests/e2e/tests/plugins/VscodeXmlPlugin.spec.ts @@ -10,31 +10,31 @@ import { Key } from 'selenium-webdriver'; import { e2eContainer } from '../../inversify.config'; -import { WorkspaceNameHandler } from '../../utils/WorkspaceNameHandler'; -import { Ide } from '../../pageobjects/ide/Ide'; import { CLASSES } from '../../inversify.types'; import { ProjectTree } from '../../pageobjects/ide/ProjectTree'; import { Editor } from '../../pageobjects/ide/Editor'; import { TestConstants } from '../../TestConstants'; -import { TimeoutConstants } from '../../TimeoutConstants'; -import { WorkspaceHandlingTests } from '../../testsLibrary/WorkspaceHandlingTests'; import { Logger } from '../../utils/Logger'; +import { WorkspaceHandlingTests } from '../../testsLibrary/WorkspaceHandlingTests'; import CheReporter from '../../driver/CheReporter'; import { BrowserTabsUtil } from '../../utils/BrowserTabsUtil'; +import { PreferencesHandler } from '../../utils/PreferencesHandler'; +import { ProjectAndFileTests } from '../../testsLibrary/ProjectAndFileTests'; -const ide: Ide = e2eContainer.get(CLASSES.Ide); +const projectAndFileTests: ProjectAndFileTests = e2eContainer.get(CLASSES.ProjectAndFileTests); const projectTree: ProjectTree = e2eContainer.get(CLASSES.ProjectTree); const editor: Editor = e2eContainer.get(CLASSES.Editor); const browserTabsUtil: BrowserTabsUtil = e2eContainer.get(CLASSES.BrowserTabsUtil); const workspaceHandlingTests: WorkspaceHandlingTests = e2eContainer.get(CLASSES.WorkspaceHandlingTests); -const workspaceNameHandler: WorkspaceNameHandler = e2eContainer.get(CLASSES.WorkspaceNameHandler); +const preferencesHandler: PreferencesHandler = e2eContainer.get(CLASSES.PreferencesHandler); -const devfileUrl: string = 'https://raw.githubusercontent.com/eclipse/che/main/tests/e2e/files/devfiles/plugins/VscodeXmlPlugin.yaml'; +const devfileUrl: string = 'https://github.com/che-samples/web-nodejs-sample/tree/xml-plugin'; const factoryUrl: string = `${TestConstants.TS_SELENIUM_BASE_URL}/f?url=${devfileUrl}`; -const projectName: string = 'nodejs-web-app'; +const projectName: string = 'web-nodejs-sample'; const pathToFile: string = `${projectName}`; const xmlFileName: string = 'hello.xml'; -let workspaceName: string = ''; +const subRootFolder: string = 'app'; +let workspaceName: string = 'xml-plugin'; suite('The "VscodeXmlPlugin" userstory', async () => { suite('Create workspace', async () => { @@ -42,20 +42,12 @@ suite('The "VscodeXmlPlugin" userstory', async () => { await browserTabsUtil.navigateTo(factoryUrl); }); + projectAndFileTests.waitWorkspaceReadiness(projectName, subRootFolder); + test('Wait until created workspace is started', async () => { - await ide.waitAndSwitchToIdeFrame(); - workspaceName = await workspaceNameHandler.getNameFromUrl(); CheReporter.registerRunningWorkspace(workspaceName); - await ide.waitIde(TimeoutConstants.TS_SELENIUM_START_WORKSPACE_TIMEOUT); - await ide.waitNotificationAndClickOnButton('Do you trust the authors of', 'Yes, I trust', 60_000); - }); - }); - - suite('Check workspace readiness to work', async () => { - test('Wait until project is imported', async () => { - await projectTree.openProjectTreeContainer(); - await projectTree.waitProjectImported(projectName, 'app'); + await preferencesHandler.setPreferenceUsingUI('application.confirmExit', 'never'); }); });