From a6b788164fca6206aae3532b8d33b67a5301abf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Pupier?= Date: Tue, 24 Dec 2024 16:06:43 +0100 Subject: [PATCH] fix: support xsd in Kaoto DataMapper on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * The fix consists in using fsPath of the vscode.URI * Added the UI test part to check source xsd correctly loaded * Note that the contextual menu to delete the step in tests is used instead of the toolbar (which is more modern) as the delete button toolbar is not visible enough to be clickable fix #747 Signed-off-by: Aurélien Pupier --- CHANGELOG.md | 2 ++ it-tests/BasicFlow.test.ts | 18 ++++++++++-------- src/webview/VSCodeKaotoEditorChannelApi.ts | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 29beb459..138a2d6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # 2.4.0 +- Fix Kaoto Datamapper editor on Windows (issue when attaching an xsd) + # 2.3.0 - Introduced a `Kaoto` output channel. It is initially used to log message of exceptions. diff --git a/it-tests/BasicFlow.test.ts b/it-tests/BasicFlow.test.ts index d10f4ed1..0a2b4999 100644 --- a/it-tests/BasicFlow.test.ts +++ b/it-tests/BasicFlow.test.ts @@ -205,7 +205,10 @@ async function addXsdForSource(driver: WebDriver, kaotoWebview: WebView) { await xsdInputbox.confirm(); await kaotoWebview.switchToFrame(); - //TODO: check content is loaded + await driver.wait( + until.elementLocated(By.xpath('//div[starts-with(@data-testid, "node-source-field-shiporder-")]')) + , 5000 + , 'Root of the imported xsd is not displayed in the UI'); } async function openDataMapperEditor(driver: WebDriver) { @@ -220,16 +223,15 @@ async function openDataMapperEditor(driver: WebDriver) { async function deleteDataMapperStep(driver: WebDriver, workspaceFolder: string) { await checkStepWithTestIdOrNodeLabelPresent(driver, 'custom-node__kaoto-datamapper', 'kaoto-datamapper'); const kaotoNodeConfigured = await driver.findElement(By.css('g[data-testid^="custom-node__kaoto-datamapper"],g[data-testid="custom-node__route.from.steps.0.kaoto-datamapper"]')); - await kaotoNodeConfigured.click(); - await driver.wait( - until.elementLocated(By.css('button[data-testid="step-toolbar-button-delete"]')) - ); - await (await driver.findElement(By.css('button[data-testid="step-toolbar-button-delete"]'))).click(); + + await driver.actions().contextClick(kaotoNodeConfigured).perform(); + await driver.wait( - until.elementLocated(By.css('button[data-testid="action-confirmation-modal-btn-del-step-and-file"]')) + until.elementLocated(By.className('pf-v5-c-dropdown pf-m-expanded')) ); - await (await driver.findElement(By.css('button[data-testid="action-confirmation-modal-btn-del-step-and-file"]'))).click(); + await (await driver.findElement(By.xpath("//*[@data-testid='context-menu-item-delete']"))).click(); + await (await driver.findElement(By.css('button[data-testid="action-confirmation-modal-btn-del-step-and-file"]'))).click(); await waitUntil(() => { const filesAfterDeletion = fs.readdirSync(workspaceFolder); const xslFilesAfterDeletion = filesAfterDeletion.filter(file => file.endsWith('.xsl')); diff --git a/src/webview/VSCodeKaotoEditorChannelApi.ts b/src/webview/VSCodeKaotoEditorChannelApi.ts index 359f4abb..d6851133 100644 --- a/src/webview/VSCodeKaotoEditorChannelApi.ts +++ b/src/webview/VSCodeKaotoEditorChannelApi.ts @@ -158,7 +158,7 @@ export class VSCodeKaotoEditorChannelApi extends DefaultVsCodeKieEditorChannelAp kaotoMetadataFile = await this.findKaotoMetadataToCreate(); } return await vscode.window.showQuickPick(files.map((f) => { - return path.relative(path.dirname(kaotoMetadataFile.fsPath), f.path); + return path.relative(path.dirname(kaotoMetadataFile.fsPath), f.fsPath); }), options as vscode.QuickPickOptions); } catch (ex) { const errorMessage = `Cannot get a user selection: ${ex.message}`;