From ed107e6450609cf49c8a12711d60e0d293c71ae6 Mon Sep 17 00:00:00 2001 From: Dominik Jelinek Date: Tue, 5 Mar 2024 16:57:05 +0000 Subject: [PATCH] test: Fix ModialDialog tests for VS Code 1.87.0 --- locators/lib/1.37.0.ts | 5 ++++- locators/lib/1.87.0.ts | 5 +++++ page-objects/src/components/dialog/ModalDialog.ts | 2 +- page-objects/src/locators/locators.ts | 3 +++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/locators/lib/1.37.0.ts b/locators/lib/1.37.0.ts index 60b2ef6c9..a9272d400 100644 --- a/locators/lib/1.37.0.ts +++ b/locators/lib/1.37.0.ts @@ -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') + } } } diff --git a/locators/lib/1.87.0.ts b/locators/lib/1.87.0.ts index dbca8d755..c0728ac1e 100644 --- a/locators/lib/1.87.0.ts +++ b/locators/lib/1.87.0.ts @@ -28,6 +28,11 @@ export const diff: LocatorDiff = { }, DefaultTreeItem: { labelAttribute: 'aria-label' + }, + Dialog: { + buttonLabel: { + value: fromText() + } } } } \ No newline at end of file diff --git a/page-objects/src/components/dialog/ModalDialog.ts b/page-objects/src/components/dialog/ModalDialog.ts index fb6d6d7c3..6a995f56c 100644 --- a/page-objects/src/components/dialog/ModalDialog.ts +++ b/page-objects/src/components/dialog/ModalDialog.ts @@ -42,7 +42,7 @@ export class ModalDialog extends AbstractElement { */ async pushButton(title: string): Promise { 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(); diff --git a/page-objects/src/locators/locators.ts b/page-objects/src/locators/locators.ts index fb25db1aa..a03d59643 100644 --- a/page-objects/src/locators/locators.ts +++ b/page-objects/src/locators/locators.ts @@ -457,6 +457,9 @@ export interface Locators { buttonContainer: By button: By closeButton: By + buttonLabel: { + value: WebElementFunction + } } WelcomeContent: {