Skip to content

Commit aaec5ae

Browse files
committed
Issue #14: add receive request restart/copy E2E coverage
1 parent c468fe1 commit aaec5ae

File tree

8 files changed

+343
-10
lines changed

8 files changed

+343
-10
lines changed

doc/test-automation-selectors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ It supports the parity backlog Definition of Done (`DefinitionOfDone.md`) requir
2121

2222
## Current Examples
2323

24-
- Receive flow: `receiveAmountInput`, `receiveLabelInput`, `receiveCreateAddressButton`
24+
- Receive flow: `receiveAmountInput`, `receiveLabelInput`, `receiveCreateAddressButton`, `receiveCopySelectedUriButton`, `receiveQrImage`
2525
- Send flow: `sendAddressInput`, `sendContinueButton`, `sendResultPopup`
2626
- Wallet tabs/pages: `walletSendPage`, `walletRequestPaymentPage`, `activityListView`
2727
- Onboarding storage flow: `onboardingStorageAmountDetailedSettingsButton`, `storageSettingsPruneTargetInput`, `storageLocationDefaultOption`

qml/pages/wallet/RequestPayment.qml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ Page {
192192
labelText: qsTr("Label")
193193
placeholderText: qsTr("Enter label...")
194194
text: root.request ? root.request.label : ""
195-
onTextEdited: {
196-
if (root.request) {
195+
onTextChanged: {
196+
if (root.request && root.request.label !== label.text) {
197197
root.request.label = label.text
198198
}
199199
}
@@ -210,8 +210,8 @@ Page {
210210
labelText: qsTr("Message")
211211
placeholderText: qsTr("Enter message...")
212212
text: root.request ? root.request.message : ""
213-
onTextEdited: {
214-
if (root.request) {
213+
onTextChanged: {
214+
if (root.request && root.request.message !== message.text) {
215215
root.request.message = message.text
216216
}
217217
}
@@ -360,6 +360,8 @@ Page {
360360
required property string amountDisplay
361361
required property string uri
362362

363+
signal clicked
364+
363365
objectName: "receiveHistoryRow_" + requestId
364366
width: historyList.width
365367
height: 62
@@ -368,6 +370,12 @@ Page {
368370
? Theme.color.orangeLight2
369371
: Theme.color.neutral2
370372

373+
onClicked: {
374+
if (root.wallet && root.wallet.loadPaymentRequest) {
375+
root.wallet.loadPaymentRequest(requestId)
376+
}
377+
}
378+
371379
Column {
372380
anchors.fill: parent
373381
anchors.margins: 8
@@ -392,11 +400,7 @@ Page {
392400

393401
MouseArea {
394402
anchors.fill: parent
395-
onClicked: {
396-
if (root.wallet && root.wallet.loadPaymentRequest) {
397-
root.wallet.loadPaymentRequest(requestId)
398-
}
399-
}
403+
onClicked: parent.clicked()
400404
}
401405
}
402406
}
@@ -453,6 +457,7 @@ Page {
453457
}
454458
contentItem: QRImage {
455459
id: qrImage
460+
objectName: "receiveQrImage"
456461
backgroundColor: "transparent"
457462
foregroundColor: Theme.color.neutral9
458463
code: root.request ? root.request.qrPayload : ""

qml/test/testbridge.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#include <QMetaMethod>
1111
#include <QMetaObject>
1212
#include <QMetaProperty>
13+
#include <QClipboard>
14+
#include <QGuiApplication>
1315
#include <QImage>
1416
#include <QMouseEvent>
1517
#include <QQmlContext>
@@ -205,6 +207,8 @@ QByteArray TestBridge::processCommand(const QByteArray& json_cmd)
205207
obj.value(QStringLiteral("nonEmpty")).toBool(false));
206208
} else if (cmd == QLatin1String("get_text")) {
207209
return cmdGetText(obj.value(QStringLiteral("objectName")).toString());
210+
} else if (cmd == QLatin1String("get_clipboard_text")) {
211+
return cmdGetClipboardText();
208212
} else if (cmd == QLatin1String("save_screenshot")) {
209213
return cmdSaveScreenshot(obj.value(QStringLiteral("path")).toString());
210214
} else if (cmd == QLatin1String("list_objects")) {
@@ -533,6 +537,17 @@ QByteArray TestBridge::cmdGetText(const QString& object_name)
533537
return QJsonDocument(resp).toJson(QJsonDocument::Compact);
534538
}
535539

540+
QByteArray TestBridge::cmdGetClipboardText()
541+
{
542+
if (QGuiApplication::clipboard() == nullptr) {
543+
return errorResponse(QStringLiteral("Clipboard is unavailable"));
544+
}
545+
546+
QJsonObject resp;
547+
resp[QStringLiteral("text")] = QGuiApplication::clipboard()->text();
548+
return QJsonDocument(resp).toJson(QJsonDocument::Compact);
549+
}
550+
536551
QByteArray TestBridge::cmdSaveScreenshot(const QString& path)
537552
{
538553
if (path.isEmpty()) {

qml/test/testbridge.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
/// {"cmd": "wait_for_page", "page": "<objectName>", "timeout": <ms>}
2929
/// {"cmd": "wait_for_property", "objectName": "<name>", "prop": "<property>", "timeout": <ms>, "value": <json>, "contains": "<substring>", "nonEmpty": true}
3030
/// {"cmd": "get_text", "objectName": "<name>"}
31+
/// {"cmd": "get_clipboard_text"}
3132
/// {"cmd": "save_screenshot", "path": "</tmp/screenshot.png>"}
3233
/// {"cmd": "list_objects"}
3334
class TestBridge : public QObject
@@ -69,6 +70,7 @@ private Q_SLOTS:
6970
QByteArray cmdWaitForPage(const QString& page_name, int timeout_ms);
7071
QByteArray cmdWaitForProperty(const QString& object_name, const QString& prop, int timeout_ms, const QJsonValue& expected, bool has_expected, const QString& contains, bool non_empty);
7172
QByteArray cmdGetText(const QString& object_name);
73+
QByteArray cmdGetClipboardText();
7274
QByteArray cmdSaveScreenshot(const QString& path);
7375
QByteArray cmdListObjects();
7476

test/functional/qml_driver.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,13 @@ def list_objects(self):
159159
raise QmlDriverError(f"list_objects failed: {resp['error']}")
160160
return resp["objects"]
161161

162+
def get_clipboard_text(self):
163+
"""Return current clipboard text from the GUI process."""
164+
resp = self._send({"cmd": "get_clipboard_text"})
165+
if "error" in resp:
166+
raise QmlDriverError(f"get_clipboard_text() failed: {resp['error']}")
167+
return resp["text"]
168+
162169
def save_screenshot(self, path):
163170
"""Capture the GUI window and save it as a PNG file."""
164171
resp = self._send({"cmd": "save_screenshot", "path": path})

0 commit comments

Comments
 (0)