-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
E2E test: positronSettings POM (#5870)
Implement the settings set/unset functionality in pure playwright. ### QA Notes All tests should pass.
- Loading branch information
1 parent
0841d7b
commit 05a6a6e
Showing
6 changed files
with
86 additions
and
3 deletions.
There are no files selected for viewing
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
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
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
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
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,40 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (C) 2024 Posit Software, PBC. All rights reserved. | ||
* Licensed under the Elastic License 2.0. See LICENSE.txt for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
|
||
import { Code } from '../code'; | ||
import { PositronEditor } from './positronEditor'; | ||
import { PositronEditors } from './positronEditors'; | ||
import { PositronQuickAccess } from './positronQuickaccess'; | ||
|
||
export class PositronSettings { | ||
|
||
constructor(private code: Code, private editors: PositronEditors, private editor: PositronEditor, private quickaccess: PositronQuickAccess) { } | ||
|
||
async addUserSettings(settings: [key: string, value: string][]): Promise<void> { | ||
await this.openUserSettingsFile(); | ||
const file = 'settings.json'; | ||
await this.code.driver.page.keyboard.press('ArrowRight'); | ||
await this.editor.waitForTypeInEditor(file, settings.map(v => `"${v[0]}": ${v[1]},`).join('')); | ||
await this.editors.saveOpenedFile(); | ||
await this.editors.waitForActiveTabNotDirty(file); | ||
} | ||
|
||
async clearUserSettings(): Promise<void> { | ||
await this.openUserSettingsFile(); | ||
const file = 'settings.json'; | ||
await this.quickaccess.runCommand('editor.action.selectAll'); | ||
await this.code.driver.page.keyboard.press('Delete'); | ||
await this.editor.waitForTypeInEditor(file, `{`); // will auto close } | ||
await this.editors.saveOpenedFile(); | ||
await this.editors.waitForActiveTabNotDirty(file); | ||
await this.quickaccess.runCommand('workbench.action.closeActiveEditor'); | ||
} | ||
|
||
async openUserSettingsFile(): Promise<void> { | ||
await this.quickaccess.runCommand('workbench.action.openSettingsJson'); | ||
await this.editor.waitForEditorFocus('settings.json', 1); | ||
} | ||
} |
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