- Add TaskDumpRecorder to save task-related XML dumps and upload failure info to Telegram. - Integrate TaskDumpRecorder into `PayByPhoneScript` and `PayByCardScript` for Dushanbe and Ozon banks. - Extend ADB utilities to record XML dumps with TaskDumpRecorder and refine keyboard dismissal logic. - Enhance freeze detection with consecutive dump checks in CommonScript and payment scripts. - Update mock server profiles and scenario configurations with new material IDs.
117 lines
3.8 KiB
C++
117 lines
3.8 KiB
C++
#pragma once
|
||
|
||
#include <QObject>
|
||
#include <QDomElement>
|
||
#include "android/xml/Node.h"
|
||
#include "db/MaterialInfo.h"
|
||
#include "db/TransactionInfo.h"
|
||
|
||
namespace Ozon {
|
||
|
||
class ScreenXmlParser final : public QObject {
|
||
Q_OBJECT
|
||
|
||
public:
|
||
explicit ScreenXmlParser(QObject *parent = nullptr);
|
||
|
||
~ScreenXmlParser() override;
|
||
|
||
Node tryToFindBannerOrDialog(int width, int height);
|
||
|
||
Node tryToFindSecurityBanner();
|
||
|
||
Node tryToFindSelectBottomSheet();
|
||
|
||
Node findTextNode(const QString &text);
|
||
|
||
Node findTextNode(const QString &text, int x1, int y1, int x2, int y2);
|
||
|
||
Node findFirstEditText();
|
||
|
||
Node findEditTextByHint(const QString &hintPrefix);
|
||
|
||
Node findButtonNode(const QString &text, bool contains);
|
||
|
||
QList<Node> findAllButtons();
|
||
|
||
const QList<Node> &findAllNodes() const;
|
||
|
||
Node findNodeByContentDesc(const QString &contentDesc);
|
||
|
||
bool isHomeScreen();
|
||
|
||
Node tryToFindAdBanner();
|
||
|
||
Node tryToFindGooglePlayBanner(int screenWidth, int screenHeight);
|
||
|
||
// Находит кнопку "ЗАПРЕТИТЬ" в системном диалоге запроса разрешения Android
|
||
// (com.google.android.permissioncontroller). Возвращает пустой Node если диалог не виден.
|
||
Node tryToFindSystemPermissionDenyButton();
|
||
|
||
// Returns a Button node whose text is exactly 4 digits (card last numbers)
|
||
Node findCardButtonOnHomeScreen();
|
||
|
||
// Finds a card button whose text ends with the given last 4 digits
|
||
Node findCardButtonByLastNumbers(const QString &lastNumbers);
|
||
|
||
// Returns all cards visible on the home screen as MaterialInfo stubs
|
||
// (lastNumbers, description, amount filled; id=-1, cardNumber empty)
|
||
QList<MaterialInfo> parseCardsOnHomeScreen();
|
||
|
||
bool isProfileScreen();
|
||
|
||
Node findUserNameOnHomeScreen(int screenHeight);
|
||
|
||
QString parseProfileFullName();
|
||
|
||
QString parseProfilePhone();
|
||
|
||
QList<Node> tryToFindPinCode(const QString &pinCode, const QString &title);
|
||
|
||
QList<Node> getLast2DaysTransactions();
|
||
|
||
void parseAndSaveXml(const QString &xml);
|
||
|
||
TransactionInfo parseTransactionInfoHistory(int screenWidth, int screenHeight);
|
||
TransactionInfo parseTransactionInfo(int screenWidth, int screenHeight);
|
||
|
||
QList<TransactionInfo> parseTodayAndYesterdayReportHistory();
|
||
|
||
QList<TransactionInfo> parseTodayAndYesterdayHistory();
|
||
|
||
|
||
QList<QPair<MaterialInfo, Node> > parseAccountsInfo();
|
||
|
||
// Finds a TextView with full card number (format "XXXX XXXX XXXX XXXX")
|
||
QString findFullCardNumber();
|
||
|
||
bool isTransactionListScreen();
|
||
|
||
// Возвращает кнопки транзакций на экране "Операции" (до maxCount штук)
|
||
QList<Node> findTransactionButtons(int maxCount);
|
||
|
||
// Ozon WebView рендерит tappable-Button только для видимых транзакций.
|
||
// Off-screen элементы остаются в accessibility-tree как android.view.View
|
||
// с "схлопнутыми" bounds (height == 0). Если такие View с ₽-знаком есть —
|
||
// значит в списке осталось что прокручивать. Используется для детекции
|
||
// того, что скролл не завершён.
|
||
bool hasCollapsedTransactionsBelow(int screenHeight);
|
||
|
||
// Парсит имя и сумму из текста кнопки: "NAME + 150 ₽ CATEGORY"
|
||
TransactionInfo parseTransactionButtonText(const QString &text);
|
||
|
||
// Парсит детали транзакции: дату, имя отправителя, телефон
|
||
TransactionInfo parseTransactionDetail();
|
||
|
||
void test();
|
||
|
||
[[nodiscard]] const QList<Node> &getNodes() const { return m_nodes; }
|
||
|
||
private:
|
||
QList<Node> m_nodes;
|
||
QDomElement m_xml;
|
||
|
||
QList<Node> findPinCodeNodes(const QString &pinCode);
|
||
};
|
||
|
||
} // namespace Ozon
|