Skip to content

Commit

Permalink
chore: refactor wdio.conf and tsconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
DudaGod committed Oct 1, 2024
1 parent e4a6f2b commit a94a9ad
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 116 deletions.
15 changes: 1 addition & 14 deletions tests/e2e/basic/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
{
"compilerOptions": {
"lib": ["es2022", "dom"],
"types": ["node", "@wdio/globals/types", "expect-webdriverio", "@wdio/mocha-framework", "wdio-vscode-service"],
"esModuleInterop": true,
"skipLibCheck": true,
"noEmit": true,
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"extends": "../tsconfig.common.json",
"include": ["specs", "wdio.conf.ts"]
}
49 changes: 5 additions & 44 deletions tests/e2e/basic/wdio.conf.ts
Original file line number Diff line number Diff line change
@@ -1,47 +1,8 @@
import fs from "node:fs/promises";
import path from "node:path";
import { getWdioConfig } from "../utils";
import type { Options } from "@wdio/types";

const extensionPath = process.env.VSCODE_E2E_EXTENSION_PATH ?? process.cwd();
const workspacePath = path.resolve(process.cwd(), process.env.VSCODE_E2E_WORKSPACE_PATH || "samples/basic");

export const config: Options.Testrunner = {
runner: "local",
specs: ["./specs/**/*.ts"],
maxInstances: 1,
capabilities: [
{
browserName: "vscode",
browserVersion: process.env.VSCODE_VERSION || "stable",
"wdio:vscodeOptions": {
extensionPath,
workspacePath,
userSettings: {
"npm.packageManager": "npm",
"git.openRepositoryInParentFolders": "never",
},
},
},
],
logLevel: "info",
waitforTimeout: 10000,
connectionRetryTimeout: 120000,
connectionRetryCount: 0,
specFileRetries: process.env.RUN_IN_CI ? 1 : 0,
services: ["vscode"],
framework: "mocha",
reporters: ["spec"],
mochaOpts: {
ui: "bdd",
timeout: 60000,
},
afterTest: async (test, _, { passed }) => {
if (passed) {
return;
}

const screenshotDir = path.join(__dirname, "..", "screens-on-fail");
await fs.mkdir(screenshotDir, { recursive: true });
await browser.saveScreenshot(path.join(screenshotDir, `${test.parent} - ${test.title}.png`));
},
};
export const config: Options.Testrunner = getWdioConfig({
extensionPath: process.cwd(),
workspacePath: path.resolve(process.cwd(), "samples/basic"),
});
15 changes: 1 addition & 14 deletions tests/e2e/settings-view/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
{
"compilerOptions": {
"lib": ["es2022", "dom"],
"types": ["node", "@wdio/globals/types", "expect-webdriverio", "@wdio/mocha-framework", "wdio-vscode-service"],
"esModuleInterop": true,
"skipLibCheck": true,
"noEmit": true,
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"extends": "../tsconfig.common.json",
"include": ["specs", "wdio.conf.ts"]
}
49 changes: 5 additions & 44 deletions tests/e2e/settings-view/wdio.conf.ts
Original file line number Diff line number Diff line change
@@ -1,47 +1,8 @@
import fs from "node:fs/promises";
import path from "node:path";
import { getWdioConfig } from "../utils";
import type { Options } from "@wdio/types";

const extensionPath = process.env.VSCODE_E2E_EXTENSION_PATH ?? process.cwd();
const workspacePath = path.resolve(process.cwd(), process.env.VSCODE_E2E_WORKSPACE_PATH || "samples/settings-view");

export const config: Options.Testrunner = {
runner: "local",
specs: ["./specs/**/*.ts"],
maxInstances: 1,
capabilities: [
{
browserName: "vscode",
browserVersion: process.env.VSCODE_VERSION || "stable",
"wdio:vscodeOptions": {
extensionPath,
workspacePath,
userSettings: {
"npm.packageManager": "npm",
"git.openRepositoryInParentFolders": "never",
},
},
},
],
logLevel: "info",
waitforTimeout: 10000,
connectionRetryTimeout: 120000,
connectionRetryCount: 0,
specFileRetries: process.env.RUN_IN_CI ? 1 : 0,
services: ["vscode"],
framework: "mocha",
reporters: ["spec"],
mochaOpts: {
ui: "bdd",
timeout: 60000,
},
afterTest: async (test, _, { passed }) => {
if (passed) {
return;
}

const screenshotDir = path.join(__dirname, "..", "screens-on-fail");
await fs.mkdir(screenshotDir, { recursive: true });
await browser.saveScreenshot(path.join(screenshotDir, `${test.parent} - ${test.title}.png`));
},
};
export const config: Options.Testrunner = getWdioConfig({
extensionPath: process.cwd(),
workspacePath: path.resolve(process.cwd(), "samples/settings-view"),
});

0 comments on commit a94a9ad

Please sign in to comment.