Skip to content

Commit 991950e

Browse files
committed
Adjust preference page object to new selection
Change-Id: I590b6694bee7c93d4b9983582e83080c51c8fcb4
1 parent a09c3d9 commit 991950e

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

examples/playwright/src/theia-preference-view.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ export enum TheiaPreferenceScope {
7070
export class TheiaPreferenceView extends TheiaView {
7171
public customTimeout?: number;
7272
protected modificationIndicator = '.theia-mod-item-modified';
73+
protected optionSelectLabel = '.theia-select-component-label';
74+
protected optionSelectDropdown = '.theia-select-component-dropdown';
75+
protected optionSelectDropdownValue = '.theia-select-component-option-value';
7376

7477
constructor(app: TheiaApp) {
7578
super(TheiaSettingsViewData, app);
@@ -138,12 +141,8 @@ export class TheiaPreferenceView extends TheiaView {
138141
}
139142

140143
async getOptionsPreferenceById(preferenceId: string): Promise<string> {
141-
const element = await this.findPreferenceEditorById(preferenceId, 'select');
142-
return element.evaluate(e => {
143-
const selectElement = (e as HTMLSelectElement);
144-
const option = selectElement.options[selectElement.selectedIndex];
145-
return option.text;
146-
});
144+
const element = await this.findPreferenceEditorById(preferenceId, this.optionSelectLabel);
145+
return element.evaluate(e => e.textContent ?? '');
147146
}
148147

149148
async setOptionsPreferenceByPath(sectionTitle: string, name: string, value: string): Promise<void> {
@@ -152,8 +151,10 @@ export class TheiaPreferenceView extends TheiaView {
152151
}
153152

154153
async setOptionsPreferenceById(preferenceId: string, value: string): Promise<void> {
155-
const element = await this.findPreferenceEditorById(preferenceId, 'select');
156-
await element.selectOption({ label: value });
154+
const element = await this.findPreferenceEditorById(preferenceId, this.optionSelectLabel);
155+
await element.click();
156+
const option = await this.page.waitForSelector(`${this.optionSelectDropdown} ${this.optionSelectDropdownValue}:has-text("${value}")`);
157+
await option.click();
157158
}
158159

159160
async resetPreferenceByPath(sectionTitle: string, name: string): Promise<void> {

0 commit comments

Comments
 (0)