-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FUSETOOLS2-2065: Provide tests for completion inside tasks.json (#529)
- Loading branch information
Showing
12 changed files
with
366 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/ui-test/resources/tasks-examples/01_launch_camel_debug_profile.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "Launch Camel test with Maven with camel.debug profile", | ||
"type": "shell", | ||
"command": "mvn", // mvn binary of Maven must be available on command-line | ||
"args": [ | ||
"test", | ||
"-Dtest=*", // If more than one test is present, a specific one must be specified as a single test can be Camel debugged per launch. | ||
"-Pcamel.debug" // This depends on your project. The goal here is to have camel-debug on the classpath. | ||
], | ||
"options": { | ||
"env": { | ||
"CAMEL_DEBUGGER_SUSPEND": "true" // Set to true by default. A debugger must be attached for message to be processed. | ||
} | ||
}, | ||
"problemMatcher": "$camel.debug.problemMatcher", | ||
"presentation": { | ||
"reveal": "always" | ||
}, | ||
"isBackground": true // Must be set as background as the Maven commands doesn't return until the Camel application stops. | ||
} | ||
] | ||
} |
27 changes: 27 additions & 0 deletions
27
src/ui-test/resources/tasks-examples/02_run_jbang_w_camel_debug.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "Run Camel application with JBang with camel-debug", | ||
"type": "shell", | ||
"command": "jbang", // jbang binary must be available on command-line | ||
"args": [ | ||
"-Dorg.apache.camel.debugger.suspend=true", // requires Camel 3.18+ to take effect | ||
"-Dcamel.jbang.version=4.0.0", // to adapt to your Camel version. 3.16+ is required | ||
"camel@apache/camel", | ||
"run", | ||
"${relativeFile}", //to adapt to your workspace, using relativeFile means that the task must be launched when the file to start in debug in the active editor | ||
"--logging-level=info", | ||
"--reload", | ||
"--dep=org.apache.camel:camel-debug" | ||
], | ||
"problemMatcher": "$camel.debug.problemMatcher", | ||
"presentation": { | ||
"reveal": "always" | ||
}, | ||
"isBackground": true // Must be set as background as the jbang command doesn't return until the Camel application stops. | ||
} | ||
] | ||
} |
25 changes: 25 additions & 0 deletions
25
src/ui-test/resources/tasks-examples/03_start_mvn_camel_debug_goal.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "Start Camel application with camel:debug Maven goal", | ||
"type": "shell", | ||
"command": "mvn", // mvn binary of Maven must be available on command-line | ||
"args": [ | ||
"camel:debug" | ||
], | ||
"options": { | ||
"env": { | ||
"CAMEL_DEBUGGER_SUSPEND": "true" // Set to true by default. A debugger must be attached for message to be processed. | ||
} | ||
}, | ||
"problemMatcher": "$camel.debug.problemMatcher", | ||
"presentation": { | ||
"reveal": "always" | ||
}, | ||
"isBackground": true // Must be set as background as the Maven commands doesn't return until the Camel application stops. | ||
} | ||
] | ||
} |
22 changes: 22 additions & 0 deletions
22
src/ui-test/resources/tasks-examples/04_start_mvn_quarkus_dev_debug_profile.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "Start Camel application with Maven Quarkus Dev with camel.debug profile", | ||
"type": "shell", | ||
"command": "mvn", // mvn binary of Maven must be available on command-line | ||
"args": [ | ||
"compile", | ||
"quarkus:dev", | ||
"-Pcamel.debug" // This depends on your project. The goal here is to have camel-debug on the classpath. | ||
], | ||
"problemMatcher": "$camel.debug.problemMatcher", | ||
"presentation": { | ||
"reveal": "always" | ||
}, | ||
"isBackground": true // Must be set as background as the Maven commands doesn't return until the Camel application stops. | ||
} | ||
] | ||
} |
21 changes: 21 additions & 0 deletions
21
src/ui-test/resources/tasks-examples/05_start_mvn_camel_debug_profile.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "Start Camel application with camel.debug profile", | ||
"type": "shell", | ||
"command": "mvn", // mvn binary of Maven must be available on command-line | ||
"args": [ | ||
"camel:run", | ||
"-Pcamel.debug" // This depends on your project. The goal here is to have camel-debug on the classpath. | ||
], | ||
"problemMatcher": "$camel.debug.problemMatcher", | ||
"presentation": { | ||
"reveal": "always" | ||
}, | ||
"isBackground": true // Must be set as background as the Maven commands doesn't return until the Camel application stops. | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
|
||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License", destination); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { expect } from "chai"; | ||
import { activateEditor, closeEditor, getFileContent, openFileInEditor, selectFromCA } from "../utils"; | ||
import { ActivityBar, TextEditor, VSBrowser, WebDriver } from "vscode-uitests-tooling"; | ||
import * as path from "path"; | ||
import { RESOURCES_DIR, RESOURCES_TASK_EXAMPLES_DIR, TASKS_TEST_FILE } from "../variables"; | ||
|
||
describe('Completion inside tasks.json', function () { | ||
this.timeout(120000); | ||
|
||
let driver: WebDriver; | ||
let textEditor: TextEditor | null; | ||
|
||
before(async function () { | ||
driver = VSBrowser.instance.driver; | ||
await VSBrowser.instance.openResources(path.resolve('src', 'ui-test', 'resources')); | ||
await (await new ActivityBar().getViewControl('Explorer')).openView(); | ||
}); | ||
|
||
const PARAMS = [ | ||
// command, filename | ||
['Launch Camel test with Maven with camel.debug profile', '01_launch_camel_debug_profile.json'], | ||
['Run Camel application with JBang with camel-debug', '02_run_jbang_w_camel_debug.json'], | ||
['Start Camel application with camel:debug Maven goal', '03_start_mvn_camel_debug_goal.json'], | ||
['Start Camel application with Maven Quarkus Dev with camel.debug profile', '04_start_mvn_quarkus_dev_debug_profile.json'], | ||
['Start Camel application with Maven with camel.debug profile', '05_start_mvn_camel_debug_profile.json'] | ||
]; | ||
|
||
PARAMS.forEach(function (params) { | ||
const command = params.at(0) as string; | ||
const file = params.at(1) as string; | ||
|
||
it(`${command}`, async function () { | ||
await openFileInEditor(driver, RESOURCES_DIR, TASKS_TEST_FILE); | ||
textEditor = await activateEditor(driver, TASKS_TEST_FILE); | ||
// workaround for https://github.com/redhat-developer/vscode-extension-tester/issues/931 | ||
await textEditor?.setTextAtLine(6, " "); | ||
await textEditor?.moveCursor(6, 9); | ||
await selectFromCA(command); | ||
const text = await textEditor?.getText(); | ||
expect(text).equals(getFileContent(file, RESOURCES_TASK_EXAMPLES_DIR)); | ||
await closeEditor(TASKS_TEST_FILE, false); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.