Skip to content

Commit

Permalink
test: Fix ModialDialog tests for VS Code 1.87.0
Browse files Browse the repository at this point in the history
  • Loading branch information
djelinek committed Mar 19, 2024
1 parent 1c74aa1 commit 5b5ec72
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
5 changes: 4 additions & 1 deletion locators/lib/1.37.0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,10 @@ const dialog = {
details: By.className('dialog-message-detail'),
buttonContainer: By.className('dialog-buttons-row'),
button: By.className('monaco-text-button'),
closeButton: By.className('codicon-dialog-close')
closeButton: By.className('codicon-dialog-close'),
buttonLabel: {
value: fromAttribute('title')
}
}
}

Expand Down
5 changes: 5 additions & 0 deletions locators/lib/1.87.0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ export const diff: LocatorDiff = {
},
DefaultTreeItem: {
labelAttribute: 'aria-label'
},
Dialog: {
buttonLabel: {
value: fromText()
}
}
}
}
2 changes: 1 addition & 1 deletion page-objects/src/components/dialog/ModalDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class ModalDialog extends AbstractElement {
*/
async pushButton(title: string): Promise<void> {
const buttons = await this.getButtons();
const titles = await Promise.all(buttons.map(async btn => btn.getAttribute('title')));
const titles = await Promise.all(buttons.map(async btn => ModalDialog.locators.Dialog.buttonLabel.value(btn)));
const index = titles.findIndex(value => value === title);
if (index > -1) {
await buttons[index].click();
Expand Down
3 changes: 3 additions & 0 deletions page-objects/src/locators/locators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,9 @@ export interface Locators {
buttonContainer: By
button: By
closeButton: By
buttonLabel: {
value: WebElementFunction<WebElement, string>
}
}

WelcomeContent: {
Expand Down

0 comments on commit 5b5ec72

Please sign in to comment.