Skip to content

Commit

Permalink
feat: new test for sprigbnnbotot + parametrised
Browse files Browse the repository at this point in the history
  • Loading branch information
pospisilf committed Sep 29, 2024
1 parent 7d1d3c5 commit d41c9e1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 171 deletions.
27 changes: 14 additions & 13 deletions src/ui-test/tests/remote.test.this.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import * as path from 'path';
import { ActivityBar, Breakpoint, DebugView, DefaultWait, EditorView, InputBox, SideBarView, TextEditor, VSBrowser, WebDriver } from "vscode-uitests-tooling";
import { assert } from 'chai';
import { addNewItemToRawJson, clearTerminal, deleteFolderContents, disconnectDebugger, executeCommand, killTerminal, waitUntilEditorIsOpened, waitUntilTerminalHasText } from '../utils';
import { QUARKUS_DIR, SPRINGBOOT_DIR } from '../variables';
import { DEMO_FILE, QUARKUS_ATTACH_DEBUGGER, QUARKUS_CREATE_COMMAND, QUARKUS_DIR, QUARKUS_PROJECT_FOLDER, SPRINGBOOT_ATTACH_DEBUGGER, SPRINGBOOT_CREATE_COMMAND, SPRINGBOOT_DIR, SPRINGBOOT_PROJECT_FOLDER } from '../variables';

Check failure on line 21 in src/ui-test/tests/remote.test.this.ts

View workflow job for this annotation

GitHub Actions / main

Module '"../variables"' has no exported member 'DEMO_FILE'.


describe.only('Remote debug on OpenShift', function () {
Expand All @@ -38,14 +38,14 @@ describe.only('Remote debug on OpenShift', function () {
});

it(`SpringBoot`, async function () {
await DefaultWait.sleep(10000);
await DefaultWait.sleep(2000);
driver = VSBrowser.instance.driver;

await createCamelRoute(driver, "Demo");
await createProject(driver, 'Camel: Create a Camel on SpringBoot project')
await createProject(driver, SPRINGBOOT_CREATE_COMMAND)

// open file
await VSBrowser.instance.openResources(path.join(path.join(SPRINGBOOT_DIR, 'src', 'main', 'java', 'com', 'acme', 'myproject'), 'Demo.java'));
await VSBrowser.instance.openResources(path.join(SPRINGBOOT_PROJECT_FOLDER, DEMO_FILE));

// set breakpoint
textEditor = new TextEditor();
Expand All @@ -57,8 +57,8 @@ describe.only('Remote debug on OpenShift', function () {
const debugView = await openDebugView();

// validate configuration and start debug
assert.isTrue(await validateLaunchConfiguration(debugView, 'Run Camel Spring Boot application and attach Camel debugger'));
await startDebugSession(debugView,'Run Camel Spring Boot application and attach Camel debugger');
assert.isTrue(await validateLaunchConfiguration(debugView, SPRINGBOOT_ATTACH_DEBUGGER));
await startDebugSession(debugView,SPRINGBOOT_ATTACH_DEBUGGER);

// check breakpoint is hitted
const breakpoint = await waitForBreakpointPause(driver, textEditor);
Expand All @@ -77,14 +77,14 @@ describe.only('Remote debug on OpenShift', function () {
});

it(`Quarkus`, async function () {
await DefaultWait.sleep(10000);
await DefaultWait.sleep(2000);
driver = VSBrowser.instance.driver;

await createCamelRoute(driver, "Demo");
await createProject(driver, 'Camel: Create a Camel Quarkus project')
await createProject(driver, QUARKUS_CREATE_COMMAND);

// open file
await VSBrowser.instance.openResources(path.join(path.join(QUARKUS_DIR, 'src', 'main', 'java', 'com', 'acme', 'myproject'), 'Demo.java'));
await VSBrowser.instance.openResources(path.join(QUARKUS_PROJECT_FOLDER, DEMO_FILE));

// set breakpoint
textEditor = new TextEditor();
Expand All @@ -96,8 +96,8 @@ describe.only('Remote debug on OpenShift', function () {
const debugView = await openDebugView();

// validate configuration and start debug
assert.isTrue(await validateLaunchConfiguration(debugView, 'Run Camel Quarkus JVM application and attach Camel debugger'));
await startDebugSession(debugView,'Run Camel Quarkus JVM application and attach Camel debugger');
assert.isTrue(await validateLaunchConfiguration(debugView, QUARKUS_ATTACH_DEBUGGER));
await startDebugSession(debugView,QUARKUS_ATTACH_DEBUGGER);

// check breakpoint is hitted
const breakpoint = await waitForBreakpointPause(driver, textEditor);
Expand Down Expand Up @@ -147,9 +147,9 @@ async function workaround(driver: WebDriver): Promise<void> {
const editor = new TextEditor();
const newJson = addNewItemToRawJson(await editor.getText(), "java.project.sourcePaths", ["src/main/java"]);
await editor.setText(newJson);
await DefaultWait.sleep(10000);
await DefaultWait.sleep(2000);
await editor.save();
await DefaultWait.sleep(10000);
await DefaultWait.sleep(2000);
await new EditorView().closeEditor("settings.json");
}

Expand Down Expand Up @@ -197,6 +197,7 @@ async function createProject(driver: WebDriver, command: string): Promise<void>
*/
async function openDebugView():Promise<DebugView>{
const btn = await new ActivityBar().getViewControl('Run');

const debugView = (await btn.openView()) as DebugView;
return debugView;
}
Expand Down
156 changes: 0 additions & 156 deletions src/ui-test/tests/spring.test.this.ts

This file was deleted.

12 changes: 10 additions & 2 deletions src/ui-test/variables.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import * as path from 'path';

export const RESOURCES_DIR = path.resolve('.', 'src', 'ui-test', 'resources');
export const QUARKUS_DIR = path.join(RESOURCES_DIR, 'quarkus');

export const DEBUGGER_ATTACHED_MESSAGE = 'debugger has been attached';

export const SPRINGBOOT_DIR = path.join(RESOURCES_DIR, 'springboot');
export const SPRINGBOOT_CREATE_COMMAND = 'Camel: Create a Camel on SpringBoot project';
export const SPRINGBOOT_ATTACH_DEBUGGER = 'Run Camel Spring Boot application and attach Camel debugger';
export const SPRINGBOOT_PROJECT_FOLDER = path.join(SPRINGBOOT_DIR, 'src', 'main', 'java', 'com', 'acme', 'myproject');

export const DEBUGGER_ATTACHED_MESSAGE = 'debugger has been attached';
export const QUARKUS_DIR = path.join(RESOURCES_DIR, 'quarkus');
export const QUARKUS_CREATE_COMMAND = 'Camel: Create a Camel Quarkus project';
export const QUARKUS_ATTACH_DEBUGGER = 'Run Camel Quarkus JVM application and attach Camel debugger';
export const QUARKUS_PROJECT_FOLDER = path.join(QUARKUS_DIR, 'src', 'main', 'java', 'com', 'acme', 'myproject');

0 comments on commit d41c9e1

Please sign in to comment.