on xenial help sign in
adding tests
614e7b1Diego Sarmentero
qml/Dash/Previews/PreviewPayments.qml+1
@@ -49,6 +49,7 @@ PreviewWidget {
49
49
50 Payments {
50 Payments {
51 id: paymentClient
51 id: paymentClient
52+ objectName: "paymentClient"
52
53
53 property var source: widgetData["source"]
54 property var source: widgetData["source"]
54
55
tests/qmltests/Dash/Previews/tst_PreviewPayments.qml+31
@@ -103,6 +103,37 @@ Rectangle {
103 tryCompare(button, "opacity", 0);
103 tryCompare(button, "opacity", 0);
104 }
104 }
105
105
106+ function test_progress_show_cancel() {
107+ // Make sure the progress bar is shown.
108+ previewPayments.widgetData = jsonPurchase;
109+
110+ var button = findChild(root, "paymentButton");
111+ var progress = findChild(root, "loadingBar");
112+
113+ tryCompare(progress, "visible", false);
114+ tryCompare(progress, "opacity", 0);
115+ tryCompare(button, "visible", true);
116+ tryCompare(button, "opacity", 1);
117+
118+ mouseClick(button, button.width / 2, button.height / 2);
119+
120+ spy.wait();
121+
122+ tryCompare(progress, "visible", true);
123+ tryCompare(progress, "opacity", 1);
124+ tryCompare(button, "visible", false);
125+ tryCompare(button, "opacity", 0);
126+
127+ var paymentClient = findChild(root, "paymentClient");
128+ paymentClient.storeItemId = "com.example.invalid";
129+ paymentClient.start();
130+
131+ tryCompare(progress, "visible", false);
132+ tryCompare(progress, "opacity", 0);
133+ tryCompare(button, "visible", true);
134+ tryCompare(button, "opacity", 1);
135+ }
136+
106 function test_purchase_error() {
137 function test_purchase_error() {
107 // The mock Payments triggers an error when com.example.invalid is
138 // The mock Payments triggers an error when com.example.invalid is
108 // passed to it as store_item_id. Exercise it here
139 // passed to it as store_item_id. Exercise it here