Skip to content

Commit

Permalink
fix: errors
Browse files Browse the repository at this point in the history
  • Loading branch information
DudaGod committed Oct 7, 2024
1 parent 229256f commit ebc6075
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 46 deletions.
50 changes: 50 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@
]
},
"configuration": {
"title": "Testplane",
"properties": {
"testplane.configPath": {
"markdownDescription": "The path to the Testplane [configuration file](https://testplane.io/docs/v8/config/main/)",
"type": "string",
"scope": "window"
}
"title": "Testplane",
"properties": {
"testplane.configPath": {
"markdownDescription": "The path to the Testplane [configuration file](https://testplane.io/docs/v8/config/main/)",
"type": "string",
"scope": "window"
}
}
}
},
"repository": {
Expand All @@ -60,7 +60,7 @@
"build": "tsup --minify --clean",
"watch": "tsup --watch --sourcemap",
"test": "npm run lint && npm run test-e2e",
"test-e2e": "npm run test-e2e:basic && npm run test-e2e:settings-view && npm run test-e2e:vscode-settings && npm run test-e2e:empty",
"test-e2e": "concurrently -c 'auto' 'npm:test-e2e:basic' 'npm:test-e2e:settings-view' 'npm:test-e2e:vscode-settings' 'npm:test-e2e:empty'",
"test-e2e:basic": "wdio run ./tests/e2e/basic/wdio.conf.ts",
"test-e2e:settings-view": "wdio run ./tests/e2e/settings-view/wdio.conf.ts",
"test-e2e:vscode-settings": "wdio run ./tests/e2e/vscode-settings/wdio.conf.ts",
Expand Down Expand Up @@ -88,6 +88,7 @@
"@wdio/mocha-framework": "^8.40.3",
"@wdio/spec-reporter": "^8.40.3",
"birpc": "^0.2.17",
"concurrently": "^9.0.1",
"error-stack-parser": "^2.1.4",
"eslint": "^8.56.0",
"eslint-config-gemini-testing": "^3.0.0",
Expand Down
28 changes: 1 addition & 27 deletions samples/vscode-settings/testplane.config.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1 @@
export default {
gridUrl: "http://localhost:4444/wd/hub",
baseUrl: "http://localhost",
pageLoadTimeout: 0,
httpTimeout: 60000,
testTimeout: 90000,
resetCursor: false,
takeScreenshotOnFails: {
testFail: false,
assertViewFail: false,
},
sets: {
desktop: {
files: ["tests/**/*.testplane.ts"],
browsers: ["chrome"],
},
},
browsers: {
chrome: {
automationProtocol: "devtools",
headless: true,
desiredCapabilities: {
browserName: "chrome",
},
},
},
};
throw new Error("This config should not be used");
4 changes: 2 additions & 2 deletions src/config/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as vscode from "vscode";
import { getVSCodeSettings, type VSCodeSettings } from "./settings";
import { findTpnConfigFile } from "./utils";
import { findTestplaneConfigFile } from "./utils";

export type VSCodeConfig = VSCodeSettings;

export const getVSCodeConfig = async (wf?: vscode.WorkspaceFolder): Promise<VSCodeConfig> => {
const settings = getVSCodeSettings(wf);
const configPath = settings.configPath ? settings.configPath : await findTpnConfigFile();
const configPath = settings.configPath ? settings.configPath : await findTestplaneConfigFile();

return { configPath };
};
2 changes: 1 addition & 1 deletion src/config/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const getVSCodeSettings = (wf?: vscode.WorkspaceFolder): VSCodeSettings =
defaultValue,
});

const configPath = get<string | undefined>("configPath");
const configPath = get<string>("configPath");

return {
configPath: resolveConfigPath(configPath, wf),
Expand Down
11 changes: 8 additions & 3 deletions src/config/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@ import * as vscode from "vscode";
import _ from "lodash";
import { CONFIG_GLOB, CONFIG_GLOB_EXCLUDE } from "../constants";

export const findTpnConfigFile = async (): Promise<string | undefined> => {
const configs = (await vscode.workspace.findFiles(CONFIG_GLOB, CONFIG_GLOB_EXCLUDE)).sort((a, b) => {
export const findTestplaneConfigFile = async (): Promise<string | undefined> => {
const configs = await vscode.workspace.findFiles(CONFIG_GLOB, CONFIG_GLOB_EXCLUDE);
const consfigsSortedByNesting = configs.sort((a, b) => {
return a.fsPath.split(path.sep).length - b.fsPath.split(path.sep).length;
});

return _.isEmpty(configs) ? undefined : configs[0].fsPath;
if (_.isEmpty(consfigsSortedByNesting)) {
return;
}

return configs[0].fsPath;
};
7 changes: 2 additions & 5 deletions tests/e2e/vscode-settings/specs/use-vscode-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@ describe(".vscode/settings.json", () => {
await sidebar.waitTestsRead();

const [firstSection] = await sidebar.getSections();
const [mainTreeItem] = await firstSection.getVisibleItems();
const visibleItems = await firstSection.getVisibleItems();

await mainTreeItem.expandAll();
const testsFullTitle = await mainTreeItem.getTestsFullTitle();

expect(testsFullTitle).toEqual(["tests test.testplane.ts success another-bro"]);
expect(visibleItems).toHaveLength(1);
});
});

0 comments on commit ebc6075

Please sign in to comment.