Files
azuredatastudio/test/automation/src/sql/notificationToast.ts
Lucy Zhang 7e1c0076ba Try to make smoke tests more stable (#15212)
* make sure dialog buttons are not disabled

* use 'enter' to close connect dialog

* retry clikcing the Connect button

* wait for dialog gone after reclicking

* pr comments + add logging

* use debug to log

* close toasts before clicking dialog buttons

* await close notification toast call

* click python wizard buttons instead of enter
2021-04-27 13:53:17 -07:00

28 lines
1.0 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Code } from '../code';
export class NotificationToast {
constructor(private readonly code: Code) { }
async closeNotificationToasts() {
const notificationToastSelector = 'div[class="notifications-toasts visible"]';
const notificationToastCloseButton = `a[class="action-label codicon codicon-notifications-clear"][role="button"]`;
let numberOfToasts = 0;
await this.code.waitForElements(notificationToastSelector, false, result => {
numberOfToasts = result.length;
return true;
});
for (let i = 0; i < numberOfToasts; i++) {
await this.code.waitAndClick(notificationToastSelector);
await this.code.waitAndClick(notificationToastCloseButton);
}
}
}