1 /**
2  * UGENE - Integrated Bioinformatics Tools.
3  * Copyright (C) 2008-2021 UniPro <ugene@unipro.ru>
4  * http://ugene.net
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301, USA.
20  */
21 
22 #ifndef _U2_GT_UTILS_NOTIFICATIONS_H_
23 #define _U2_GT_UTILS_NOTIFICATIONS_H_
24 
25 #include "GTGlobals.h"
26 #include "utils/GTUtilsDialog.h"
27 
28 namespace U2 {
29 using namespace HI;
30 
31 class NotificationChecker : public QObject {
32     Q_OBJECT
33 public:
34     NotificationChecker(HI::GUITestOpStatus &_os);
35 
36 public slots:
37     void sl_checkNotification();
38 
39 private:
40     QTimer *t;
41     HI::GUITestOpStatus &os;
42 };
43 
44 class NotificationDialogFiller : public Filler {
45 public:
46     NotificationDialogFiller(HI::GUITestOpStatus &os, const QString &message = "");
47 
48     void commonScenario();
49 
50 private:
51     QString message;
52 };
53 
54 class GTUtilsNotifications {
55 public:
56     static void waitForNotification(HI::GUITestOpStatus &os, bool dialogExpected = true, const QString &message = "");
57 
58     /** Waits for notification, clicks it and checks that the notification report contains the required text tokens. */
59     static void checkNotificationReportText(HI::GUITestOpStatus &os, const QString &textToken);
60     static void checkNotificationReportText(HI::GUITestOpStatus &os, const QStringList &textTokenList);
61 
62     /** Waits for notification, clicks it and checks that the modal dialog has the required text. */
63     static void checkNotificationDialogText(HI::GUITestOpStatus &os, const QString &textToken);
64 
65     /** Clicks on the active (first) notification widget. */
66     static void clickOnNotificationWidget(HI::GUITestOpStatus &os);
67 
68     /** Waits until all notification popups are closed. */
69     static void waitAllNotificationsClosed(HI::GUITestOpStatus &os);
70 
71     /** Checks that there are no notification balloons on the screen. */
72     static void checkNoVisibleNotifications(HI::GUITestOpStatus &os);
73 };
74 
75 }  // namespace U2
76 
77 #endif  // _U2_GT_UTILS_NOTIFICATIONS_H_
78