Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Settings): Use default Settings from Kaoto #709

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions it-tests/BasicFlow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,11 @@ async function createNewRoute(driver: WebDriver) {

async function addActiveMQStep(driver: WebDriver) {
await driver.wait(
until.elementLocated(By.xpath('//*[@data-type="node"]//*[@class="pf-topology__node__action-icon"]'))
until.elementLocated(By.css('g[data-testid^="custom-node__timer"]'))
);
const threeDotsIconOfOneOfTheSteps = (await driver.findElements(By.xpath('//*[@data-type="node"]//*[@class="pf-topology__node__action-icon"]')))[1];
await threeDotsIconOfOneOfTheSteps.click();

const canvasNode = await driver.findElement(By.css('g[data-testid^="custom-node__timer"]'));
await driver.actions().contextClick(canvasNode).perform();

await driver.wait(
until.elementLocated(By.className('pf-v5-c-dropdown pf-m-expanded'))
Expand Down
6 changes: 3 additions & 3 deletions it-tests/settings/NodeLabelSettings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ describe('User Settings', function () {

const locators = {
TimerComponent: {
timer: By.xpath(`//\*[name()='g' and starts-with(@data-id,'timer')]`),
label: By.xpath(`//\*[name()='g' and starts-with(@class,'pf-topology__node__label')]`)
timer: `g[data-id^='timer'][data-kind='node']`,
label: `.custom-node__label`,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This selector changed because there's no more topology label but rather a standard text.

}
}

Expand Down Expand Up @@ -64,7 +64,7 @@ describe('User Settings', function () {
it(`Check 'id' Node Label is used instead of default 'description'`, async function () {
this.timeout(60_000);

const timer = await driver.findElement(locators.TimerComponent.timer).findElement(locators.TimerComponent.label);
const timer = await driver.findElement(By.css(`${locators.TimerComponent.timer} ${locators.TimerComponent.label}`));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semantically, this is not exactly the same as before.

Before, we were locating a node and from that point, we searched for another one within. Now, we're targeting the label that is inside of the node.

The issue is that for some reason, topology now creates invisible nodes, potentially as references inside of the groups, so it means the test library finds 2 nodes, instead of one, and the first one is empty, therefore, the location fails.

const label = await timer.getText();

expect(label.split('\n')).to.contains('timerID');
Expand Down
12 changes: 6 additions & 6 deletions src/webview/VSCodeKaotoEditorChannelApi.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { KaotoEditorChannelApi } from '@kaoto/kaoto';
import { ISettingsModel, NodeLabelType, SettingsModel } from '@kaoto/kaoto/models';
import { BackendProxy } from '@kie-tools-core/backend/dist/api';
import { NotificationsChannelApi } from "@kie-tools-core/notifications/dist/api";
import { ResourceContentService, WorkspaceChannelApi } from "@kie-tools-core/workspace/dist/api";
import { I18n } from '@kie-tools-core/i18n/dist/core';
import { NotificationsChannelApi } from "@kie-tools-core/notifications/dist/api";
import { DefaultVsCodeKieEditorChannelApiImpl } from '@kie-tools-core/vscode-extension/dist/DefaultVsCodeKieEditorChannelApiImpl';
import { VsCodeI18n } from '@kie-tools-core/vscode-extension/dist/i18n';
import { VsCodeKieEditorController } from '@kie-tools-core/vscode-extension/dist/VsCodeKieEditorController';
import { JavaCodeCompletionApi } from '@kie-tools-core/vscode-java-code-completion/dist/api';
import * as vscode from 'vscode';
import { VsCodeKieEditorCustomDocument } from '@kie-tools-core/vscode-extension/dist/VsCodeKieEditorCustomDocument';
import { JavaCodeCompletionApi } from '@kie-tools-core/vscode-java-code-completion/dist/api';
import { ResourceContentService, WorkspaceChannelApi } from "@kie-tools-core/workspace/dist/api";
import * as path from 'path';
import { logInKaotoOutputChannel } from './../KaotoOutputChannelManager';
import * as vscode from 'vscode';
import { findClasspathRoot } from '../extension/ClasspathRootFinder';
import { logInKaotoOutputChannel } from './../KaotoOutputChannelManager';

export class VSCodeKaotoEditorChannelApi extends DefaultVsCodeKieEditorChannelApiImpl implements KaotoEditorChannelApi {

Expand Down Expand Up @@ -40,7 +40,7 @@ export class VSCodeKaotoEditorChannelApi extends DefaultVsCodeKieEditorChannelAp
const catalogUrl = await vscode.workspace.getConfiguration('kaoto').get<Promise<string | null>>('catalog.url');
const nodeLabel = await vscode.workspace.getConfiguration('kaoto').get<Promise<NodeLabelType | null>>('nodeLabel');

const settingsModel: ISettingsModel = {
const settingsModel: Partial<ISettingsModel> = {
catalogUrl: catalogUrl ?? '',
nodeLabel: nodeLabel ?? NodeLabelType.Description,
};
Expand Down