Skip to content

Commit

Permalink
Moved sample workspace to test directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Darien Pardinas Diaz committed May 20, 2024
1 parent 0c7abc3 commit 4aa33fc
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 24 deletions.
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Release
on:
pull_request:
types: [synchronize]
push:
branches:
- main
Expand Down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"type": "extensionHost",
"request": "launch",
"args": [
"${workspaceFolder}/sampleWorkspace",
"${workspaceFolder}/test/workspace1",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
Expand Down
3 changes: 1 addition & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const startHttpServer = async (
host: string,
port: number,
fallbackPorts: number[],
showNotification: boolean = false
): Promise<void> => {
let isInUse = false;
if (port) {
Expand All @@ -39,7 +38,7 @@ const startHttpServer = async (
if (fallbackPorts.length > 0) {
const nextPort = fallbackPorts.shift();
if (nextPort) {
startHttpServer(context, host, nextPort, fallbackPorts, true);
startHttpServer(context, host, nextPort, fallbackPorts);
return;
} else {
isInUse = true;
Expand Down
4 changes: 2 additions & 2 deletions src/test/runTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ async function main() {
const extensionTestsPath = path.resolve(__dirname, "./suite/index");

// Get the directory path to a sample workspace
const sampleWorkspace = path.resolve(__dirname, "../../sampleWorkspace");
const workspace1 = path.resolve(__dirname, "./workspace1");

// VSCode launch arguments
const launchArgs = [sampleWorkspace];
const launchArgs = [workspace1];
// Download VS Code, unzip it and run the integration test
await runTests({ extensionDevelopmentPath, extensionTestsPath, launchArgs });
} catch (err) {
Expand Down
4 changes: 2 additions & 2 deletions src/test/suite/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ suite("Extension Test Suite", () => {
const workspaceFolders = (await makeRequest("custom.workspaceFolders")) as string[];
assert(workspaceFolders.length === 1);
const ws = workspaceFolders[0] as any;
assert(ws.name === 'sampleWorkspace');
assert(ws.name === 'workspace1');
assert(ws.index === 0);
assert(ws.uri.startsWith("file://"));
assert(ws.uri.endsWith("/sampleWorkspace"));
assert(ws.uri.endsWith("/workspace1"));
});

test("get all commands registred in vscode", async () => {
Expand Down
File renamed without changes.
73 changes: 57 additions & 16 deletions sampleWorkspace/samples.http → src/test/workspace1/samples.http
Original file line number Diff line number Diff line change
@@ -1,31 +1,45 @@
### send a message to vscode
POST http://localhost:37100 HTTP/1.1
@endpoint = http://localhost:43285

### show a warning message in vscode and get a choice selection
POST {{endpoint}} HTTP/1.1
content-type: application/json

{"command": "custom.showErrorMessage", "args": ["Make a choice", "Choice 1", "Choice 2"]}
{
"command": "custom.showWarningMessage",
"args": ["Make a choice", "Choice 1", "Choice 2"]
}

### list installed extensions
POST http://localhost:37100 HTTP/1.1
POST {{endpoint}} HTTP/1.1
content-type: application/json

{ "command": "custom.listInstalledExtensions" }

### get current workspace
POST {{endpoint}} HTTP/1.1
content-type: application/json

{"command": "custom.listInstalledExtensions", "args": []}
{ "command": "custom.workspaceFolders" }

### execute command in terminal
POST http://localhost:37100 HTTP/1.1
### execute a command in active terminal
POST {{endpoint}} HTTP/1.1
content-type: application/json

{"command": "custom.runInTerminal", "args": "ls -la"}
{ "command": "custom.runInTerminal", "args": ["ls -la"] }


### Open file at line
POST http://localhost:37100 HTTP/1.1
POST {{endpoint}} HTTP/1.1
content-type: application/json

{"command": "custom.goToFileLineCharacter", "args": ["demo.py", 5, 0]}
{
"command": "custom.goToFileLineCharacter",
"args": ["src/test/workspace1/demo.py", 5, 0]
}


### Start debugging with a custom configuration
POST http://localhost:37100 HTTP/1.1
POST {{endpoint}} HTTP/1.1
content-type: application/json

{
Expand All @@ -44,7 +58,7 @@ content-type: application/json
}

### Reveal line in current file
POST http://localhost:37100 HTTP/1.1
POST {{endpoint}} HTTP/1.1
content-type: application/json

{
Expand All @@ -53,7 +67,7 @@ content-type: application/json
}

### Go to location (the hard way)
POST http://localhost:37100 HTTP/1.1
POST {{endpoint}} HTTP/1.1
content-type: application/json

{
Expand All @@ -62,7 +76,7 @@ content-type: application/json
{
"__type__": "Uri",
"args": [
"/home/ddiaz/vscode-rest-control/src/demo.py"
"/abs/path/to/src/test/workspace1/demo.py"
]
},
{
Expand Down Expand Up @@ -90,7 +104,7 @@ content-type: application/json
}

### Quick pick between 3 choices
POST http://localhost:37100 HTTP/1.1
POST {{endpoint}} HTTP/1.1
content-type: application/json

{
Expand All @@ -115,4 +129,31 @@ content-type: application/json
}
]
}]
}
}

### install an extension
POST {{endpoint}} HTTP/1.1
content-type: application/json

{
"command": "workbench.extensions.installExtension",
"args": ["dpar39.vscode-taef-test-adapter"]
}

### uninstall an extension
POST {{endpoint}} HTTP/1.1
content-type: application/json

{
"command": "workbench.extensions.uninstallExtension",
"args": ["dpar39.vscode-taef-test-adapter"]
}

### developer: reload window
POST {{endpoint}} HTTP/1.1
content-type: application/json

{
"command": "workbench.action.reloadWindow",
"args": []
}

0 comments on commit 4aa33fc

Please sign in to comment.