diff --git a/package.json b/package.json index 0e3be63f1..912f235c9 100644 --- a/package.json +++ b/package.json @@ -115,14 +115,6 @@ "default": false, "description": "%configuration.playwright.showTrace%" }, - "playwright.useTestServer": { - "type": "boolean", - "default": false - }, - "playwright.allowWatchingFiles": { - "type": "boolean", - "default": false - }, "playwright.workspaceSettings": { "type": "object", "default": {} diff --git a/src/extension.ts b/src/extension.ts index 89c74187b..32aaeda95 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -104,7 +104,7 @@ export class Extension implements RunHooks { this._testController = vscode.tests.createTestController('playwright', 'Playwright'); this._testController.resolveHandler = item => this._resolveChildren(item); this._testController.refreshHandler = () => this._rebuildModels(true).then(() => {}); - const supportsContinuousRun = this._settingsModel.allowWatchingFiles.get(); + const supportsContinuousRun = true; this._runProfile = this._testController.createRunProfile('playwright-run', this._vscode.TestRunProfileKind.Run, this._handleTestRun.bind(this, false), true, undefined, supportsContinuousRun); this._debugProfile = this._testController.createRunProfile('playwright-debug', this._vscode.TestRunProfileKind.Debug, this._handleTestRun.bind(this, true), true, undefined, supportsContinuousRun); this._testTree = new TestTree(vscode, this._models, this._testController); diff --git a/src/settingsModel.ts b/src/settingsModel.ts index 78e29bf42..c27a3b017 100644 --- a/src/settingsModel.ts +++ b/src/settingsModel.ts @@ -40,7 +40,6 @@ export class SettingsModel extends DisposableBase { private _onChange: vscodeTypes.EventEmitter; showBrowser: Setting; showTrace: Setting; - allowWatchingFiles: Setting; workspaceSettings: Setting; constructor(vscode: vscodeTypes.VSCode) { @@ -51,7 +50,6 @@ export class SettingsModel extends DisposableBase { this.showBrowser = this._createSetting('reuseBrowser'); this.showTrace = this._createSetting('showTrace'); - this.allowWatchingFiles = this._createSetting('allowWatchingFiles'); this.workspaceSettings = this._createSetting('workspaceSettings', true); this.showBrowser.onChange(enabled => { diff --git a/src/settingsView.ts b/src/settingsView.ts index ded2232ee..abd6eebaa 100644 --- a/src/settingsView.ts +++ b/src/settingsView.ts @@ -234,6 +234,8 @@ export class SettingsView extends DisposableBase implements vscodeTypes.WebviewV continue; this._models.setModelEnabled(model.config.configFile, !!result?.includes(modelItem), true); } + this._models.ensureHasEnabledModels(); + this._updateModels(); }); } } diff --git a/src/testModel.ts b/src/testModel.ts index 68f15ab93..09b13e676 100644 --- a/src/testModel.ts +++ b/src/testModel.ts @@ -698,10 +698,17 @@ export class TestModelCollection extends DisposableBase { } selectedModel(): TestModel | undefined { - const model = this._models.find(m => m.config.configFile === this._selectedConfigFile); + const enabledModels = this.enabledModels(); + if (!enabledModels.length) { + this._selectedConfigFile = undefined; + return undefined; + } + + const model = enabledModels.find(m => m.config.configFile === this._selectedConfigFile); if (model) return model; - return this._models.find(m => m.isEnabled); + this._selectedConfigFile = enabledModels[0].config.configFile; + return enabledModels[0]; } selectModel(configFile: string) { diff --git a/tests/watch.spec.ts b/tests/watch.spec.ts index 7b8075a95..34ef998cf 100644 --- a/tests/watch.spec.ts +++ b/tests/watch.spec.ts @@ -20,11 +20,6 @@ import path from 'path'; test.skip(({ overridePlaywrightVersion }) => !!overridePlaywrightVersion); -test.beforeEach(async ({ vscode }) => { - const configuration = vscode.workspace.getConfiguration('playwright'); - configuration.update('allowWatchingFiles', true); -}); - test('should watch all tests', async ({ activate }) => { const { vscode, testController, workspaceFolder } = await activate({ 'playwright.config.js': `module.exports = { testDir: 'tests' }`,